markus / KCOM / Services / BaseServices.cs @ a860bafc
이력 | 보기 | 이력해설 | 다운로드 (67.6 KB)
1 | 787a4489 | KangIngu | using Microsoft.AspNet.SignalR.Client; |
---|---|---|---|
2 | using IKCOM; |
||
3 | using KCOM.Common; |
||
4 | using KCOM.ServiceDeepView; |
||
5 | using KCOMDataModel.DataModel; |
||
6 | using Newtonsoft.Json; |
||
7 | using System; |
||
8 | using System.Collections.Generic; |
||
9 | using System.Collections.ObjectModel; |
||
10 | using System.ComponentModel; |
||
11 | using System.Linq; |
||
12 | using System.Runtime.CompilerServices; |
||
13 | using System.Text; |
||
14 | using System.Windows; |
||
15 | using System.Windows.Controls; |
||
16 | using Telerik.Windows.Controls; |
||
17 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
18 | fddb48f7 | ljiyeon | using Telerik.Windows.Data; |
19 | 90a0bfa9 | djkim | using System.Web; |
20 | 3b938959 | taeseongkim | using System.ServiceModel.Security; |
21 | 787a4489 | KangIngu | |
22 | namespace KCOM.Views |
||
23 | { |
||
24 | public partial class MainMenu : UserControl, INotifyPropertyChanged |
||
25 | 29010418 | ljiyeon | { |
26 | eb5cdefc | djkim | //const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg"; |
27 | 787a4489 | KangIngu | public ServiceDeepViewClient BaseClient; |
28 | 5c64268e | taeseongkim | public KcomService.ServiceDeepViewClient BaseTaskClient |
29 | { |
||
30 | 3b938959 | taeseongkim | get { |
31 | var service = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); |
||
32 | return service; |
||
33 | } |
||
34 | 5c64268e | taeseongkim | } |
35 | |||
36 | 787a4489 | KangIngu | public ViewInfo _ViewInfo; |
37 | public DOCINFO _DocInfo; |
||
38 | public DOCUMENT_ITEM _DocItem; |
||
39 | e1b36bc0 | humkyung | public MEMBER userData { get; set; } |
40 | 787a4489 | KangIngu | |
41 | public event PropertyChangedEventHandler PropertyChanged; |
||
42 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
43 | { |
||
44 | if (PropertyChanged != null) |
||
45 | { |
||
46 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
51 | public Common.DocumentSet CurrentDoc |
||
52 | { |
||
53 | get |
||
54 | { |
||
55 | return _CurrentDoc; |
||
56 | } |
||
57 | set |
||
58 | { |
||
59 | if (value != CurrentDoc) |
||
60 | { |
||
61 | _CurrentDoc = value; |
||
62 | NotifyPropertyChanged(); |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 | public void ServiceOn() |
||
67 | { |
||
68 | 5c64268e | taeseongkim | //BaseTaskClient = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); |
69 | 29010418 | ljiyeon | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
70 | |||
71 | ef9ddca4 | humkyung | #region 이벤트 핸들러 등록 |
72 | 787a4489 | KangIngu | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
73 | 0f065e57 | ljiyeon | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
74 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
75 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
76 | 29010418 | ljiyeon | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
77 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
78 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
79 | 787a4489 | KangIngu | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
80 | 29010418 | ljiyeon | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
81 | 0c575433 | taeseongkim | BaseClient.GetCompareRectsTargetSizeCompleted += BaseClient_GetCompareRectsTargetSizeCompleted; |
82 | 29010418 | ljiyeon | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
83 | BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted; |
||
84 | BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted; |
||
85 | ef9ddca4 | humkyung | |
86 | BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
||
87 | BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
88 | #endregion |
||
89 | 992a98b4 | KangIngu | } |
90 | |||
91 | private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e) |
||
92 | { |
||
93 | 664ea2e1 | taeseongkim | //Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
94 | 0f065e57 | ljiyeon | |
95 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
96 | 992a98b4 | KangIngu | { |
97 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
98 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
99 | } |
||
100 | else |
||
101 | { |
||
102 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
103 | } |
||
104 | } |
||
105 | |||
106 | private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e) |
||
107 | { |
||
108 | 664ea2e1 | taeseongkim | //Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
109 | 0f065e57 | ljiyeon | |
110 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
111 | 992a98b4 | KangIngu | { |
112 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
113 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
114 | } |
||
115 | else |
||
116 | { |
||
117 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
118 | } |
||
119 | 787a4489 | KangIngu | } |
120 | |||
121 | 9294fed6 | humkyung | /// <summary> |
122 | /// Compare 결과를 받아 화면에 표시한다 |
||
123 | /// </summary> |
||
124 | /// <param name="sender"></param> |
||
125 | /// <param name="e"></param> |
||
126 | 0c575433 | taeseongkim | private void BaseClient_GetCompareRectsTargetSizeCompleted(object sender, GetCompareRectsTargetSizeCompletedEventArgs e) |
127 | 787a4489 | KangIngu | { |
128 | if (e.Error != null || e.Result == null) |
||
129 | { |
||
130 | 9294fed6 | humkyung | if (e.Error != null) |
131 | { |
||
132 | DialogMessage_Alert(e.Error.ToString(), "Error"); |
||
133 | } |
||
134 | else |
||
135 | { |
||
136 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
137 | } |
||
138 | 787a4489 | KangIngu | } |
139 | else |
||
140 | { |
||
141 | a860bafc | taeseongkim | CompareDisplay(e.Result); |
142 | 787a4489 | KangIngu | } |
143 | } |
||
144 | |||
145 | a860bafc | taeseongkim | |
146 | 58dd9e89 | humkyung | /// <summary> |
147 | /// FinalPDF를 수행 후 관련 메시지를 표시한다. |
||
148 | /// </summary> |
||
149 | /// <param name="sender"></param> |
||
150 | /// <param name="e"></param> |
||
151 | 787a4489 | KangIngu | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
152 | { |
||
153 | 29010418 | ljiyeon | if (e.Error != null || e.Result.Status == FinalStatus.Error) |
154 | 787a4489 | KangIngu | { |
155 | 58dd9e89 | humkyung | string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", $"최종 파일을 만드는데 문제가 발생하였습니다{System.Environment.NewLine}{e.Result.Exception}"); |
156 | 84c48033 | djkim | DialogMessage_Alert(errormsg, "안내"); |
157 | 787a4489 | KangIngu | } |
158 | else |
||
159 | { |
||
160 | 58dd9e89 | humkyung | string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요"); |
161 | 84c48033 | djkim | DialogMessage_Alert(successmsg, "안내"); |
162 | 787a4489 | KangIngu | } |
163 | } |
||
164 | |||
165 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
166 | { |
||
167 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
168 | 0f065e57 | ljiyeon | |
169 | 787a4489 | KangIngu | if (e.Result != null && e.Error == null) |
170 | { |
||
171 | 90a0bfa9 | djkim | List<VPRevision> list = e.Result; |
172 | foreach (var item in list) |
||
173 | { |
||
174 | 24ac2a04 | taeseongkim | |
175 | if (App.isExternal) |
||
176 | { |
||
177 | f35c95d8 | taeseongkim | var sBaseServiceURL = CommonLib.Common.GetConfigString("ExternalOriginalFileUrl", "URL", "", App.isExternal); |
178 | 24ac2a04 | taeseongkim | |
179 | db545833 | taeseongkim | if (!string.IsNullOrWhiteSpace(item.TO_VENDOR)) |
180 | { |
||
181 | var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR)); |
||
182 | item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}"; |
||
183 | } |
||
184 | |||
185 | if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR)) |
||
186 | { |
||
187 | var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR)); |
||
188 | item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}"; |
||
189 | } |
||
190 | 24ac2a04 | taeseongkim | } |
191 | else |
||
192 | { |
||
193 | 38d69491 | taeseongkim | item.TO_VENDOR = HttpUtility.UrlDecode(item.TO_VENDOR); |
194 | 24ac2a04 | taeseongkim | item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR); |
195 | 38d69491 | taeseongkim | item.EnsembleLink = HttpUtility.UrlDecode(item.EnsembleLink); |
196 | 24ac2a04 | taeseongkim | } |
197 | 90a0bfa9 | djkim | } |
198 | f0c9e80e | 이지연 | //int result; |
199 | //bool iCheck = true; |
||
200 | //foreach (var li in list) |
||
201 | //{ |
||
202 | // iCheck = int.TryParse(li.GroupNo, out result); |
||
203 | // if (!iCheck) |
||
204 | // break; |
||
205 | //} |
||
206 | //if(iCheck) |
||
207 | gridViewHistory.ItemsSource = list.OrderByDescending(x => x.GroupNo); //20240611 LJY string 인거 전달드림 slip no 내림차순으로 그냥 해달라고 요청 |
||
208 | //else |
||
209 | // gridViewHistory.ItemsSource = list.OrderByDescending(x => x.RevNo); |
||
210 | 6c45db59 | taeseongkim | |
211 | 787a4489 | KangIngu | } |
212 | f9fb5500 | ljiyeon | //TempFile.TempLoad(); |
213 | 787a4489 | KangIngu | } |
214 | |||
215 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
216 | { |
||
217 | 664ea2e1 | taeseongkim | //Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
218 | 0f065e57 | ljiyeon | |
219 | d128ceb2 | humkyung | foreach(var info in ViewerDataModel.Instance._markupInfoList) |
220 | { |
||
221 | if(info.UserID == App.ViewInfo.UserID) |
||
222 | { |
||
223 | info.userDelete = true; |
||
224 | cf1cc862 | taeseongkim | info.DisplayColor = "#FFFF0000"; |
225 | d128ceb2 | humkyung | } |
226 | else |
||
227 | { |
||
228 | info.userDelete = false; |
||
229 | } |
||
230 | } |
||
231 | 787a4489 | KangIngu | } |
232 | |||
233 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
234 | { |
||
235 | 0585d5cc | taeseongkim | if (e.Error == null) |
236 | { |
||
237 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
238 | 0585d5cc | taeseongkim | } |
239 | else |
||
240 | { |
||
241 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDeptDataCompleted", "\r Error :" + e.Error, 1); |
242 | 0585d5cc | taeseongkim | } |
243 | 0f065e57 | ljiyeon | |
244 | 787a4489 | KangIngu | if (e.Result != null) |
245 | { |
||
246 | e.Result.Sort(); |
||
247 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
248 | } |
||
249 | } |
||
250 | 0585d5cc | taeseongkim | |
251 | f258d884 | humkyung | /// <summary> |
252 | /// ??? |
||
253 | /// </summary> |
||
254 | 29010418 | ljiyeon | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
255 | 787a4489 | KangIngu | |
256 | 35a96e24 | humkyung | /// <summary> |
257 | d62c0439 | humkyung | /// 문서 정보를 가져온다 |
258 | /// </summary> |
||
259 | /// <param name="sender"></param> |
||
260 | /// <param name="e"></param> |
||
261 | eeb0a39c | taeseongkim | private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
262 | d62c0439 | humkyung | { |
263 | 664ea2e1 | taeseongkim | ////Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
264 | d62c0439 | humkyung | |
265 | if (e.Error != null) |
||
266 | { |
||
267 | 503cb09e | taeseongkim | DialogMessage_Alert("The page cannot be displayed.", "Alert"); |
268 | d62c0439 | humkyung | } |
269 | 5aa6a59a | taeseongkim | else if (e.Result == null) |
270 | d62c0439 | humkyung | { |
271 | cdb2c0a2 | taeseongkim | DialogMessage_Alert("Document information is missing.", "Alert"); |
272 | d62c0439 | humkyung | } |
273 | cdb2c0a2 | taeseongkim | else |
274 | d62c0439 | humkyung | { |
275 | fdfa126d | taeseongkim | string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt64(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID); |
276 | 45ac2822 | taeseongkim | |
277 | /// 화면의 좌측 Thumbnail의 주소 |
||
278 | cdb2c0a2 | taeseongkim | var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png", "jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}"); |
279 | _DocInfo = e.Result; |
||
280 | _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE); |
||
281 | foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER)) |
||
282 | { |
||
283 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
284 | } |
||
285 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
286 | cdb2c0a2 | taeseongkim | CurrentDoc = new Common.DocumentSet |
287 | { |
||
288 | docInfo = _DocInfo, |
||
289 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
290 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
291 | 0585d5cc | taeseongkim | |
292 | cdb2c0a2 | taeseongkim | Document_NO = _DocItem?.DOCUMENT_NO, |
293 | File_Result = _DocItem?.RESULT_FILE, |
||
294 | Group_No = _DocItem?.GROUP_NO, |
||
295 | 26ec6226 | taeseongkim | ProjectNo = _DocItem?.PROJECT_NO, |
296 | cdb2c0a2 | taeseongkim | Revision = _DocItem?.REVISION, |
297 | }; |
||
298 | 0585d5cc | taeseongkim | |
299 | cdb2c0a2 | taeseongkim | var instanceMain = this.ParentOfType<MainWindow>(); |
300 | string firstpage = "1"; |
||
301 | string lastpage = _DocInfo.PAGE_COUNT.ToString(); |
||
302 | instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage; |
||
303 | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage; |
||
304 | a1e2ba68 | taeseongkim | App.MarkusVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
305 | |||
306 | string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem?.DOCUMENT_NO, _DocItem?.REVISION, App.MarkusVersion); |
||
307 | d33ef543 | taeseongkim | |
308 | cdb2c0a2 | taeseongkim | instanceMain.Title = apptitle; |
309 | eeb0a39c | taeseongkim | |
310 | cdb2c0a2 | taeseongkim | #region 페이지 이미지를 로컬에 저장 |
311 | string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName()); |
||
312 | eeb0a39c | taeseongkim | |
313 | cdb2c0a2 | taeseongkim | //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문 |
314 | eeb0a39c | taeseongkim | |
315 | cdb2c0a2 | taeseongkim | #endregion |
316 | eeb0a39c | taeseongkim | |
317 | 6a19b48d | taeseongkim | App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, "png", _DocInfo.PAGE_COUNT, 1); |
318 | 77cdac33 | taeseongkim | |
319 | 2007ecaa | taeseongkim | //App.SamplePageStorage = new PageManager.PageStorage(MainUrl.Replace("png", "jpg"), tempStoragePath, "jpg", _DocInfo.PAGE_COUNT); |
320 | cdb2c0a2 | taeseongkim | await this.pageNavigator.SetPageNaviAsync(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
321 | } |
||
322 | 54a28343 | taeseongkim | } |
323 | d62c0439 | humkyung | |
324 | 3b81b385 | taeseongkim | private void pageNavigator_ThumbInitialized(object sender,EventArgs e) |
325 | 54a28343 | taeseongkim | { |
326 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
327 | d62c0439 | humkyung | |
328 | 54a28343 | taeseongkim | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
329 | d62c0439 | humkyung | //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
330 | |||
331 | 9d5b4bc2 | taeseongkim | /// 기존 임시파일 정리 |
332 | 6af42ff0 | taeseongkim | #region 단어 검색용 파일 다운로드 |
333 | 9d5b4bc2 | taeseongkim | |
334 | 2007ecaa | taeseongkim | DownloadOriginalFile(); |
335 | 6af42ff0 | taeseongkim | |
336 | #endregion |
||
337 | |||
338 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1); |
339 | 6af42ff0 | taeseongkim | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
340 | |||
341 | d62c0439 | humkyung | } |
342 | |||
343 | 54a28343 | taeseongkim | |
344 | d62c0439 | humkyung | /// <summary> |
345 | 35a96e24 | humkyung | /// get markupinfo and markupitem from database |
346 | a36a37c3 | humkyung | /// - 1. called when document is loaded |
347 | /// - 2. called when user do consolidation |
||
348 | 35a96e24 | humkyung | /// </summary> |
349 | /// <param name="sender"></param> |
||
350 | /// <param name="e"></param> |
||
351 | 787a4489 | KangIngu | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
352 | { |
||
353 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
354 | 0f065e57 | ljiyeon | |
355 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
356 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
357 | be72bfd6 | taeseongkim | |
358 | 274cde11 | taeseongkim | try |
359 | 787a4489 | KangIngu | { |
360 | |||
361 | 274cde11 | taeseongkim | if (e.Result != null) |
362 | d128ceb2 | humkyung | { |
363 | 274cde11 | taeseongkim | ViewerDataModel.Instance._markupInfoList.Clear(); |
364 | b2d0f316 | humkyung | if (e.Result.Any()) ViewerDataModel.Instance.MyMarkupList.Clear(); |
365 | be72bfd6 | taeseongkim | |
366 | 274cde11 | taeseongkim | foreach (var info in e.Result) |
367 | d128ceb2 | humkyung | { |
368 | 274cde11 | taeseongkim | if (info.Depatment == null) info.Depatment = "Unknown"; |
369 | be72bfd6 | taeseongkim | |
370 | ecf8a079 | 이지연 | else if (info.UserID == App.ViewInfo.UserID) |
371 | 274cde11 | taeseongkim | { |
372 | ecf8a079 | 이지연 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) //조회모드는 delete 버튼 모두 비활성화 |
373 | { |
||
374 | info.userDelete = false; |
||
375 | } |
||
376 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1).Count() > 0) //Team Consolidation Mode이고 Team Consolidation Layer가 있을 경우 |
||
377 | { |
||
378 | if(App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1 && x.MarkupInfoID == info.MarkupInfoID).Count() > 0) |
||
379 | info.userDelete = true; |
||
380 | } |
||
381 | else if(App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) //Consolidation Mode 일 때는 해당 Comment Layer의 Status가 Avoid or Consolidation인 것만 Delete 버튼 활성화 |
||
382 | { |
||
383 | if(info.AvoidConsolidate == 1 || info.Consolidate == 1) |
||
384 | info.userDelete = true; |
||
385 | } |
||
386 | else |
||
387 | { |
||
388 | info.userDelete = true; |
||
389 | } |
||
390 | 274cde11 | taeseongkim | info.DisplayColor = "#FFFF0000"; |
391 | } |
||
392 | else |
||
393 | { |
||
394 | info.userDelete = false; |
||
395 | } |
||
396 | d128ceb2 | humkyung | |
397 | 274cde11 | taeseongkim | ViewerDataModel.Instance._markupInfoList.Add(info); |
398 | } |
||
399 | 8e5a4a6a | taeseongkim | |
400 | 274cde11 | taeseongkim | var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f => new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName }); |
401 | 8e5a4a6a | taeseongkim | |
402 | a197bf6f | taeseongkim | userInfoList.ToList().ForEach(x => |
403 | { |
||
404 | ViewerDataModel.Instance._markupUserList.Add(x); |
||
405 | |||
406 | if (MarkupToPDF.MarkupContext.GetUserSignItem(x.UserId) == null) |
||
407 | { |
||
408 | string signData = BaseClient.GetSignData(App.ViewInfo.ProjectNO, x.UserId); |
||
409 | string signStrokes = BaseClient.GetSignStrokes(App.ViewInfo.ProjectNO, x.UserId); |
||
410 | |||
411 | if (signData != null && signStrokes != null) |
||
412 | { |
||
413 | MarkupToPDF.MarkupContext.SetUserSignItem(x.UserId, signData, signStrokes); |
||
414 | } |
||
415 | } |
||
416 | }); |
||
417 | 274cde11 | taeseongkim | |
418 | e.Result.ToList().ForEach(d => |
||
419 | 787a4489 | KangIngu | { |
420 | 274cde11 | taeseongkim | if (d.MarkupList != null) |
421 | 787a4489 | KangIngu | { |
422 | 274cde11 | taeseongkim | d.MarkupList.ForEach(p => |
423 | 0585d5cc | taeseongkim | { |
424 | 274cde11 | taeseongkim | if (d.UserID == App.ViewInfo.UserID) |
425 | 0585d5cc | taeseongkim | { |
426 | ecf8a079 | 이지연 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) //조회모드는 delete 버튼 모두 비활성화 |
427 | { |
||
428 | d.userDelete = false; |
||
429 | } |
||
430 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1).Count() > 0)//Team Consolidation Mode이고 Team Consolidation Layer가 있을 경우 |
||
431 | { |
||
432 | e1b36bc0 | humkyung | if (App.ViewInfo.NewCommentPermission && e.Result.Exists(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1 && x.MarkupInfoID == d.MarkupInfoID)) |
433 | ecf8a079 | 이지연 | d.userDelete = true; |
434 | } |
||
435 | else if (App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) //Consolidation Mode 일 때는 해당 Comment Layer의 Status가 Avoid or Consolidation인 것만 Delete 버튼 활성화 |
||
436 | { |
||
437 | if (d.AvoidConsolidate == 1 || d.Consolidate == 1) |
||
438 | d.userDelete = true; |
||
439 | } |
||
440 | else |
||
441 | { |
||
442 | d.userDelete = true; |
||
443 | } |
||
444 | 274cde11 | taeseongkim | d.DisplayColor = "#FFFF0000"; |
445 | MarkupItemEx markup = new MarkupItemEx |
||
446 | { |
||
447 | Data = p.Data, |
||
448 | Data_Type = p.Data_Type, |
||
449 | ID = p.ID, |
||
450 | IsUpdate = false, |
||
451 | MarkupInfoID = d.MarkupInfoID, |
||
452 | PageNumber = p.PageNumber, |
||
453 | Symbol_ID = p.Symbol_ID, |
||
454 | //Group_ID = p.Group_ID |
||
455 | }; |
||
456 | ViewerDataModel.Instance.MyMarkupList.Add(markup); |
||
457 | } |
||
458 | else |
||
459 | 0585d5cc | taeseongkim | { |
460 | 274cde11 | taeseongkim | MarkupItemEx markup = new MarkupItemEx |
461 | { |
||
462 | Data = p.Data, |
||
463 | Data_Type = p.Data_Type, |
||
464 | ID = p.ID, |
||
465 | IsUpdate = false, |
||
466 | MarkupInfoID = d.MarkupInfoID, |
||
467 | PageNumber = p.PageNumber, |
||
468 | Symbol_ID = p.Symbol_ID, |
||
469 | //Group_ID = p.Group_ID |
||
470 | }; |
||
471 | ViewerDataModel.Instance.MarkupList_Pre.Add(markup); |
||
472 | } |
||
473 | }); |
||
474 | } |
||
475 | }); |
||
476 | 787a4489 | KangIngu | |
477 | f258d884 | humkyung | var currentUser = e.Result.Find(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0); |
478 | 274cde11 | taeseongkim | if (currentUser == null) |
479 | 27cf69cd | taeseongkim | { |
480 | 274cde11 | taeseongkim | /// create a new markupinfo to do comments |
481 | if (App.ViewInfo.NewCommentPermission) |
||
482 | 27cf69cd | taeseongkim | { |
483 | 5a223b60 | humkyung | var infoId = Commons.ShortGuid(); |
484 | 274cde11 | taeseongkim | PreviewUserMarkupInfoItem = new MarkupInfoItem |
485 | { |
||
486 | CreateTime = DateTime.Now, |
||
487 | UpdateTime = DateTime.Now, |
||
488 | Depatment = userData.DEPARTMENT, |
||
489 | DisplayColor = "#FFFF0000", |
||
490 | UserID = userData.ID, |
||
491 | UserName = userData.NAME, |
||
492 | PageCount = 1, |
||
493 | Description = "", |
||
494 | MarkupInfoID = infoId, |
||
495 | MarkupList = null, |
||
496 | 5a223b60 | humkyung | MarkupVersionID = Commons.ShortGuid(), |
497 | 274cde11 | taeseongkim | Consolidate = 0, |
498 | PartConsolidate = 0, |
||
499 | userDelete = true, |
||
500 | AvoidConsolidate = 0, |
||
501 | IsPreviewUser = false |
||
502 | }; |
||
503 | |||
504 | App.Custom_ViewInfoId = infoId; |
||
505 | |||
506 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
507 | } |
||
508 | } |
||
509 | else |
||
510 | { |
||
511 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
512 | 27cf69cd | taeseongkim | } |
513 | 787a4489 | KangIngu | |
514 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
515 | 3ffd4b2d | humkyung | |
516 | 274cde11 | taeseongkim | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
517 | //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
||
518 | be72bfd6 | taeseongkim | |
519 | 274cde11 | taeseongkim | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
520 | 53deabaf | taeseongkim | |
521 | 274cde11 | taeseongkim | SetCommentPages(null); |
522 | 992a98b4 | KangIngu | |
523 | 274cde11 | taeseongkim | // GRIDVIEW에서 팀별 GROUPING |
524 | // 효성은 안함 |
||
525 | 1f2348b2 | taeseongkim | #if (Hyosung) |
526 | #else |
||
527 | 274cde11 | taeseongkim | /// create a group descriptor |
528 | gridViewMarkup.GroupDescriptors.Clear(); |
||
529 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
530 | descriptor.Member = "Depatment"; |
||
531 | descriptor.DisplayContent = "DEPT"; |
||
532 | //descriptor.SortDirection = ListSortDirection.Ascending; |
||
533 | gridViewMarkup.GroupDescriptors.Add(descriptor); |
||
534 | 47b95004 | taeseongkim | #endif |
535 | be72bfd6 | taeseongkim | |
536 | 274cde11 | taeseongkim | GridViewMarkup_Sorting(gridViewMarkup, new GridViewSortingEventArgs(gridViewMarkup.Columns[0], SortingState.None, SortingState.None)); |
537 | be72bfd6 | taeseongkim | |
538 | f38ed998 | humkyung | SelectInitialMarkupInfo(); |
539 | 53deabaf | taeseongkim | } |
540 | 787a4489 | KangIngu | } |
541 | 274cde11 | taeseongkim | catch (Exception ex) |
542 | { |
||
543 | App.FileLogger.Fatal(ex); |
||
544 | } |
||
545 | cf1cc862 | taeseongkim | finally |
546 | { |
||
547 | if(!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled) |
||
548 | { |
||
549 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled = true; |
||
550 | } |
||
551 | 6a19b48d | taeseongkim | |
552 | if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled) |
||
553 | { |
||
554 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled = true; |
||
555 | } |
||
556 | cf1cc862 | taeseongkim | } |
557 | 787a4489 | KangIngu | } |
558 | |||
559 | f38ed998 | humkyung | /// <summary> |
560 | /// 프로그램이 로딩되고 난 후 맨처음으로 MarkupInfo를 선택한다. |
||
561 | /// </summary> |
||
562 | private void SelectInitialMarkupInfo() |
||
563 | { |
||
564 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
565 | { |
||
566 | #region Consolidate 항목이 있으면 Consolidate 항목만 추가 |
||
567 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
568 | { |
||
569 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
570 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
571 | } |
||
572 | #endregion |
||
573 | 053f2163 | humkyung | #region Consolidate 항목이 없을 경우에는 사용자 별로 AvoidConsolidate를 제외한 우선 순위가 높은(Team,Comment)항목들을 선택 |
574 | f38ed998 | humkyung | else |
575 | { |
||
576 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
577 | |||
578 | #region Team consolidate 항목 선택 |
||
579 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
580 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
581 | #endregion |
||
582 | |||
583 | #region 추가되지 않은 사용자들을 추가 |
||
584 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
585 | { |
||
586 | Candidates.Add(item); |
||
587 | } |
||
588 | #endregion |
||
589 | |||
590 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
591 | f38ed998 | humkyung | } |
592 | #endregion |
||
593 | } |
||
594 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) /// Eng'r Comment Mode |
||
595 | { |
||
596 | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
||
597 | |||
598 | #region Team consolidate 항목 선택 |
||
599 | 053f2163 | humkyung | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
600 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
601 | f38ed998 | humkyung | #endregion |
602 | |||
603 | #region 추가되지 않은 사용자들을 추가 |
||
604 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
605 | { |
||
606 | Candidates.Add(item); |
||
607 | } |
||
608 | #endregion |
||
609 | |||
610 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
611 | } |
||
612 | 053f2163 | humkyung | else if (App.ViewInfo.CreateFinalPDFPermission) /// Orig Comment Model |
613 | f38ed998 | humkyung | { |
614 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
615 | { |
||
616 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
617 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
618 | } |
||
619 | 053f2163 | humkyung | else if (ViewerDataModel.Instance._markupInfoList.Any(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0)) |
620 | f38ed998 | humkyung | { |
621 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
622 | |||
623 | #region Team consolidate 항목 선택 |
||
624 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
625 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
626 | #endregion |
||
627 | |||
628 | #region 추가되지 않은 사용자들을 추가 |
||
629 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
630 | { |
||
631 | Candidates.Add(item); |
||
632 | } |
||
633 | #endregion |
||
634 | |||
635 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
636 | f38ed998 | humkyung | } |
637 | else |
||
638 | { |
||
639 | 053f2163 | humkyung | var Comments = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 0 && x.AvoidConsolidate == 0).ToList(); |
640 | f38ed998 | humkyung | Comments.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
641 | } |
||
642 | } |
||
643 | |||
644 | if (!gridViewMarkup.SelectedItems.Any()) |
||
645 | { |
||
646 | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
||
647 | |||
648 | if (PreviewUserMarkupInfoItem != null) |
||
649 | { |
||
650 | this.gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
651 | } |
||
652 | else if (SelectedItem != null) |
||
653 | { |
||
654 | this.gridViewMarkup.SelectedItem = SelectedItem; |
||
655 | } |
||
656 | else if (ViewerDataModel.Instance._markupInfoList.Any()) |
||
657 | { |
||
658 | this.gridViewMarkup.SelectedItem = ViewerDataModel.Instance._markupInfoList[0]; |
||
659 | } |
||
660 | } |
||
661 | } |
||
662 | |||
663 | be72bfd6 | taeseongkim | private void GridViewMarkup_Sorting(object sender, GridViewSortingEventArgs e) |
664 | { |
||
665 | IEnumerable<IKCOM.MarkupInfoItem> markuplist = e.DataControl.ItemsSource as IEnumerable<IKCOM.MarkupInfoItem>; |
||
666 | |||
667 | if(markuplist == null) |
||
668 | { |
||
669 | e.Cancel = true; |
||
670 | return; |
||
671 | } |
||
672 | |||
673 | if(e.NewSortingState == SortingState.None) |
||
674 | { |
||
675 | markuplist = markuplist.OrderByDescending(x => SortIndex(x)) |
||
676 | .ThenBy(x => x.Depatment) |
||
677 | .ThenBy(x => x.UserID); |
||
678 | |||
679 | e.DataControl.ItemsSource = markuplist.ToList(); |
||
680 | } |
||
681 | } |
||
682 | |||
683 | |||
684 | // 마크업 리스트 정렬 |
||
685 | private int SortIndex(IKCOM.MarkupInfoItem markupInfoItem) |
||
686 | { |
||
687 | int result = 0; |
||
688 | |||
689 | // Consolidate은 최상단 |
||
690 | if (markupInfoItem.Consolidate == 1) |
||
691 | { |
||
692 | result += 2; |
||
693 | } |
||
694 | |||
695 | /// Consolidate 다음으로 우선순위 |
||
696 | if (markupInfoItem.UserID == App.ViewInfo.UserID) |
||
697 | { |
||
698 | result += 1; |
||
699 | } |
||
700 | |||
701 | return result; |
||
702 | } |
||
703 | |||
704 | |||
705 | private void GridViewMarkup_Sorted(object sender, GridViewSortedEventArgs e) |
||
706 | { |
||
707 | |||
708 | } |
||
709 | |||
710 | ac4f1e13 | taeseongkim | private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
711 | 787a4489 | KangIngu | { |
712 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
713 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
714 | //{ |
||
715 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
716 | //} |
||
717 | |||
718 | 752b18ef | taeseongkim | if (ViewerDataModel.Instance.SyncPageNumber == 0) |
719 | 787a4489 | KangIngu | { |
720 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
721 | 787a4489 | KangIngu | } |
722 | b2d0f316 | humkyung | if (e.AddedItems.Any()) |
723 | 787a4489 | KangIngu | { |
724 | foreach (var item in gridSelectionItem) |
||
725 | { |
||
726 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
727 | //{ |
||
728 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
729 | //}); |
||
730 | ac4f1e13 | taeseongkim | |
731 | 752b18ef | taeseongkim | var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList(); |
732 | ac4f1e13 | taeseongkim | |
733 | foreach (var markupitem in pageItems) |
||
734 | 787a4489 | KangIngu | { |
735 | 58dd9e89 | humkyung | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID, |
736 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
737 | ac4f1e13 | taeseongkim | } |
738 | 787a4489 | KangIngu | } |
739 | } |
||
740 | b2d0f316 | humkyung | else if (e.RemovedItems.Any()) |
741 | 787a4489 | KangIngu | { |
742 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
743 | |||
744 | (from A in _infoItem |
||
745 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
746 | where A.MarkupInfoID == B.MarkupInfoID |
||
747 | select B).ToList().ForEach(data => |
||
748 | { |
||
749 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
750 | }); |
||
751 | } |
||
752 | } |
||
753 | e7dd7ae8 | humkyung | |
754 | /// <summary> |
||
755 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
756 | /// </summary> |
||
757 | /// <param name="sender"></param> |
||
758 | /// <param name="e"></param> |
||
759 | ac4f1e13 | taeseongkim | private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
760 | 787a4489 | KangIngu | { |
761 | 3abe8d4e | taeseongkim | |
762 | foreach (var item in e.AddedItems) |
||
763 | { |
||
764 | var cellToSelect = new GridViewCellInfo(item, this.gridViewMarkup.Columns["color"], this.gridViewMarkup); |
||
765 | |||
766 | if(cellToSelect != null) |
||
767 | { |
||
768 | |||
769 | } |
||
770 | } |
||
771 | |||
772 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
773 | |||
774 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
775 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
776 | var resultA = (from item_Select in dataSet |
||
777 | from item_Non in dataSet_User |
||
778 | where item_Select == item_Non |
||
779 | select item_Non).ToList(); |
||
780 | |||
781 | if (resultA.Count() >= 2) |
||
782 | { |
||
783 | eeb0a39c | taeseongkim | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
784 | 787a4489 | KangIngu | RadWindow.Confirm(new DialogParameters |
785 | { |
||
786 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
787 | eeb0a39c | taeseongkim | Header = "Info", |
788 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
789 | 787a4489 | KangIngu | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
790 | { |
||
791 | 90d1dee0 | swate0609 | if(ea.DialogResult == null) |
792 | { |
||
793 | return; |
||
794 | } |
||
795 | 787a4489 | KangIngu | if (e.AddedItems.Count() == 1) |
796 | { |
||
797 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
798 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
799 | 787a4489 | KangIngu | |
800 | 8ab0d0b1 | 송근호 | |
801 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
802 | { |
||
803 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
804 | { |
||
805 | gridViewMarkup.SelectedItem = instanceItem; |
||
806 | } |
||
807 | else |
||
808 | { |
||
809 | //1. Consolidations이 있다면 하나 선택 |
||
810 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
811 | |||
812 | if (Consolidations.Count() > 0) |
||
813 | { |
||
814 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
815 | } |
||
816 | } |
||
817 | |||
818 | 787a4489 | KangIngu | } |
819 | 8ab0d0b1 | 송근호 | else { |
820 | //1. Consolidations 아닌게 있다면 Change |
||
821 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
822 | |||
823 | if(notConsolidations.Count() > 0) { |
||
824 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
825 | } |
||
826 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
827 | gridViewMarkup.SelectedItem = instanceItem; |
||
828 | } |
||
829 | |||
830 | 787a4489 | KangIngu | } |
831 | } |
||
832 | }), |
||
833 | Theme = new Windows8Theme(), |
||
834 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
835 | }); |
||
836 | } |
||
837 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
838 | { |
||
839 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
840 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
841 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
842 | 47b95004 | taeseongkim | #region 코멘트 보기 |
843 | d18ea2bd | taeseongkim | if (e.AddedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
844 | 6b5d33c6 | djkim | { |
845 | foreach (var item in gridSelectionItem) |
||
846 | { |
||
847 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
848 | 6b5d33c6 | djkim | { |
849 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
850 | if (controls.Count == 0) |
||
851 | 6b5d33c6 | djkim | { |
852 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
853 | ac4f1e13 | taeseongkim | |
854 | 6b5d33c6 | djkim | foreach (var markup in instance) |
855 | { |
||
856 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
857 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents:App.SystemInfo.STAMP_CONTENTS); |
858 | 6b5d33c6 | djkim | } |
859 | } |
||
860 | 101da246 | humkyung | |
861 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
862 | foreach (var control in controls) |
||
863 | 6b5d33c6 | djkim | { |
864 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
865 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
866 | 6b5d33c6 | djkim | } |
867 | } |
||
868 | 3ffd4b2d | humkyung | else |
869 | 6b5d33c6 | djkim | { |
870 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
871 | if (controls.Count == 0) |
||
872 | { |
||
873 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
874 | 101da246 | humkyung | foreach (var markup in instance) |
875 | { |
||
876 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
877 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
878 | 101da246 | humkyung | } |
879 | } |
||
880 | |||
881 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
882 | foreach (var control in controls) |
||
883 | 6b5d33c6 | djkim | { |
884 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
885 | 6b5d33c6 | djkim | } |
886 | } |
||
887 | } |
||
888 | } |
||
889 | 47b95004 | taeseongkim | #endregion |
890 | #region 코멘트 숨기기 |
||
891 | 6b5d33c6 | djkim | else if (e.RemovedItems.Count > 0) |
892 | { |
||
893 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
894 | |||
895 | (from A in _infoItem |
||
896 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
897 | where A.MarkupInfoID == B.MarkupInfoID |
||
898 | select B).ToList().ForEach(data => |
||
899 | { |
||
900 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
901 | 6b5d33c6 | djkim | }); |
902 | |||
903 | b5ac6d6e | ljiyeon | |
904 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
905 | if (myComment != null) |
||
906 | { |
||
907 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
908 | { |
||
909 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
910 | 6b5d33c6 | djkim | }); |
911 | } |
||
912 | } |
||
913 | 47b95004 | taeseongkim | #endregion |
914 | 787a4489 | KangIngu | } |
915 | } |
||
916 | |||
917 | 3abe8d4e | taeseongkim | private async void gridViewMarkup_SelectedCellsChanged(object sender, Telerik.Windows.Controls.GridView.GridViewSelectedCellsChangedEventArgs e) |
918 | { |
||
919 | if (e.AddedCells.Count() > 0) |
||
920 | { |
||
921 | if(e.AddedCells[0].Column.Name == "color") |
||
922 | { |
||
923 | |||
924 | } |
||
925 | else |
||
926 | { |
||
927 | List<MarkupInfoItem> removeItems = new List<MarkupInfoItem>(); |
||
928 | |||
929 | if (!gridViewMarkup.SelectedItems.Contains(e.AddedCells[0].Item)) |
||
930 | { |
||
931 | gridViewMarkup.SelectedItems.Add(e.AddedCells[0].Item); |
||
932 | } |
||
933 | else |
||
934 | { |
||
935 | gridViewMarkup.Unselect(new[] { e.AddedCells[0].Item }); |
||
936 | |||
937 | removeItems.Add(e.AddedCells[0].Item as MarkupInfoItem); |
||
938 | } |
||
939 | |||
940 | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
||
941 | |||
942 | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
943 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
944 | var resultA = (from item_Select in dataSet |
||
945 | from item_Non in dataSet_User |
||
946 | where item_Select == item_Non |
||
947 | select item_Non).ToList(); |
||
948 | |||
949 | if (resultA.Count() >= 2) |
||
950 | { |
||
951 | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
||
952 | RadWindow.Confirm(new DialogParameters |
||
953 | { |
||
954 | Owner = Application.Current.MainWindow, |
||
955 | Header = "Info", |
||
956 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
957 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
958 | { |
||
959 | 90d1dee0 | swate0609 | if (ea.DialogResult == null) |
960 | { |
||
961 | return; |
||
962 | } |
||
963 | 3abe8d4e | taeseongkim | if (gridViewMarkup.SelectedItems.Count() == 1) |
964 | { |
||
965 | MarkupInfoItem instanceItem = gridViewMarkup.SelectedItems.FirstOrDefault() as MarkupInfoItem; |
||
966 | gridViewMarkup.SelectedItem = null; |
||
967 | |||
968 | |||
969 | if (ea.DialogResult.Value) |
||
970 | { |
||
971 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
||
972 | { |
||
973 | gridViewMarkup.SelectedItem = instanceItem; |
||
974 | } |
||
975 | else |
||
976 | { |
||
977 | //1. Consolidations이 있다면 하나 선택 |
||
978 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
979 | |||
980 | if (Consolidations.Count() > 0) |
||
981 | { |
||
982 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
983 | } |
||
984 | } |
||
985 | |||
986 | } |
||
987 | else |
||
988 | { |
||
989 | //1. Consolidations 아닌게 있다면 Change |
||
990 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
991 | |||
992 | if (notConsolidations.Count() > 0) |
||
993 | { |
||
994 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
995 | } |
||
996 | else |
||
997 | {//1. Consolidations 아닌게 없다면 그대로 |
||
998 | gridViewMarkup.SelectedItem = instanceItem; |
||
999 | } |
||
1000 | |||
1001 | } |
||
1002 | } |
||
1003 | }), |
||
1004 | Theme = new Windows8Theme(), |
||
1005 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
1006 | }); |
||
1007 | } |
||
1008 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
1009 | { |
||
1010 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1011 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1012 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1013 | #region 코멘트 보기 |
||
1014 | if (gridViewMarkup.SelectedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
||
1015 | { |
||
1016 | foreach (var item in gridSelectionItem) |
||
1017 | { |
||
1018 | if (item.UserID == App.ViewInfo.UserID) |
||
1019 | { |
||
1020 | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1021 | if (controls.Count == 0) |
||
1022 | { |
||
1023 | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1024 | |||
1025 | foreach (var markup in instance) |
||
1026 | { |
||
1027 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1028 | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1029 | } |
||
1030 | } |
||
1031 | |||
1032 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1033 | foreach (var control in controls) |
||
1034 | { |
||
1035 | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
||
1036 | control.Visibility = Visibility.Visible; |
||
1037 | } |
||
1038 | } |
||
1039 | else |
||
1040 | { |
||
1041 | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1042 | if (controls.Count == 0) |
||
1043 | { |
||
1044 | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1045 | foreach (var markup in instance) |
||
1046 | { |
||
1047 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1048 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1049 | 3abe8d4e | taeseongkim | } |
1050 | } |
||
1051 | |||
1052 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1053 | foreach (var control in controls) |
||
1054 | { |
||
1055 | control.Visibility = Visibility.Visible; |
||
1056 | } |
||
1057 | } |
||
1058 | } |
||
1059 | } |
||
1060 | #endregion |
||
1061 | #region 코멘트 숨기기 |
||
1062 | else if (removeItems.Count > 0) |
||
1063 | { |
||
1064 | (from A in removeItems |
||
1065 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1066 | where A.MarkupInfoID == B.MarkupInfoID |
||
1067 | select B).ToList().ForEach(data => |
||
1068 | { |
||
1069 | data.Visibility = Visibility.Hidden; |
||
1070 | }); |
||
1071 | |||
1072 | |||
1073 | var myComment = removeItems.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
||
1074 | if (myComment != null) |
||
1075 | { |
||
1076 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
1077 | { |
||
1078 | markupitem.Visibility = Visibility.Hidden; |
||
1079 | }); |
||
1080 | } |
||
1081 | } |
||
1082 | #endregion |
||
1083 | } |
||
1084 | } |
||
1085 | } |
||
1086 | } |
||
1087 | |||
1088 | 787a4489 | KangIngu | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
1089 | { |
||
1090 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.DOCUMENT_ID + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1091 | 0f065e57 | ljiyeon | |
1092 | 787a4489 | KangIngu | if (e.Result != null) |
1093 | { |
||
1094 | _DocItem = e.Result; |
||
1095 | |||
1096 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
1097 | { |
||
1098 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
1099 | } |
||
1100 | 664ea2e1 | taeseongkim | ////Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1101 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1102 | } |
||
1103 | else |
||
1104 | { |
||
1105 | 0585d5cc | taeseongkim | DialogMessage_Alert("Document Information Not Found.", "Error"); |
1106 | |||
1107 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
1108 | { |
||
1109 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
1110 | 0f065e57 | ljiyeon | |
1111 | 787a4489 | KangIngu | if (ea.Error == null) |
1112 | { |
||
1113 | if (ea.Result) |
||
1114 | { |
||
1115 | this._ViewInfo.isAdmin = true; |
||
1116 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1117 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1118 | } |
||
1119 | else |
||
1120 | { |
||
1121 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
1122 | 503cb09e | taeseongkim | DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info"); |
1123 | 787a4489 | KangIngu | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
1124 | } |
||
1125 | |||
1126 | } |
||
1127 | else |
||
1128 | { |
||
1129 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
1130 | } |
||
1131 | }; |
||
1132 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
1133 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
1134 | } |
||
1135 | } |
||
1136 | |||
1137 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
1138 | { |
||
1139 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1140 | 0f065e57 | ljiyeon | |
1141 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
1142 | { |
||
1143 | App.SystemInfo = e.Result; |
||
1144 | |||
1145 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
1146 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
1147 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1148 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1149 | |||
1150 | //if (App.urlHost.Contains("localhost")) |
||
1151 | //{ |
||
1152 | // App.urlHost = App.urlHost_DB; |
||
1153 | //} |
||
1154 | } |
||
1155 | } |
||
1156 | |||
1157 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
1158 | { |
||
1159 | f38ed998 | humkyung | if (e.Error == null && e.Result) |
1160 | 787a4489 | KangIngu | { |
1161 | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
||
1162 | |||
1163 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
1164 | 787a4489 | KangIngu | { |
1165 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
1166 | if (userData != null) |
||
1167 | 787a4489 | KangIngu | { |
1168 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
1169 | 787a4489 | KangIngu | } |
1170 | 6c781c0c | djkim | else |
1171 | { |
||
1172 | userData = new MEMBER(); |
||
1173 | userData.DEPARTMENT = "ALL"; |
||
1174 | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
||
1175 | 29010418 | ljiyeon | } |
1176 | 787a4489 | KangIngu | } |
1177 | } |
||
1178 | else |
||
1179 | { |
||
1180 | f38ed998 | humkyung | string failedmsg = CommonLib.Common.GetAlertMessageString("GetConversionStateFailed", "MSG", "Too Many V/P Files are uploading instantaneously, This V/P file can not be open now. Please feel free to re-open wait a moment again!\n\n현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다.\n잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
1181 | 84c48033 | djkim | DialogMessage_Alert(failedmsg, "Warning"); |
1182 | 787a4489 | KangIngu | } |
1183 | } |
||
1184 | 29010418 | ljiyeon | |
1185 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
1186 | 5a6493ad | humkyung | { |
1187 | 787a4489 | KangIngu | this._ViewInfo = info; |
1188 | 5a6493ad | humkyung | try |
1189 | 5ded1e5a | djkim | { |
1190 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
1191 | /// 다른 Site를 대비하여 에러 처리함 |
||
1192 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
1193 | if (!string.IsNullOrEmpty(docid)) |
||
1194 | { |
||
1195 | this._ViewInfo.DocumentItemID = docid; |
||
1196 | } |
||
1197 | 5ded1e5a | djkim | } |
1198 | a8aec13a | taeseongkim | catch (Exception ex) |
1199 | 5a6493ad | humkyung | { |
1200 | 664ea2e1 | taeseongkim | |
1201 | //App.FileLogger.Fatal(ex); |
||
1202 | 5a6493ad | humkyung | } |
1203 | |||
1204 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetSystemDataAsync", "", 1); |
1205 | |||
1206 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
1207 | 787a4489 | KangIngu | } |
1208 | |||
1209 | 992a98b4 | KangIngu | public void HubSet() |
1210 | { |
||
1211 | // 허브 연결 구성 |
||
1212 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
1213 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
1214 | |||
1215 | |||
1216 | // 허브 연결 |
||
1217 | hubConnection.Start().ContinueWith(task => |
||
1218 | { |
||
1219 | if (task.IsFaulted) |
||
1220 | { |
||
1221 | Console.WriteLine("There was an error opening the connection:{0}", |
||
1222 | task.Exception.GetBaseException()); |
||
1223 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1224 | 992a98b4 | KangIngu | } |
1225 | else |
||
1226 | { |
||
1227 | Console.WriteLine("Connected :: " + task.Id); |
||
1228 | } |
||
1229 | |||
1230 | }).Wait(); |
||
1231 | |||
1232 | |||
1233 | // [ 프로그램 시작 ] |
||
1234 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
1235 | //( "method name", arg1, arg2 ) |
||
1236 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
1237 | //{ |
||
1238 | // if (task.IsFaulted) |
||
1239 | // { |
||
1240 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1241 | // } |
||
1242 | // else |
||
1243 | // { |
||
1244 | // Console.WriteLine(task.Result); |
||
1245 | // } |
||
1246 | //}); |
||
1247 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
1248 | 992a98b4 | KangIngu | { |
1249 | if (task.IsFaulted) |
||
1250 | { |
||
1251 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1252 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1253 | 992a98b4 | KangIngu | } |
1254 | else |
||
1255 | { |
||
1256 | 29010418 | ljiyeon | switch (task.Result) |
1257 | 992a98b4 | KangIngu | { |
1258 | 53393bae | KangIngu | case "2": |
1259 | { |
||
1260 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
1261 | if (result == MessageBoxResult.OK) |
||
1262 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1263 | 53393bae | KangIngu | } |
1264 | break; |
||
1265 | case "404": |
||
1266 | { |
||
1267 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
1268 | if(result == MessageBoxResult.OK) |
||
1269 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1270 | 53393bae | KangIngu | } |
1271 | break; |
||
1272 | 992a98b4 | KangIngu | } |
1273 | } |
||
1274 | 53f96e00 | 송근호 | }); |
1275 | 992a98b4 | KangIngu | |
1276 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
1277 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
1278 | //{ |
||
1279 | |||
1280 | // if (status) |
||
1281 | // { |
||
1282 | // // 프로그램 시작 |
||
1283 | // Console.WriteLine("connection status : " + status); |
||
1284 | // } |
||
1285 | // else |
||
1286 | // { |
||
1287 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
1288 | // hubConnection.Stop(); |
||
1289 | // } |
||
1290 | //}); |
||
1291 | |||
1292 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
1293 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
1294 | Console.WriteLine("Noficiation Message : " + msg) |
||
1295 | ); |
||
1296 | |||
1297 | |||
1298 | // 서버 메서드 호출 |
||
1299 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
1300 | |||
1301 | //Console.ReadKey(); |
||
1302 | |||
1303 | //hubConnection.Stop(); |
||
1304 | } |
||
1305 | 787a4489 | KangIngu | |
1306 | ac4f1e13 | taeseongkim | public async void MarkupUserListDisplay() |
1307 | 1f1c566e | djkim | { |
1308 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1309 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1310 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1311 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
1312 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
1313 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
1314 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
1315 | //{ |
||
1316 | // if (item.UserID == App.ViewInfo.UserID) |
||
1317 | // { |
||
1318 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
1319 | f714bef8 | djkim | // { |
1320 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
1321 | // }); |
||
1322 | // } |
||
1323 | // else |
||
1324 | // { |
||
1325 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
1326 | // { |
||
1327 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
1328 | // }); |
||
1329 | // } |
||
1330 | //} |
||
1331 | 29010418 | ljiyeon | (from A in gridSelectionItem |
1332 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
1333 | where A.MarkupInfoID == B.MarkupInfoID |
||
1334 | select B).ToList().ForEach(data => |
||
1335 | { |
||
1336 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
1337 | }); |
||
1338 | 1f1c566e | djkim | (from A in gridSelectionItem |
1339 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1340 | where A.MarkupInfoID == B.MarkupInfoID |
||
1341 | select B).ToList().ForEach(data => |
||
1342 | { |
||
1343 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
1344 | }); |
||
1345 | |||
1346 | foreach (var item in gridSelectionItem) |
||
1347 | { |
||
1348 | ac4f1e13 | taeseongkim | |
1349 | 1f1c566e | djkim | if (item.UserID == App.ViewInfo.UserID) |
1350 | { |
||
1351 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1352 | |||
1353 | foreach (var markupitem in markupItems) |
||
1354 | 1f1c566e | djkim | { |
1355 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
1356 | 58dd9e89 | humkyung | item.MarkupInfoID, markupitem.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1357 | ac4f1e13 | taeseongkim | } |
1358 | 1f1c566e | djkim | } |
1359 | else |
||
1360 | { |
||
1361 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1362 | |||
1363 | foreach (var markupitem in markupItems) |
||
1364 | 1f1c566e | djkim | { |
1365 | 58dd9e89 | humkyung | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID, |
1366 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1367 | ac4f1e13 | taeseongkim | } |
1368 | 1f1c566e | djkim | } |
1369 | } |
||
1370 | } |
||
1371 | 787a4489 | KangIngu | } |
1372 | } |