markus / KCOM / Events / SaveCommand.cs @ 74abcf6f
이력 | 보기 | 이력해설 | 다운로드 (5.53 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 | c00d0547 | humkyung | using System.Collections.ObjectModel; |
10 | 787a4489 | KangIngu | using System.Linq; |
11 | using System.Text; |
||
12 | b42dd24d | taeseongkim | using System.Threading.Tasks; |
13 | 787a4489 | KangIngu | using System.Windows.Controls; |
14 | |||
15 | namespace KCOM.Events |
||
16 | { |
||
17 | de6499db | humkyung | public class SaveCommand |
18 | 787a4489 | KangIngu | { |
19 | de6499db | humkyung | private static readonly SaveCommand _instance = new SaveCommand(); |
20 | |||
21 | // Explicit static constructor to tell C# compiler |
||
22 | // not to mark type as beforefieldinit |
||
23 | static SaveCommand() |
||
24 | { |
||
25 | } |
||
26 | |||
27 | private SaveCommand() |
||
28 | { |
||
29 | } |
||
30 | |||
31 | public static SaveCommand Instance |
||
32 | { |
||
33 | get |
||
34 | { |
||
35 | return _instance; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | 787a4489 | KangIngu | #region Properties |
40 | |||
41 | public ViewInfo _ViewInfo; |
||
42 | public string Project_No |
||
43 | { |
||
44 | get; |
||
45 | set; |
||
46 | } |
||
47 | public string document_id |
||
48 | { |
||
49 | get; |
||
50 | set; |
||
51 | } |
||
52 | |||
53 | public string user_id |
||
54 | { |
||
55 | get; |
||
56 | set; |
||
57 | } |
||
58 | |||
59 | public int page_no |
||
60 | { |
||
61 | get; |
||
62 | set; |
||
63 | } |
||
64 | #endregion |
||
65 | |||
66 | public void MarkupConsolidate() |
||
67 | { |
||
68 | |||
69 | } |
||
70 | |||
71 | de6499db | humkyung | /// <summary> |
72 | /// save comments related to given markup information |
||
73 | /// </summary> |
||
74 | /// <param name="UserState"></param> |
||
75 | /// <param name="iPageNo"></param> |
||
76 | b42dd24d | taeseongkim | public async Task<bool> Execute(ICollection<MarkupInfoItem> UserStates) |
77 | 787a4489 | KangIngu | { |
78 | b42dd24d | taeseongkim | bool result = false; |
79 | |||
80 | 6c781c0c | djkim | try |
81 | 787a4489 | KangIngu | { |
82 | eeb0a39c | taeseongkim | var mainmenu = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu; |
83 | var client = mainmenu.BaseTaskClient; |
||
84 | |||
85 | de6499db | humkyung | foreach (var UserState in UserStates) |
86 | 787a4489 | KangIngu | { |
87 | de6499db | humkyung | List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>(); |
88 | 129ca191 | humkyung | ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value => |
89 | de6499db | humkyung | { |
90 | c00d0547 | humkyung | markupdata.Add(new MARKUP_DATA() |
91 | { |
||
92 | ID = value.ID, |
||
93 | PAGENUMBER = value.PageNumber, |
||
94 | DATA = value.Data, |
||
95 | MARKUPINFO_VERSION_ID = UserState.MarkupVersionID, |
||
96 | DATA_TYPE = value.Data_Type |
||
97 | }); |
||
98 | de6499db | humkyung | }); |
99 | 6b6e937c | taeseongkim | |
100 | |||
101 | |||
102 | eeb0a39c | taeseongkim | var SaveResult = await client.SaveMarkupDataAsync(UserState, Project_No, document_id, user_id, markupdata); |
103 | 6b6e937c | taeseongkim | |
104 | b42dd24d | taeseongkim | result = SaveResult; |
105 | |||
106 | 664ea2e1 | taeseongkim | //Logger.sendResLog("SaveCommand.Instance.Execute" , $"SaveMarkupData Call Project : {Project_No} DocID :{document_id} User ID {user_id} result {SaveResult}",1); |
107 | 6b6e937c | taeseongkim | |
108 | eeb0a39c | taeseongkim | mainmenu.MarkupitemViewUpdate(UserState.MarkupInfoID); |
109 | de6499db | humkyung | } |
110 | 073f6118 | djkim | //User Information List Rebind |
111 | eeb0a39c | taeseongkim | |
112 | mainmenu.gridViewMarkup.Rebind(); |
||
113 | e05fe8ab | djkim | TempFile.Remove(); //임시파일삭제 |
114 | eeb0a39c | taeseongkim | |
115 | 787a4489 | KangIngu | } |
116 | 6c781c0c | djkim | catch (Exception) |
117 | { |
||
118 | throw; |
||
119 | } |
||
120 | b42dd24d | taeseongkim | |
121 | return result; |
||
122 | 787a4489 | KangIngu | } |
123 | |||
124 | public void SymbolSave(string Name, string Url, string Data) |
||
125 | { |
||
126 | 6c781c0c | djkim | try |
127 | 787a4489 | KangIngu | { |
128 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
129 | { |
||
130 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
131 | 787a4489 | KangIngu | MEMBER_USER_ID = App.ViewInfo.UserID, |
132 | NAME = Name, |
||
133 | IMAGE_URL = Url, |
||
134 | DATA = Data |
||
135 | }; |
||
136 | 0f065e57 | ljiyeon | |
137 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
138 | 6c781c0c | djkim | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
139 | } |
||
140 | catch(Exception) |
||
141 | { |
||
142 | throw; |
||
143 | } |
||
144 | } |
||
145 | 498f0fc9 | ljiyeon | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
146 | { |
||
147 | try |
||
148 | { |
||
149 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
150 | { |
||
151 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
152 | 498f0fc9 | ljiyeon | DEPARTMENT = Department, |
153 | NAME = Name, |
||
154 | IMAGE_URL = Url, |
||
155 | DATA = Data |
||
156 | }; |
||
157 | 787a4489 | KangIngu | |
158 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
159 | 498f0fc9 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
160 | } |
||
161 | catch (Exception) |
||
162 | { |
||
163 | throw; |
||
164 | } |
||
165 | } |
||
166 | 129ca191 | humkyung | |
167 | eeb0a39c | taeseongkim | public async void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage) |
168 | 6c781c0c | djkim | { |
169 | try |
||
170 | { |
||
171 | eeb0a39c | taeseongkim | var result = await Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.SavePageAngleAsync(project_no, _mldocpage); |
172 | b2c6901f | swate0609 | Common.ViewerDataModel.Instance.RotationDocs.Clear(); |
173 | eeb0a39c | taeseongkim | |
174 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1); |
175 | //Logger.sendResLog("SavePageAngle", result.ToString(), 1); |
||
176 | eeb0a39c | taeseongkim | |
177 | 6c781c0c | djkim | } |
178 | catch (Exception) |
||
179 | { |
||
180 | throw; |
||
181 | 787a4489 | KangIngu | } |
182 | } |
||
183 | } |
||
184 | } |