markus / KCOM / Events / Save.cs @ 53880c83
이력 | 보기 | 이력해설 | 다운로드 (5.95 KB)
1 |
using IKCOM; |
---|---|
2 |
using KCOM.Common; |
3 |
using KCOMDataModel.Common; |
4 |
using KCOMDataModel.DataModel; |
5 |
using MarkupToPDF.Common; |
6 |
using MarkupToPDF.Controls.Parsing; |
7 |
using System; |
8 |
using System.Collections.Generic; |
9 |
using System.Linq; |
10 |
using System.Text; |
11 |
using System.Windows.Controls; |
12 |
using static MarkupToPDF.Controls.Parsing.LayerControl; |
13 |
|
14 |
namespace KCOM.Events |
15 |
{ |
16 |
public class Save |
17 |
{ |
18 |
#region Properties |
19 |
|
20 |
public ViewInfo _ViewInfo; |
21 |
public string Project_No |
22 |
{ |
23 |
get; |
24 |
set; |
25 |
} |
26 |
public string document_id |
27 |
{ |
28 |
get; |
29 |
set; |
30 |
} |
31 |
|
32 |
public string user_id |
33 |
{ |
34 |
get; |
35 |
set; |
36 |
} |
37 |
|
38 |
public int page_no |
39 |
{ |
40 |
get; |
41 |
set; |
42 |
} |
43 |
#endregion |
44 |
|
45 |
|
46 |
|
47 |
//GUID생성(최민수 사원 수정) //조장원 대리 다시 변경 |
48 |
public static string shortGuid() |
49 |
{ |
50 |
byte[] bytes = new byte[16]; |
51 |
using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
52 |
{ |
53 |
provider.GetBytes(bytes); |
54 |
} |
55 |
|
56 |
var guid = new Guid(bytes); |
57 |
|
58 |
return Convert.ToBase64String(guid.ToByteArray()) |
59 |
.Substring(0, 10) |
60 |
.Replace("/", "") |
61 |
.Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x"); |
62 |
} |
63 |
|
64 |
//조장원 네자리 |
65 |
public static string shortCommentKey() |
66 |
{ |
67 |
byte[] bytes = new byte[3]; |
68 |
using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
69 |
{ |
70 |
provider.GetBytes(bytes); |
71 |
} |
72 |
|
73 |
return Convert.ToBase64String(bytes); |
74 |
} |
75 |
|
76 |
//강인구 추가 |
77 |
public static string shortFileKey() |
78 |
{ |
79 |
//byte[] bytes = new byte[3]; |
80 |
//using (var provider = System.IO.Path.GetRandomFileName()) |
81 |
//{ |
82 |
// provider.GetBytes(bytes); |
83 |
//} |
84 |
|
85 |
return System.IO.Path.GetRandomFileName(); |
86 |
} |
87 |
|
88 |
public void MarkupConsolidate() |
89 |
{ |
90 |
|
91 |
} |
92 |
|
93 |
//임시파일관련 |
94 |
TempFile temp = new TempFile(); |
95 |
//마크업 저장하기 |
96 |
public void MarkupSave(MarkupInfoItem UserState) |
97 |
{ |
98 |
try |
99 |
{ |
100 |
List<MARKUP_DATA> ml_markupdata = new List<MARKUP_DATA>(); |
101 |
|
102 |
ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value => |
103 |
{ |
104 |
ml_markupdata.Add(new MARKUP_DATA |
105 |
{ |
106 |
ID = value.ID, |
107 |
DATA = value.Data, |
108 |
DATA_TYPE = value.Data_Type, |
109 |
PAGENUMBER = value.PageNumber, |
110 |
MARKUPINFO_VERSION_ID = UserState.MarkupVersionID, |
111 |
SYMBOL_ID = value.Symbol_ID, |
112 |
GROUP_ID = value.Group_ID, |
113 |
}); |
114 |
|
115 |
}); |
116 |
|
117 |
Logger.sendReqLog("GetMarkupDataListperPage: ", UserState + "," + Project_No + "," + document_id + "," + user_id + "," + ml_markupdata, 1); |
118 |
Logger.sendResLog("GetMarkupDataListperPage", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, ml_markupdata).ToString(), 1); |
119 |
//Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, ml_markupdata); |
120 |
temp.Remove(); //임시파일삭제 |
121 |
} |
122 |
catch (Exception) |
123 |
{ |
124 |
throw; |
125 |
} |
126 |
|
127 |
} |
128 |
|
129 |
|
130 |
|
131 |
public void SymbolSave(string Name, string Url, string Data) |
132 |
{ |
133 |
try |
134 |
{ |
135 |
SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
136 |
{ |
137 |
ID = shortGuid(), |
138 |
MEMBER_USER_ID = App.ViewInfo.UserID, |
139 |
NAME = Name, |
140 |
IMAGE_URL = Url, |
141 |
DATA = Data |
142 |
}; |
143 |
|
144 |
Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
145 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
146 |
} |
147 |
catch(Exception) |
148 |
{ |
149 |
throw; |
150 |
} |
151 |
} |
152 |
public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
153 |
{ |
154 |
try |
155 |
{ |
156 |
SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
157 |
{ |
158 |
ID = shortGuid(), |
159 |
DEPARTMENT = Department, |
160 |
NAME = Name, |
161 |
IMAGE_URL = Url, |
162 |
DATA = Data |
163 |
}; |
164 |
|
165 |
Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
166 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
167 |
} |
168 |
catch (Exception) |
169 |
{ |
170 |
throw; |
171 |
} |
172 |
} |
173 |
public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage) |
174 |
{ |
175 |
try |
176 |
{ |
177 |
|
178 |
Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1); |
179 |
Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1); |
180 |
Common.ViewerDataModel.Instance.RotationDocs.Clear(); |
181 |
} |
182 |
catch (Exception) |
183 |
{ |
184 |
throw; |
185 |
} |
186 |
} |
187 |
} |
188 |
} |