markus / KCOM / Events / Save.cs @ d71ee575
이력 | 보기 | 이력해설 | 다운로드 (4.33 KB)
1 | 787a4489 | KangIngu | 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 | 6707a5c7 | ljiyeon | //임시파일관련 |
94 | TempFile temp = new TempFile(); |
||
95 | 787a4489 | KangIngu | //마크업 저장하기 |
96 | public void MarkupSave(MarkupInfoItem UserState) |
||
97 | { |
||
98 | 6c781c0c | djkim | try |
99 | 787a4489 | KangIngu | { |
100 | 6c781c0c | djkim | List<MARKUP_DATA> ml_markupdata = new List<MARKUP_DATA>(); |
101 | 787a4489 | KangIngu | |
102 | 6c781c0c | djkim | ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value => |
103 | 787a4489 | KangIngu | { |
104 | 6c781c0c | djkim | ml_markupdata.Add(new MARKUP_DATA |
105 | 787a4489 | KangIngu | { |
106 | 6c781c0c | djkim | ID = value.ID, |
107 | DATA = value.Data, |
||
108 | DATA_TYPE = value.Data_Type, |
||
109 | PAGENUMBER = value.PageNumber, |
||
110 | MARKUPINFO_VERSION_ID = UserState.MarkupVersionID |
||
111 | 787a4489 | KangIngu | }); |
112 | |||
113 | 6c781c0c | djkim | }); |
114 | 787a4489 | KangIngu | |
115 | 6c781c0c | djkim | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, ml_markupdata); |
116 | 6707a5c7 | ljiyeon | temp.Remove(); //임시파일삭제 |
117 | 787a4489 | KangIngu | } |
118 | 6c781c0c | djkim | catch (Exception) |
119 | { |
||
120 | throw; |
||
121 | } |
||
122 | |||
123 | 787a4489 | KangIngu | } |
124 | |||
125 | 6c781c0c | djkim | |
126 | 787a4489 | KangIngu | |
127 | public void SymbolSave(string Name, string Url, string Data) |
||
128 | { |
||
129 | 6c781c0c | djkim | try |
130 | 787a4489 | KangIngu | { |
131 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
132 | { |
||
133 | ID = shortGuid(), |
||
134 | MEMBER_USER_ID = App.ViewInfo.UserID, |
||
135 | NAME = Name, |
||
136 | IMAGE_URL = Url, |
||
137 | DATA = Data |
||
138 | }; |
||
139 | 6c781c0c | djkim | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
140 | } |
||
141 | catch(Exception) |
||
142 | { |
||
143 | throw; |
||
144 | } |
||
145 | } |
||
146 | 787a4489 | KangIngu | |
147 | 6c781c0c | djkim | public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage) |
148 | { |
||
149 | try |
||
150 | { |
||
151 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage); |
||
152 | 2b19f5f2 | djkim | Common.ViewerDataModel.Instance.RotationDocs.Clear(); |
153 | 6c781c0c | djkim | } |
154 | catch (Exception) |
||
155 | { |
||
156 | throw; |
||
157 | 787a4489 | KangIngu | } |
158 | } |
||
159 | } |
||
160 | } |