markus / KCOM / Services / BaseServices.cs @ 0585d5cc
이력 | 보기 | 이력해설 | 다운로드 (44.9 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 RestSharp; |
||
8 | using System; |
||
9 | using System.Collections.Generic; |
||
10 | using System.Collections.ObjectModel; |
||
11 | using System.ComponentModel; |
||
12 | using System.Linq; |
||
13 | using System.Runtime.CompilerServices; |
||
14 | using System.Text; |
||
15 | using System.Windows; |
||
16 | using System.Windows.Controls; |
||
17 | using Telerik.Windows.Controls; |
||
18 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
19 | fddb48f7 | ljiyeon | using Telerik.Windows.Data; |
20 | 90a0bfa9 | djkim | using System.Web; |
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 | 6b6e937c | taeseongkim | public KcomService.ServiceDeepViewClient BaseTaskClient; |
29 | 787a4489 | KangIngu | public ViewInfo _ViewInfo; |
30 | public DOCINFO _DocInfo; |
||
31 | public DOCUMENT_ITEM _DocItem; |
||
32 | public MEMBER userData; |
||
33 | |||
34 | public event PropertyChangedEventHandler PropertyChanged; |
||
35 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
36 | { |
||
37 | if (PropertyChanged != null) |
||
38 | { |
||
39 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
44 | public Common.DocumentSet CurrentDoc |
||
45 | { |
||
46 | get |
||
47 | { |
||
48 | return _CurrentDoc; |
||
49 | } |
||
50 | set |
||
51 | { |
||
52 | if (value != CurrentDoc) |
||
53 | { |
||
54 | _CurrentDoc = value; |
||
55 | NotifyPropertyChanged(); |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | public void ServiceOn() |
||
60 | { |
||
61 | 6b6e937c | taeseongkim | BaseTaskClient = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); |
62 | 29010418 | ljiyeon | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
63 | |||
64 | 787a4489 | KangIngu | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
65 | 0f065e57 | ljiyeon | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
66 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
67 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
68 | 29010418 | ljiyeon | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
69 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
70 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
71 | 787a4489 | KangIngu | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
72 | 29010418 | ljiyeon | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
73 | BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted; |
||
74 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
75 | BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted; |
||
76 | BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted; |
||
77 | 992a98b4 | KangIngu | } |
78 | |||
79 | 29010418 | ljiyeon | |
80 | 992a98b4 | KangIngu | |
81 | private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e) |
||
82 | { |
||
83 | 0f065e57 | ljiyeon | Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
84 | |||
85 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
86 | 992a98b4 | KangIngu | { |
87 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
88 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
89 | } |
||
90 | else |
||
91 | { |
||
92 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
93 | } |
||
94 | } |
||
95 | |||
96 | private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e) |
||
97 | { |
||
98 | 0f065e57 | ljiyeon | Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
99 | |||
100 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
101 | 992a98b4 | KangIngu | { |
102 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
103 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
104 | } |
||
105 | else |
||
106 | { |
||
107 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
108 | } |
||
109 | 787a4489 | KangIngu | } |
110 | |||
111 | 9294fed6 | humkyung | /// <summary> |
112 | /// Compare 결과를 받아 화면에 표시한다 |
||
113 | /// </summary> |
||
114 | /// <param name="sender"></param> |
||
115 | /// <param name="e"></param> |
||
116 | 787a4489 | KangIngu | private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e) |
117 | { |
||
118 | if (e.Error != null || e.Result == null) |
||
119 | { |
||
120 | 9294fed6 | humkyung | if (e.Error != null) |
121 | { |
||
122 | DialogMessage_Alert(e.Error.ToString(), "Error"); |
||
123 | } |
||
124 | else |
||
125 | { |
||
126 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
127 | } |
||
128 | 787a4489 | KangIngu | } |
129 | else |
||
130 | { |
||
131 | e.Result.ForEach(d => |
||
132 | { |
||
133 | d.Width = d.Width * 3; |
||
134 | d.Height = d.Height * 3; |
||
135 | var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d); |
||
136 | a1142a6b | taeseongkim | System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle(); |
137 | myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100,255,8,0)); |
||
138 | myEllipse.Opacity = 0.8; |
||
139 | 787a4489 | KangIngu | myEllipse.Width = d.Width; |
140 | myEllipse.Height = d.Height; |
||
141 | Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0)); |
||
142 | Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0)); |
||
143 | myEllipse.RenderTransformOrigin = point; |
||
144 | canvas_compareBorder.Children.Add(myEllipse); |
||
145 | }); |
||
146 | |||
147 | da.From = 0.8; |
||
148 | a1142a6b | taeseongkim | da.To = 0.1; |
149 | 787a4489 | KangIngu | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
150 | da.AutoReverse = true; |
||
151 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
152 | } |
||
153 | } |
||
154 | |||
155 | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
||
156 | { |
||
157 | 0f065e57 | ljiyeon | Logger.sendResLog("SetFinalPDFCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
158 | 84c48033 | djkim | string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", "최종 파일을 만드는데 문제가 발생하였습니다"); |
159 | string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요"); |
||
160 | 29010418 | ljiyeon | if (e.Error != null || e.Result.Status == FinalStatus.Error) |
161 | 787a4489 | KangIngu | { |
162 | 84c48033 | djkim | DialogMessage_Alert(errormsg, "안내"); |
163 | 787a4489 | KangIngu | } |
164 | else |
||
165 | { |
||
166 | 84c48033 | djkim | DialogMessage_Alert(successmsg, "안내"); |
167 | 787a4489 | KangIngu | } |
168 | } |
||
169 | |||
170 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
171 | { |
||
172 | 0f065e57 | ljiyeon | Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
173 | |||
174 | 787a4489 | KangIngu | if (e.Result != null && e.Error == null) |
175 | { |
||
176 | 90a0bfa9 | djkim | List<VPRevision> list = e.Result; |
177 | foreach (var item in list) |
||
178 | { |
||
179 | 24ac2a04 | taeseongkim | |
180 | if (App.isExternal) |
||
181 | { |
||
182 | f35c95d8 | taeseongkim | var sBaseServiceURL = CommonLib.Common.GetConfigString("ExternalOriginalFileUrl", "URL", "", App.isExternal); |
183 | 24ac2a04 | taeseongkim | |
184 | db545833 | taeseongkim | if (!string.IsNullOrWhiteSpace(item.TO_VENDOR)) |
185 | { |
||
186 | var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR)); |
||
187 | item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}"; |
||
188 | } |
||
189 | |||
190 | if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR)) |
||
191 | { |
||
192 | var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR)); |
||
193 | item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}"; |
||
194 | } |
||
195 | 24ac2a04 | taeseongkim | } |
196 | else |
||
197 | { |
||
198 | |||
199 | item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR); |
||
200 | } |
||
201 | 90a0bfa9 | djkim | } |
202 | gridViewHistory.ItemsSource = list; |
||
203 | 787a4489 | KangIngu | } |
204 | f9fb5500 | ljiyeon | //TempFile.TempLoad(); |
205 | 787a4489 | KangIngu | } |
206 | |||
207 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
208 | { |
||
209 | 0f065e57 | ljiyeon | Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
210 | |||
211 | d128ceb2 | humkyung | foreach(var info in ViewerDataModel.Instance._markupInfoList) |
212 | { |
||
213 | if(info.UserID == App.ViewInfo.UserID) |
||
214 | { |
||
215 | info.userDelete = true; |
||
216 | info.DisplayColor = "FFFF0000"; |
||
217 | } |
||
218 | else |
||
219 | { |
||
220 | info.userDelete = false; |
||
221 | } |
||
222 | } |
||
223 | 787a4489 | KangIngu | } |
224 | |||
225 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
226 | { |
||
227 | 0585d5cc | taeseongkim | if (e.Error == null) |
228 | { |
||
229 | Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
230 | } |
||
231 | else |
||
232 | { |
||
233 | Logger.sendResLog("GetDeptDataCompleted", "\r Error :" + e.Error, 1); |
||
234 | } |
||
235 | 0f065e57 | ljiyeon | |
236 | 787a4489 | KangIngu | if (e.Result != null) |
237 | { |
||
238 | e.Result.Sort(); |
||
239 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
240 | } |
||
241 | } |
||
242 | 0585d5cc | taeseongkim | |
243 | 29010418 | ljiyeon | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
244 | 787a4489 | KangIngu | |
245 | 35a96e24 | humkyung | /// <summary> |
246 | d62c0439 | humkyung | /// 문서 정보를 가져온다 |
247 | /// </summary> |
||
248 | /// <param name="sender"></param> |
||
249 | /// <param name="e"></param> |
||
250 | eeb0a39c | taeseongkim | private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
251 | d62c0439 | humkyung | { |
252 | 72424099 | taeseongkim | //Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
253 | d62c0439 | humkyung | |
254 | if (e.Error != null) |
||
255 | { |
||
256 | 503cb09e | taeseongkim | DialogMessage_Alert("The page cannot be displayed.", "Alert"); |
257 | d62c0439 | humkyung | return; |
258 | } |
||
259 | |||
260 | ff01c725 | humkyung | string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID); |
261 | var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png","jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}"); |
||
262 | d62c0439 | humkyung | _DocInfo = e.Result; |
263 | 90a0bfa9 | djkim | _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE); |
264 | d62c0439 | humkyung | foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER)) |
265 | { |
||
266 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
267 | } |
||
268 | Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
269 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
270 | CurrentDoc = new Common.DocumentSet |
||
271 | { |
||
272 | docInfo = _DocInfo, |
||
273 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
274 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
275 | 0585d5cc | taeseongkim | |
276 | Document_NO = _DocItem?.DOCUMENT_NO, |
||
277 | File_Result = _DocItem?.RESULT_FILE, |
||
278 | Group_No = _DocItem?.GROUP_NO, |
||
279 | ProjectNo = _DocItem?.PROJECT_NO, |
||
280 | Revision = _DocItem?.REVISION, |
||
281 | d62c0439 | humkyung | }; |
282 | 0585d5cc | taeseongkim | |
283 | d62c0439 | humkyung | var instanceMain = this.ParentOfType<MainWindow>(); |
284 | 944be2fa | djkim | string firstpage = "1"; |
285 | string lastpage = _DocInfo.PAGE_COUNT.ToString(); |
||
286 | instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage; |
||
287 | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage; |
||
288 | 0585d5cc | taeseongkim | string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem?.DOCUMENT_NO, _DocItem?.REVISION, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); |
289 | d62c0439 | humkyung | instanceMain.TitleText.Text = apptitle; |
290 | instanceMain.Title = apptitle; |
||
291 | eeb0a39c | taeseongkim | |
292 | #region 페이지 이미지를 로컬에 저장 |
||
293 | string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(),"MARKUS", System.IO.Path.GetRandomFileName()); |
||
294 | |||
295 | //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문 |
||
296 | |||
297 | #endregion |
||
298 | App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, _DocInfo.PAGE_COUNT); |
||
299 | |||
300 | d62c0439 | humkyung | this.pageNavigator.SetPageNavi(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
301 | |||
302 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
303 | |||
304 | //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
||
305 | |||
306 | 6af42ff0 | taeseongkim | #region 단어 검색용 파일 다운로드 |
307 | |||
308 | eeb0a39c | taeseongkim | await DownloadOriginalFileAsync(); |
309 | |||
310 | 6af42ff0 | taeseongkim | |
311 | #endregion |
||
312 | |||
313 | d62c0439 | humkyung | Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1); |
314 | 6af42ff0 | taeseongkim | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
315 | |||
316 | d62c0439 | humkyung | } |
317 | |||
318 | /// <summary> |
||
319 | 35a96e24 | humkyung | /// get markupinfo and markupitem from database |
320 | a36a37c3 | humkyung | /// - 1. called when document is loaded |
321 | /// - 2. called when user do consolidation |
||
322 | 35a96e24 | humkyung | /// </summary> |
323 | /// <param name="sender"></param> |
||
324 | /// <param name="e"></param> |
||
325 | 787a4489 | KangIngu | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
326 | { |
||
327 | 0f065e57 | ljiyeon | Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
328 | |||
329 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
330 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
331 | if (e.Result != null) |
||
332 | { |
||
333 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoList.Clear(); |
334 | 3ffd4b2d | humkyung | if (e.Result.Count > 0) ViewerDataModel.Instance.MyMarkupList.Clear(); |
335 | 787a4489 | KangIngu | |
336 | 0585d5cc | taeseongkim | foreach (var info in e.Result) |
337 | d128ceb2 | humkyung | { |
338 | if (info.UserID == App.ViewInfo.UserID) |
||
339 | { |
||
340 | info.userDelete = true; |
||
341 | info.DisplayColor = "#FFFF0000"; |
||
342 | } |
||
343 | else |
||
344 | { |
||
345 | info.userDelete = false; |
||
346 | } |
||
347 | ViewerDataModel.Instance._markupInfoList.Add(info); |
||
348 | } |
||
349 | |||
350 | 0585d5cc | taeseongkim | var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f => new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName }); |
351 | 8e5a4a6a | taeseongkim | |
352 | userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x)); |
||
353 | |||
354 | 0585d5cc | taeseongkim | e.Result.ToList().ForEach(d => |
355 | 787a4489 | KangIngu | { |
356 | 0585d5cc | taeseongkim | if (d.MarkupList != null) |
357 | 787a4489 | KangIngu | { |
358 | 0585d5cc | taeseongkim | d.MarkupList.ForEach(p => |
359 | 787a4489 | KangIngu | { |
360 | 0585d5cc | taeseongkim | if (d.UserID == App.ViewInfo.UserID) |
361 | { |
||
362 | d.userDelete = true; |
||
363 | d.DisplayColor = "#FFFF0000"; |
||
364 | |||
365 | MarkupItemEx markup = new MarkupItemEx |
||
366 | { |
||
367 | Data = p.Data, |
||
368 | Data_Type = p.Data_Type, |
||
369 | ID = p.ID, |
||
370 | IsUpdate = false, |
||
371 | MarkupInfoID = d.MarkupInfoID, |
||
372 | PageNumber = p.PageNumber, |
||
373 | Symbol_ID = p.Symbol_ID, |
||
374 | //Group_ID = p.Group_ID |
||
375 | }; |
||
376 | ViewerDataModel.Instance.MyMarkupList.Add(markup); |
||
377 | } |
||
378 | else |
||
379 | { |
||
380 | MarkupItemEx markup = new MarkupItemEx |
||
381 | { |
||
382 | Data = p.Data, |
||
383 | Data_Type = p.Data_Type, |
||
384 | ID = p.ID, |
||
385 | IsUpdate = false, |
||
386 | MarkupInfoID = d.MarkupInfoID, |
||
387 | PageNumber = p.PageNumber, |
||
388 | Symbol_ID = p.Symbol_ID, |
||
389 | //Group_ID = p.Group_ID |
||
390 | }; |
||
391 | ViewerDataModel.Instance.MarkupList_Pre.Add(markup); |
||
392 | } |
||
393 | }); |
||
394 | 787a4489 | KangIngu | } |
395 | 0585d5cc | taeseongkim | }); |
396 | 787a4489 | KangIngu | |
397 | a36a37c3 | humkyung | var currentUser = e.Result.Where(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0).FirstOrDefault(); |
398 | a7372e37 | taeseongkim | |
399 | 787a4489 | KangIngu | if (currentUser == null) |
400 | { |
||
401 | a36a37c3 | humkyung | /// create a new markupinfo to do comments |
402 | 24678e06 | humkyung | var infoId = Commons.shortGuid(); |
403 | 787a4489 | KangIngu | PreviewUserMarkupInfoItem = new MarkupInfoItem |
404 | { |
||
405 | CreateTime = DateTime.Now, |
||
406 | 073f6118 | djkim | UpdateTime = DateTime.Now, |
407 | 787a4489 | KangIngu | Depatment = userData.DEPARTMENT, |
408 | DisplayColor = "#FFFF0000", |
||
409 | UserID = userData.ID, |
||
410 | UserName = userData.NAME, |
||
411 | PageCount = 1, |
||
412 | Description = "", |
||
413 | MarkupInfoID = infoId, |
||
414 | MarkupList = null, |
||
415 | 24678e06 | humkyung | MarkupVersionID = Commons.shortGuid(), |
416 | 787a4489 | KangIngu | Consolidate = 0, |
417 | PartConsolidate = 0, |
||
418 | userDelete = true, |
||
419 | AvoidConsolidate = 0, |
||
420 | 8129f2a5 | ljiyeon | IsPreviewUser = false |
421 | 787a4489 | KangIngu | }; |
422 | |||
423 | App.Custom_ViewInfoId = infoId; |
||
424 | 8129f2a5 | ljiyeon | |
425 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
426 | 787a4489 | KangIngu | } |
427 | else |
||
428 | { |
||
429 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
430 | } |
||
431 | |||
432 | a36a37c3 | humkyung | foreach(var info in e.Result) |
433 | d128ceb2 | humkyung | { |
434 | if (info.UserID == App.ViewInfo.UserID) info.DisplayColor = "#FFFF0000"; |
||
435 | } |
||
436 | 787a4489 | KangIngu | |
437 | 3ffd4b2d | humkyung | ViewerDataModel.Instance.PageNumber = 1; |
438 | |||
439 | a36a37c3 | humkyung | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
440 | 35a96e24 | humkyung | var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
441 | 787a4489 | KangIngu | markupItem.ForEach(data => |
442 | { |
||
443 | 35a96e24 | humkyung | if (data.Depatment == null) data.Depatment = "Unknown"; |
444 | 787a4489 | KangIngu | }); |
445 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
446 | 29010418 | ljiyeon | SetCommentPages(); |
447 | 992a98b4 | KangIngu | |
448 | a36a37c3 | humkyung | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
449 | this.gridViewMarkup.SelectedItem = (PreviewUserMarkupInfoItem != null) ? PreviewUserMarkupInfoItem : SelectedItem; |
||
450 | 073f6118 | djkim | |
451 | a36a37c3 | humkyung | /// create a group descriptor |
452 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Clear(); |
453 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
454 | descriptor.Member = "Depatment"; |
||
455 | descriptor.DisplayContent = "DEPT"; |
||
456 | dd0f7089 | djkim | //descriptor.SortDirection = ListSortDirection.Ascending; |
457 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Add(descriptor); |
458 | a36a37c3 | humkyung | /// up to here |
459 | 787a4489 | KangIngu | } |
460 | } |
||
461 | |||
462 | ac4f1e13 | taeseongkim | private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
463 | 787a4489 | KangIngu | { |
464 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
465 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
466 | //{ |
||
467 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
468 | //} |
||
469 | |||
470 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
471 | { |
||
472 | ViewerDataModel.Instance.PageNumber = 1; |
||
473 | } |
||
474 | if (e.AddedItems.Count() > 0) |
||
475 | { |
||
476 | foreach (var item in gridSelectionItem) |
||
477 | { |
||
478 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
479 | //{ |
||
480 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
481 | //}); |
||
482 | ac4f1e13 | taeseongkim | |
483 | var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList(); |
||
484 | |||
485 | foreach (var markupitem in pageItems) |
||
486 | 787a4489 | KangIngu | { |
487 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
488 | } |
||
489 | 787a4489 | KangIngu | } |
490 | } |
||
491 | else if (e.RemovedItems.Count > 0) |
||
492 | { |
||
493 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
494 | |||
495 | (from A in _infoItem |
||
496 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
497 | where A.MarkupInfoID == B.MarkupInfoID |
||
498 | select B).ToList().ForEach(data => |
||
499 | { |
||
500 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
501 | }); |
||
502 | } |
||
503 | } |
||
504 | e7dd7ae8 | humkyung | |
505 | /// <summary> |
||
506 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
507 | /// </summary> |
||
508 | /// <param name="sender"></param> |
||
509 | /// <param name="e"></param> |
||
510 | ac4f1e13 | taeseongkim | private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
511 | 787a4489 | KangIngu | { |
512 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
513 | |||
514 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
515 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
516 | var resultA = (from item_Select in dataSet |
||
517 | from item_Non in dataSet_User |
||
518 | where item_Select == item_Non |
||
519 | select item_Non).ToList(); |
||
520 | |||
521 | if (resultA.Count() >= 2) |
||
522 | { |
||
523 | eeb0a39c | taeseongkim | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
524 | 787a4489 | KangIngu | RadWindow.Confirm(new DialogParameters |
525 | { |
||
526 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
527 | eeb0a39c | taeseongkim | Header = "Info", |
528 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
529 | 787a4489 | KangIngu | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
530 | { |
||
531 | if (e.AddedItems.Count() == 1) |
||
532 | { |
||
533 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
534 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
535 | 787a4489 | KangIngu | |
536 | 8ab0d0b1 | 송근호 | |
537 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
538 | { |
||
539 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
540 | { |
||
541 | gridViewMarkup.SelectedItem = instanceItem; |
||
542 | } |
||
543 | else |
||
544 | { |
||
545 | //1. Consolidations이 있다면 하나 선택 |
||
546 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
547 | |||
548 | if (Consolidations.Count() > 0) |
||
549 | { |
||
550 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
551 | } |
||
552 | } |
||
553 | |||
554 | 787a4489 | KangIngu | } |
555 | 8ab0d0b1 | 송근호 | else { |
556 | //1. Consolidations 아닌게 있다면 Change |
||
557 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
558 | |||
559 | if(notConsolidations.Count() > 0) { |
||
560 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
561 | } |
||
562 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
563 | gridViewMarkup.SelectedItem = instanceItem; |
||
564 | } |
||
565 | |||
566 | 787a4489 | KangIngu | } |
567 | } |
||
568 | }), |
||
569 | Theme = new Windows8Theme(), |
||
570 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
571 | }); |
||
572 | } |
||
573 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
574 | { |
||
575 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
576 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
577 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
578 | #region 코멘트 보기 |
||
579 | if (e.AddedItems.Count() > 0) |
||
580 | { |
||
581 | foreach (var item in gridSelectionItem) |
||
582 | { |
||
583 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
584 | 6b5d33c6 | djkim | { |
585 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
586 | if (controls.Count == 0) |
||
587 | 6b5d33c6 | djkim | { |
588 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
589 | ac4f1e13 | taeseongkim | |
590 | 6b5d33c6 | djkim | foreach (var markup in instance) |
591 | { |
||
592 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
593 | 661b7416 | humkyung | item.MarkupInfoID, markup.ID); |
594 | 6b5d33c6 | djkim | } |
595 | } |
||
596 | 101da246 | humkyung | |
597 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
598 | foreach (var control in controls) |
||
599 | 6b5d33c6 | djkim | { |
600 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
601 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
602 | 6b5d33c6 | djkim | } |
603 | } |
||
604 | 3ffd4b2d | humkyung | else |
605 | 6b5d33c6 | djkim | { |
606 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
607 | if (controls.Count == 0) |
||
608 | { |
||
609 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
610 | 101da246 | humkyung | foreach (var markup in instance) |
611 | { |
||
612 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", |
613 | 101da246 | humkyung | item.MarkupInfoID, markup.ID); |
614 | } |
||
615 | } |
||
616 | |||
617 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
618 | foreach (var control in controls) |
||
619 | 6b5d33c6 | djkim | { |
620 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
621 | 6b5d33c6 | djkim | } |
622 | } |
||
623 | } |
||
624 | } |
||
625 | #endregion |
||
626 | #region 코멘트 숨기기 |
||
627 | else if (e.RemovedItems.Count > 0) |
||
628 | { |
||
629 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
630 | |||
631 | (from A in _infoItem |
||
632 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
633 | where A.MarkupInfoID == B.MarkupInfoID |
||
634 | select B).ToList().ForEach(data => |
||
635 | { |
||
636 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
637 | 6b5d33c6 | djkim | }); |
638 | |||
639 | b5ac6d6e | ljiyeon | |
640 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
641 | if (myComment != null) |
||
642 | { |
||
643 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
644 | { |
||
645 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
646 | 6b5d33c6 | djkim | }); |
647 | } |
||
648 | } |
||
649 | #endregion |
||
650 | 787a4489 | KangIngu | } |
651 | } |
||
652 | |||
653 | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
||
654 | { |
||
655 | 0f065e57 | ljiyeon | Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
656 | |||
657 | 787a4489 | KangIngu | if (e.Result != null) |
658 | { |
||
659 | _DocItem = e.Result; |
||
660 | |||
661 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
662 | { |
||
663 | //장원 |
||
664 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
665 | } |
||
666 | 29010418 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
667 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
668 | } |
||
669 | else |
||
670 | { |
||
671 | 0585d5cc | taeseongkim | DialogMessage_Alert("Document Information Not Found.", "Error"); |
672 | |||
673 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
674 | { |
||
675 | 0f065e57 | ljiyeon | Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
676 | |||
677 | 787a4489 | KangIngu | if (ea.Error == null) |
678 | { |
||
679 | if (ea.Result) |
||
680 | { |
||
681 | this._ViewInfo.isAdmin = true; |
||
682 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
683 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
684 | } |
||
685 | else |
||
686 | { |
||
687 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
688 | 503cb09e | taeseongkim | DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info"); |
689 | 787a4489 | KangIngu | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
690 | } |
||
691 | |||
692 | } |
||
693 | else |
||
694 | { |
||
695 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
696 | } |
||
697 | }; |
||
698 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
699 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
700 | } |
||
701 | } |
||
702 | |||
703 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
704 | { |
||
705 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
706 | |||
707 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
708 | { |
||
709 | App.SystemInfo = e.Result; |
||
710 | |||
711 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
712 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
713 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
714 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
715 | |||
716 | //if (App.urlHost.Contains("localhost")) |
||
717 | //{ |
||
718 | // App.urlHost = App.urlHost_DB; |
||
719 | //} |
||
720 | } |
||
721 | } |
||
722 | |||
723 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
724 | { |
||
725 | 84c48033 | djkim | |
726 | 0f065e57 | ljiyeon | Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
727 | 84c48033 | djkim | 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
728 | 53880c83 | ljiyeon | if (e.Error == null && e.Result == true) |
729 | 787a4489 | KangIngu | { |
730 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1); |
731 | |||
732 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
733 | |||
734 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
735 | 787a4489 | KangIngu | { |
736 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1); |
737 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
738 | if (userData != null) |
||
739 | 787a4489 | KangIngu | { |
740 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
741 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
742 | 787a4489 | KangIngu | } |
743 | 6c781c0c | djkim | else |
744 | { |
||
745 | userData = new MEMBER(); |
||
746 | userData.DEPARTMENT = "ALL"; |
||
747 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
748 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
749 | 29010418 | ljiyeon | } |
750 | 787a4489 | KangIngu | } |
751 | } |
||
752 | else |
||
753 | { |
||
754 | 84c48033 | djkim | |
755 | DialogMessage_Alert(failedmsg, "Warning"); |
||
756 | 787a4489 | KangIngu | } |
757 | } |
||
758 | 29010418 | ljiyeon | |
759 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
760 | 5a6493ad | humkyung | { |
761 | 787a4489 | KangIngu | this._ViewInfo = info; |
762 | 5a6493ad | humkyung | try |
763 | 5ded1e5a | djkim | { |
764 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
765 | /// 다른 Site를 대비하여 에러 처리함 |
||
766 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
767 | if (!string.IsNullOrEmpty(docid)) |
||
768 | { |
||
769 | this._ViewInfo.DocumentItemID = docid; |
||
770 | } |
||
771 | 5ded1e5a | djkim | } |
772 | 5a6493ad | humkyung | catch(Exception ex) |
773 | { |
||
774 | App.FileLogger.Fatal(ex); |
||
775 | } |
||
776 | |||
777 | 5ded1e5a | djkim | Logger.sendReqLog("GetSystemDataAsync", "", 1); |
778 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
779 | 787a4489 | KangIngu | } |
780 | |||
781 | 992a98b4 | KangIngu | public void HubSet() |
782 | { |
||
783 | // 허브 연결 구성 |
||
784 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
785 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
786 | |||
787 | |||
788 | // 허브 연결 |
||
789 | hubConnection.Start().ContinueWith(task => |
||
790 | { |
||
791 | if (task.IsFaulted) |
||
792 | { |
||
793 | Console.WriteLine("There was an error opening the connection:{0}", |
||
794 | task.Exception.GetBaseException()); |
||
795 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
796 | 992a98b4 | KangIngu | } |
797 | else |
||
798 | { |
||
799 | Console.WriteLine("Connected :: " + task.Id); |
||
800 | } |
||
801 | |||
802 | }).Wait(); |
||
803 | |||
804 | |||
805 | // [ 프로그램 시작 ] |
||
806 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
807 | //( "method name", arg1, arg2 ) |
||
808 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
809 | //{ |
||
810 | // if (task.IsFaulted) |
||
811 | // { |
||
812 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
813 | // } |
||
814 | // else |
||
815 | // { |
||
816 | // Console.WriteLine(task.Result); |
||
817 | // } |
||
818 | //}); |
||
819 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
820 | 992a98b4 | KangIngu | { |
821 | if (task.IsFaulted) |
||
822 | { |
||
823 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
824 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
825 | 992a98b4 | KangIngu | } |
826 | else |
||
827 | { |
||
828 | 29010418 | ljiyeon | switch (task.Result) |
829 | 992a98b4 | KangIngu | { |
830 | 53393bae | KangIngu | case "2": |
831 | { |
||
832 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
833 | if (result == MessageBoxResult.OK) |
||
834 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
835 | 53393bae | KangIngu | } |
836 | break; |
||
837 | case "404": |
||
838 | { |
||
839 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
840 | if(result == MessageBoxResult.OK) |
||
841 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
842 | 53393bae | KangIngu | } |
843 | break; |
||
844 | 992a98b4 | KangIngu | } |
845 | } |
||
846 | 53f96e00 | 송근호 | }); |
847 | 992a98b4 | KangIngu | |
848 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
849 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
850 | //{ |
||
851 | |||
852 | // if (status) |
||
853 | // { |
||
854 | // // 프로그램 시작 |
||
855 | // Console.WriteLine("connection status : " + status); |
||
856 | // } |
||
857 | // else |
||
858 | // { |
||
859 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
860 | // hubConnection.Stop(); |
||
861 | // } |
||
862 | //}); |
||
863 | |||
864 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
865 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
866 | Console.WriteLine("Noficiation Message : " + msg) |
||
867 | ); |
||
868 | |||
869 | |||
870 | // 서버 메서드 호출 |
||
871 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
872 | |||
873 | //Console.ReadKey(); |
||
874 | |||
875 | //hubConnection.Stop(); |
||
876 | } |
||
877 | 787a4489 | KangIngu | |
878 | ac4f1e13 | taeseongkim | public async void MarkupUserListDisplay() |
879 | 1f1c566e | djkim | { |
880 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
881 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
882 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
883 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
884 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
885 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
886 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
887 | //{ |
||
888 | // if (item.UserID == App.ViewInfo.UserID) |
||
889 | // { |
||
890 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
891 | f714bef8 | djkim | // { |
892 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
893 | // }); |
||
894 | // } |
||
895 | // else |
||
896 | // { |
||
897 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
898 | // { |
||
899 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
900 | // }); |
||
901 | // } |
||
902 | //} |
||
903 | 29010418 | ljiyeon | (from A in gridSelectionItem |
904 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
905 | where A.MarkupInfoID == B.MarkupInfoID |
||
906 | select B).ToList().ForEach(data => |
||
907 | { |
||
908 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
909 | }); |
||
910 | 1f1c566e | djkim | (from A in gridSelectionItem |
911 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
912 | where A.MarkupInfoID == B.MarkupInfoID |
||
913 | select B).ToList().ForEach(data => |
||
914 | { |
||
915 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
916 | }); |
||
917 | |||
918 | foreach (var item in gridSelectionItem) |
||
919 | { |
||
920 | ac4f1e13 | taeseongkim | |
921 | 1f1c566e | djkim | if (item.UserID == App.ViewInfo.UserID) |
922 | { |
||
923 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
924 | |||
925 | foreach (var markupitem in markupItems) |
||
926 | 1f1c566e | djkim | { |
927 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
928 | item.MarkupInfoID, markupitem.ID); |
||
929 | } |
||
930 | 1f1c566e | djkim | } |
931 | else |
||
932 | { |
||
933 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
934 | |||
935 | foreach (var markupitem in markupItems) |
||
936 | 1f1c566e | djkim | { |
937 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
938 | } |
||
939 | 1f1c566e | djkim | } |
940 | } |
||
941 | } |
||
942 | 787a4489 | KangIngu | } |
943 | } |