using System.Net; using Newtonsoft.Json.Linq; using KART_API.Utils; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using System.Text.RegularExpressions; using KART_API.Services; using Microsoft.AspNetCore.DataProtection.KeyManagement; using OfficeOpenXml.Style; namespace KART_API.Dto { public class projectCodeInfo { public string SecurityKey { get; set; } = string.Empty; public string projectCode { get; set; } = string.Empty; public string ver { get; set; } = string.Empty; public projectCodeInfo(string securityKey) { Security security = new Security(); SecurityKey = securityKey; projectCode = security.decryptString(WebUtility.UrlDecode(securityKey)); if (projectCode.IndexOf("|K|W|") > -1) { projectCode = projectCode.Replace("|K|W|", ""); ver = "KIWI"; } else if(projectCode.IndexOf("|N|S|") > -1) { projectCode = projectCode.Replace("|N|S|", ""); ver = "NEWSSAK"; } else { ver = "KON"; } } public projectCodeInfo() { } } /// /// KON Question 정보 /// 문항 등록시에 사용 /// public class QuestionInfo { public string variableName { get; set; } = string.Empty; public string explain { get; set; } = string.Empty; public string structureType { get; set; } = string.Empty; public string questionType { get; set; } = string.Empty; public string itemType { get; set; } = string.Empty; public string variableType { get; set; } = string.Empty; public string maxCount { get; set; } = string.Empty; public string questionTitle { get; set; } = string.Empty; public JObject attrJson { get; set; } = new JObject(); public JObject itemJson { get; set; } = new JObject(); public JObject optionJson { get; set; } = new JObject(); public QuestionInfo() { } } public class DataStructure { public string questionId { get; set; } = string.Empty; public string l { get; set; } = "-1"; public string t { get; set; } = "0"; public string m { get; set; } = "0"; public string r { get; set; } = "0"; public string s { get; set; } = "0"; public bool isEtc { get; set; } = false; public DataStructure() { } public DataStructure(string[] fixHeader, string inString) { if(Array.IndexOf(fixHeader, inString) > -1) { questionId = inString; } else { Regex qidRegex = new Regex(@"^[A-Za-z0-9_]+(?=_[0-9]#|_ETC)");//알파벳으로 시작하고 숫자 또는 언더바 if (qidRegex.IsMatch(inString)) { questionId = qidRegex.Match(inString).Value; var tempArray = inString.Replace(questionId+"_", "").Split('_'); if(tempArray[tempArray.Length-1].ToUpper() == "ETC") { isEtc = true; } for (int i = 0; i < tempArray.Length; i++) { string keyString = tempArray[i].Substring(0, tempArray[i].Length - 2); switch (tempArray[i].ToUpper().Substring(tempArray[i].Length - 1)) { case "L": l = keyString; break; case "T": t = keyString; break; case "M": m = keyString; break; case "R": r = keyString; break; case "S": s = keyString; break; } } } else { questionId = inString; } } } } public class DerivedParam { public string VariableID { get; set; } = string.Empty; public string OriginID { get; set; } = string.Empty; public string VariableType { get; set; } = string.Empty; public string VariableTitle { get; set; } = string.Empty; public string VariableInfo { get; set; } = string.Empty; /// /// DerivedParam 설정 /// /// 파생 변수명 /// 수정 전 변수명 /// 파생변수 타입 /// 파생변수 제목 /// 파생변수 정보 public DerivedParam(string variableID, string originID, string variableType, string variableTitle, string variableInfo) { VariableID = variableID; OriginID = originID; VariableType = variableType; VariableTitle = variableTitle; VariableInfo = variableInfo; } public DerivedParam() { } } public class BookmarkParam { public string BookmarkPage { get; set; } public string BookmarkID { get; set; } public string BookmarkTitle { get; set; } public string BookmarkInfo { get; set; } public string BookmarkJson { get; set; } public string IsOpen { get; set; } /// /// BookmarkParam 설정 /// /// TABULATION, CROSSTAB /// 북마크 ID /// 북마크 제목 /// 북마크 설명 /// 북마크 정보 /// 공개/비공개 public BookmarkParam(string bookmarkPage, string bookmarkID, string bookmarkTitle, string bookmarkInfo, string bookmarkJson, string isOpen) { BookmarkPage = bookmarkPage; BookmarkID = bookmarkID; BookmarkTitle = bookmarkTitle; BookmarkInfo = bookmarkInfo; BookmarkJson = bookmarkJson; IsOpen = isOpen; } public BookmarkParam() { } } public class LabelInfo { public string Value { get; set; } public string Label { get; set; } public LabelInfo(string value, string label) { Value = value; Label = label; } public LabelInfo() { } } }