markus / KCOM / Services / BaseServices.cs @ 7ca218b3
이력 | 보기 | 이력해설 | 다운로드 (41.9 KB)
1 | 787a4489 | KangIngu | using Microsoft.AspNet.SignalR.Client; |
---|---|---|---|
2 | using IKCOM; |
||
3 | using KCOM.Common; |
||
4 | using KCOM.ServiceDeepView; |
||
5 | using KCOM_API; |
||
6 | using KCOMDataModel.DataModel; |
||
7 | using Newtonsoft.Json; |
||
8 | using RestSharp; |
||
9 | using System; |
||
10 | using System.Collections.Generic; |
||
11 | using System.Collections.ObjectModel; |
||
12 | using System.ComponentModel; |
||
13 | using System.Linq; |
||
14 | using System.Runtime.CompilerServices; |
||
15 | using System.Text; |
||
16 | using System.Windows; |
||
17 | using System.Windows.Controls; |
||
18 | using Telerik.Windows.Controls; |
||
19 | |||
20 | namespace KCOM.Views |
||
21 | { |
||
22 | //public partial class MainWindow : Window , INotifyPropertyChanged |
||
23 | //{ |
||
24 | // private Common.DocumentSet _CurrentDoc { get; set; } |
||
25 | // public Common.DocumentSet CurrentDoc |
||
26 | // { |
||
27 | // get |
||
28 | // { |
||
29 | // return _CurrentDoc; |
||
30 | // } |
||
31 | // set |
||
32 | // { |
||
33 | // if (value != CurrentDoc) |
||
34 | // { |
||
35 | // _CurrentDoc = value; |
||
36 | // NotifyPropertyChanged(); |
||
37 | // } |
||
38 | // } |
||
39 | // } |
||
40 | |||
41 | // const string DeepZoomUrl = @"http://{baseUrl}/Pages/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg"; |
||
42 | |||
43 | // public event PropertyChangedEventHandler PropertyChanged; |
||
44 | // // This method is called by the Set accessor of each property. |
||
45 | // // The CallerMemberName attribute that is applied to the optional propertyName |
||
46 | // // parameter causes the property name of the caller to be substituted as an argument. |
||
47 | // private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
48 | // { |
||
49 | // if (PropertyChanged != null) |
||
50 | // { |
||
51 | // PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
52 | // } |
||
53 | // } |
||
54 | // public void InitilizeSystem() |
||
55 | // { |
||
56 | // App.BaseClient = new RestClient(Properties.Settings.Default.BaseClientAddress); |
||
57 | // var request = new RestRequest("api/Basic/GetSystemData", Method.GET); |
||
58 | // //request.AddParameter("some_param_name", "some_param_value", ParameterType.QueryString); |
||
59 | // IRestResponse response = App.BaseClient.Execute(request); |
||
60 | // if (response.StatusCode == System.Net.HttpStatusCode.OK) |
||
61 | // { |
||
62 | // App.SystemInfo = JsonConvert.DeserializeObject<KCOM_SystemInfo>(response.Content); |
||
63 | // } |
||
64 | // else |
||
65 | // { |
||
66 | // MessageBox.Show("시스템에서 정보를 받아 올 수 없었습니다. 다시 확인해주세요"); |
||
67 | // } |
||
68 | // } |
||
69 | |||
70 | // public bool Check_DocConvert(string projectNo, string documentID) |
||
71 | // { |
||
72 | // var request = new RestRequest("api/Basic/GetConversionState", Method.GET); |
||
73 | // request.AddParameter("projectNo", projectNo); |
||
74 | // request.AddParameter("documentID", documentID); |
||
75 | |||
76 | // IRestResponse response = App.BaseClient.Execute(request); |
||
77 | // if (response.StatusCode == System.Net.HttpStatusCode.OK) |
||
78 | // { |
||
79 | // return JsonConvert.DeserializeObject<bool>(response.Content); |
||
80 | // } |
||
81 | // else |
||
82 | // { |
||
83 | // return false; |
||
84 | // } |
||
85 | // } |
||
86 | |||
87 | // public KCOMDataModel.DataModel.DOCUMENT_ITEM Check_DocItem(string projectNo, string documentID) |
||
88 | // { |
||
89 | // var request = new RestRequest("api/Basic/GetDocumentItemInfo", Method.GET); |
||
90 | // request.AddParameter("projectNo", projectNo); |
||
91 | // request.AddParameter("documentID", documentID); |
||
92 | |||
93 | // IRestResponse response = App.BaseClient.Execute(request); |
||
94 | // if (response.StatusCode == System.Net.HttpStatusCode.OK) |
||
95 | // { |
||
96 | // return JsonConvert.DeserializeObject<KCOMDataModel.DataModel.DOCUMENT_ITEM>(response.Content); |
||
97 | // } |
||
98 | // else |
||
99 | // { |
||
100 | // return null; |
||
101 | // } |
||
102 | // } |
||
103 | |||
104 | // public KCOMDataModel.DataModel.DOCINFO Check_DocInfo(string projectNo, string documentID) |
||
105 | // { |
||
106 | // var request = new RestRequest("api/Basic/GetDocInfo", Method.GET); |
||
107 | // request.AddParameter("projectNo", projectNo); |
||
108 | // request.AddParameter("documentID", documentID); |
||
109 | |||
110 | // IRestResponse response = App.BaseClient.Execute(request); |
||
111 | // if (response.StatusCode == System.Net.HttpStatusCode.OK) |
||
112 | // { |
||
113 | // var data = JsonConvert.DeserializeObject<KCOMDataModel.DataModel.DOCINFO>(response.Content); |
||
114 | // //return JsonConvert.DeserializeObject<KCOMDataModel.DataModel.DOCINFO>(response.Content); |
||
115 | // return data; |
||
116 | // } |
||
117 | // else |
||
118 | // { |
||
119 | // return null; |
||
120 | // } |
||
121 | // } |
||
122 | //} |
||
123 | |||
124 | |||
125 | public partial class MainMenu : UserControl, INotifyPropertyChanged |
||
126 | { |
||
127 | /// <summary> |
||
128 | /// 강인구 테스트 |
||
129 | /// </summary> |
||
130 | const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg"; |
||
131 | public ServiceDeepViewClient BaseClient; |
||
132 | public ViewInfo _ViewInfo; |
||
133 | public DOCINFO _DocInfo; |
||
134 | public DOCUMENT_ITEM _DocItem; |
||
135 | public MEMBER userData; |
||
136 | |||
137 | public event PropertyChangedEventHandler PropertyChanged; |
||
138 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
139 | { |
||
140 | if (PropertyChanged != null) |
||
141 | { |
||
142 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
143 | } |
||
144 | } |
||
145 | |||
146 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
147 | public Common.DocumentSet CurrentDoc |
||
148 | { |
||
149 | get |
||
150 | { |
||
151 | return _CurrentDoc; |
||
152 | } |
||
153 | set |
||
154 | { |
||
155 | if (value != CurrentDoc) |
||
156 | { |
||
157 | _CurrentDoc = value; |
||
158 | NotifyPropertyChanged(); |
||
159 | } |
||
160 | } |
||
161 | } |
||
162 | public void ServiceOn() |
||
163 | { |
||
164 | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
||
165 | //BaseClient = new ServiceDeepViewClient(); |
||
166 | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
||
167 | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
||
168 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
169 | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
||
170 | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
||
171 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
172 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
173 | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
||
174 | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
||
175 | BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted; |
||
176 | } |
||
177 | |||
178 | private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e) |
||
179 | { |
||
180 | if (e.Error != null || e.Result == null) |
||
181 | { |
||
182 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
183 | } |
||
184 | else |
||
185 | { |
||
186 | e.Result.ForEach(d => |
||
187 | { |
||
188 | d.Width = d.Width * 3; |
||
189 | d.Height = d.Height * 3; |
||
190 | var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d); |
||
191 | System.Windows.Shapes.Ellipse myEllipse = new System.Windows.Shapes.Ellipse(); |
||
192 | myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); |
||
193 | myEllipse.Opacity = 1; |
||
194 | myEllipse.Width = d.Width; |
||
195 | myEllipse.Height = d.Height; |
||
196 | Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0)); |
||
197 | Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0)); |
||
198 | myEllipse.RenderTransformOrigin = point; |
||
199 | canvas_compareBorder.Children.Add(myEllipse); |
||
200 | }); |
||
201 | |||
202 | da.From = 0.8; |
||
203 | da.To = 0; |
||
204 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
205 | da.AutoReverse = true; |
||
206 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
207 | } |
||
208 | } |
||
209 | |||
210 | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
||
211 | { |
||
212 | |||
213 | if (e.Error !=null || e.Result.Status == FinalStatus.Error) |
||
214 | { |
||
215 | DialogMessage_Alert("최종 파일을 만드는데 문제가 발생하였습니다", "안내"); |
||
216 | } |
||
217 | else |
||
218 | { |
||
219 | DialogMessage_Alert("최종 파일을 생성 중. 데모 버전은 대시보드에서 확인해주세요", "안내"); |
||
220 | } |
||
221 | } |
||
222 | |||
223 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
224 | { |
||
225 | if (e.Result != null && e.Error == null) |
||
226 | { |
||
227 | gridViewHistory.ItemsSource = e.Result; |
||
228 | } |
||
229 | } |
||
230 | |||
231 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
232 | { |
||
233 | SetDisplayColor(ViewerDataModel.Instance._markupInfoList.ToList(), App.ViewInfo.UserID); |
||
234 | } |
||
235 | |||
236 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
237 | { |
||
238 | if (e.Result != null) |
||
239 | { |
||
240 | e.Result.Sort(); |
||
241 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
242 | } |
||
243 | } |
||
244 | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
||
245 | |||
246 | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
||
247 | { |
||
248 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
249 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
250 | if (e.Result != null) |
||
251 | { |
||
252 | var pureItem = e.Result; |
||
253 | if(pureItem.Count > 0) |
||
254 | { |
||
255 | ViewerDataModel.Instance.MarkupList_USER.Clear(); |
||
256 | } |
||
257 | |||
258 | pureItem.ToList().ForEach(d => d.MarkupList.ForEach(p => |
||
259 | { |
||
260 | |||
261 | if (d.UserID == App.ViewInfo.UserID) |
||
262 | { |
||
263 | d.userDelete = true; |
||
264 | d.DisplayColor = "#FFFF0000"; |
||
265 | |||
266 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
267 | { |
||
268 | Data = p.Data, |
||
269 | Data_Type = p.Data_Type, |
||
270 | ID = p.ID, |
||
271 | IsUpdate = false, |
||
272 | MarkupInfoID = d.MarkupInfoID, |
||
273 | PageNumber = p.PageNumber, |
||
274 | }); |
||
275 | } |
||
276 | else |
||
277 | { |
||
278 | ViewerDataModel.Instance.MarkupList_Pre.Add(new MarkupItemEx |
||
279 | { |
||
280 | Data = p.Data, |
||
281 | Data_Type = p.Data_Type, |
||
282 | ID = p.ID, |
||
283 | IsUpdate = false, |
||
284 | MarkupInfoID = d.MarkupInfoID, |
||
285 | PageNumber = p.PageNumber, |
||
286 | }); |
||
287 | } |
||
288 | //if (p.ID ==App.ViewInfo.UserID) |
||
289 | //{ |
||
290 | // d.userDelete = true; |
||
291 | // d.DisplayColor = "#FFFF0000"; |
||
292 | //} |
||
293 | })); |
||
294 | |||
295 | var currentUser = e.Result.Where(data => data.UserID == userData.ID).FirstOrDefault(); |
||
296 | //var currentUser = e.Result.Where(data => data.UserID == "H2014410").FirstOrDefault(); |
||
297 | if (currentUser == null) |
||
298 | { |
||
299 | var infoId = Events.Save.shortGuid(); |
||
300 | PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
301 | { |
||
302 | CreateTime = DateTime.Now, |
||
303 | Depatment = userData.DEPARTMENT, |
||
304 | DisplayColor = "#FFFF0000", |
||
305 | UserID = userData.ID, |
||
306 | UserName = userData.NAME, |
||
307 | PageCount = 1, |
||
308 | Description = "", |
||
309 | MarkupInfoID = infoId, |
||
310 | MarkupList = null, |
||
311 | MarkupVersionID = Events.Save.shortGuid(), |
||
312 | Consolidate = 0, |
||
313 | PartConsolidate = 0, |
||
314 | userDelete = true, |
||
315 | AvoidConsolidate = 0, |
||
316 | IsPreviewUser = true |
||
317 | }; |
||
318 | |||
319 | App.Custom_ViewInfoId = infoId; |
||
320 | //pureItem.Insert(0,PreviewUserMarkupInfoItem); |
||
321 | } |
||
322 | else |
||
323 | { |
||
324 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
325 | } |
||
326 | |||
327 | //pureItem.ForEach(d => d.MarkupList = null); |
||
328 | //ViewerDataModel.Instance._markupInfoList = new ObservableCollection<MarkupInfoItem>(pureItem); |
||
329 | ViewerDataModel.Instance._markupInfoList = SetDisplayColor(pureItem, _ViewInfo.UserID); |
||
330 | //ViewerDataModel.Instance._markupInfoList = SetDisplayColor(e.Result, _ViewInfo.UserID); |
||
331 | |||
332 | |||
333 | |||
334 | //if (e.Result.Where(data => data.UserID == userData.ID).FirstOrDefault() == null) |
||
335 | //{ |
||
336 | |||
337 | // PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
338 | // { |
||
339 | // CreateTime = DateTime.Now, |
||
340 | // Depatment = userData.DEPARTMENT, |
||
341 | // DisplayColor = "#FFFF0000", |
||
342 | // UserID = userData.ID, |
||
343 | // UserName = userData.NAME + "(임시저장)", |
||
344 | // PageCount = 1, |
||
345 | // Description = "", |
||
346 | // MarkupInfoID = Events.Save.shortGuid(), |
||
347 | // MarkupList = null, |
||
348 | // MarkupVersionID = Events.Save.shortGuid(), |
||
349 | // Consolidate = 0, |
||
350 | // PartConsolidate = 0, |
||
351 | // userDelete = true, |
||
352 | // AvoidConsolidate = 0, |
||
353 | // IsPreviewUser = true |
||
354 | // }; |
||
355 | // ViewerDataModel.Instance._markupInfoList.Add(PreviewUserMarkupInfoItem); |
||
356 | //} |
||
357 | |||
358 | |||
359 | |||
360 | var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); //Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
||
361 | |||
362 | markupItem.ForEach(data => |
||
363 | { |
||
364 | if (data.Depatment == null) |
||
365 | { |
||
366 | data.Depatment = "Unknown"; |
||
367 | //BaseClient.NoticeAccountErrorAsync(_ViewInfo.ProjectNO, data.UserID); |
||
368 | } |
||
369 | }); |
||
370 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
371 | SetCommentPages(); |
||
372 | this.gridViewMarkup.SelectedItem = this.gridViewMarkup.Items[0]; |
||
373 | |||
374 | //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); //Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
||
375 | |||
376 | //markupItem.ForEach(data => |
||
377 | //{ |
||
378 | // if (data.Depatment == null) |
||
379 | // { |
||
380 | // data.Depatment = "Unknown"; |
||
381 | // //BaseClient.NoticeAccountErrorAsync(_ViewInfo.ProjectNO, data.UserID); |
||
382 | // } |
||
383 | //}); |
||
384 | |||
385 | //markupItem.Where(data => Convert.ToBoolean(data.Consolidate) && !Convert.ToBoolean(data.PartConsolidate)).ToList().ForEach(data => data.Depatment = "Consolidation"); |
||
386 | |||
387 | //var root = markupItem.Where(data => data.Depatment.Contains("SUB_")).ToList(); |
||
388 | |||
389 | //foreach (var item in root) |
||
390 | //{ |
||
391 | // item.Depatment = item.Depatment.Replace("SUB_", ""); |
||
392 | //} |
||
393 | //gridViewMarkup.ItemsSource = markupItem; |
||
394 | |||
395 | //SetCommentPages(); //색상을 불러오는 내용 |
||
396 | |||
397 | |||
398 | //if (ViewerDataModel.Instance._markupInfoList.Count() > 0) |
||
399 | //{ |
||
400 | // var com = (from kkk in ViewerDataModel.Instance._markupInfoList where kkk.Consolidate == Convert.ToInt32(true) select kkk).FirstOrDefault(); |
||
401 | |||
402 | // if (com != null) //콘솔리데이션이 있는 경우 |
||
403 | // { |
||
404 | // if (com.UserID == _ViewInfo.UserID) |
||
405 | // { |
||
406 | // gridViewMarkup.SelectedItems.Add(com); |
||
407 | // } |
||
408 | // else |
||
409 | // { |
||
410 | // if (ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault() != null) |
||
411 | // { |
||
412 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault()); |
||
413 | // } |
||
414 | |||
415 | // else |
||
416 | // { |
||
417 | // var data = ViewerDataModel.Instance._markupInfoList.Where(p => p.Consolidate == Convert.ToInt32(true)).FirstOrDefault(); |
||
418 | // //DicUserListOpacity.Add(data.UserID, 1); |
||
419 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.Consolidate == Convert.ToInt32(true)).FirstOrDefault()); |
||
420 | // } |
||
421 | // } |
||
422 | |||
423 | // } |
||
424 | // else |
||
425 | // { |
||
426 | // //아무것도 체크 안함 |
||
427 | // //foreach (var item in _markupInfoList) |
||
428 | // //{ |
||
429 | // // gridViewMarkup.SelectedItems.Add(item); |
||
430 | // //} |
||
431 | |||
432 | |||
433 | // if (ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault() != null) //본인것만 체크 |
||
434 | // { |
||
435 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault()); |
||
436 | // } |
||
437 | // } |
||
438 | //} |
||
439 | //else |
||
440 | //{ |
||
441 | |||
442 | //} |
||
443 | } |
||
444 | } |
||
445 | |||
446 | private void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
||
447 | { |
||
448 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
449 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
450 | //{ |
||
451 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
452 | //} |
||
453 | |||
454 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
455 | { |
||
456 | ViewerDataModel.Instance.PageNumber = 1; |
||
457 | } |
||
458 | if (e.AddedItems.Count() > 0) |
||
459 | { |
||
460 | foreach (var item in gridSelectionItem) |
||
461 | { |
||
462 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
463 | //{ |
||
464 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
465 | //}); |
||
466 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
467 | { |
||
468 | layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
469 | }); |
||
470 | } |
||
471 | } |
||
472 | else if (e.RemovedItems.Count > 0) |
||
473 | { |
||
474 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
475 | |||
476 | (from A in _infoItem |
||
477 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
478 | where A.MarkupInfoID == B.MarkupInfoID |
||
479 | select B).ToList().ForEach(data => |
||
480 | { |
||
481 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
482 | }); |
||
483 | } |
||
484 | } |
||
485 | private void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
||
486 | { |
||
487 | //this.ParentOfType<MainPage>().ReleaseAdorner(); |
||
488 | |||
489 | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
490 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
491 | var resultA = (from item_Select in dataSet |
||
492 | from item_Non in dataSet_User |
||
493 | where item_Select == item_Non |
||
494 | select item_Non).ToList(); |
||
495 | |||
496 | if (resultA.Count() >= 2) |
||
497 | { |
||
498 | RadWindow.Confirm(new DialogParameters |
||
499 | { |
||
500 | Header = "안내", |
||
501 | Content = "동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?", |
||
502 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
503 | { |
||
504 | if (e.AddedItems.Count() == 1) |
||
505 | { |
||
506 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
507 | var result = instanceItem.Consolidate; |
||
508 | |||
509 | //dataSet.Where(data => data.UserID == "H2011357").ToList().ForEach(data => lstbox.SelectedItems.Remove(data)); |
||
510 | if (ea.DialogResult.Value) |
||
511 | { |
||
512 | ConsolidationMethod(); |
||
513 | } |
||
514 | else |
||
515 | { |
||
516 | ((RadGridView)sender).SelectedItem = null; |
||
517 | } |
||
518 | } |
||
519 | }), |
||
520 | Theme = new Windows8Theme(), |
||
521 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
522 | }); |
||
523 | } |
||
524 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
525 | { |
||
526 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
527 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
528 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
529 | MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
530 | layerControl.ProjectNo = App.ViewInfo.ProjectNO; |
||
531 | #region 코멘트 보기 |
||
532 | if (e.AddedItems.Count() > 0) |
||
533 | { |
||
534 | foreach (var item in gridSelectionItem) |
||
535 | { |
||
536 | //if (item.MarkupList != null) |
||
537 | //{ |
||
538 | // if (item.UserID == App.ViewInfo.UserID) |
||
539 | // { |
||
540 | // item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNavigator.CurrentPage.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
541 | // { |
||
542 | //layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID); |
||
543 | |||
544 | // }); |
||
545 | // } |
||
546 | // else |
||
547 | // { |
||
548 | // item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNavigator.CurrentPage.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
549 | // { |
||
550 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
551 | |||
552 | // }); |
||
553 | // } |
||
554 | |||
555 | //} |
||
556 | //else |
||
557 | //{ |
||
558 | //if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == App.Custom_ViewInfoId) |
||
559 | if (item.UserID == App.ViewInfo.UserID) |
||
560 | { |
||
561 | var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
562 | var my_item = Common.ViewerDataModel.Instance.MarkupControls_USER.FirstOrDefault(); |
||
563 | |||
564 | if (my_item == null) |
||
565 | { |
||
566 | foreach (var markup in instance) |
||
567 | { |
||
568 | layerControl.markupParseEx(markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markup.ID); |
||
569 | } |
||
570 | } |
||
571 | else |
||
572 | { |
||
573 | var test = instance.Where(data => data.MarkupInfoID == my_item.MarkupInfoID).FirstOrDefault(); |
||
574 | |||
575 | if (test == null) |
||
576 | { |
||
577 | foreach (var markup in instance) |
||
578 | { |
||
579 | layerControl.markupParseEx(markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markup.ID); |
||
580 | } |
||
581 | } |
||
582 | } |
||
583 | } |
||
584 | else |
||
585 | { |
||
586 | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
587 | |||
588 | foreach (var markup in instance) |
||
589 | { |
||
590 | layerControl.markupParse(markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
591 | } |
||
592 | |||
593 | } |
||
594 | } |
||
595 | //} |
||
596 | } |
||
597 | #endregion |
||
598 | #region 코멘트 숨기기 |
||
599 | else if (e.RemovedItems.Count > 0) |
||
600 | { |
||
601 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
602 | |||
603 | (from A in _infoItem |
||
604 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
605 | where A.MarkupInfoID == B.MarkupInfoID |
||
606 | select B).ToList().ForEach(data => |
||
607 | { |
||
608 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
609 | }); |
||
610 | |||
611 | //var myComment = _infoItem.Where(d => d.MarkupInfoID == App.Custom_ViewInfoId).FirstOrDefault(); |
||
612 | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
||
613 | if (myComment != null) |
||
614 | { |
||
615 | ChangeCommentReact(); |
||
616 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
617 | { |
||
618 | if (markupitem.IsNew) |
||
619 | { |
||
620 | var root = layerControl.MarkupToString(markupitem, App.ViewInfo.UserID); |
||
621 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
622 | { |
||
623 | ID = markupitem.CommentID, |
||
624 | Data = root.ConvertData, |
||
625 | Data_Type = root.DATA_TYPE, |
||
626 | MarkupInfoID = markupitem.MarkupInfoID, |
||
627 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
628 | }); |
||
629 | } |
||
630 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(markupitem); |
||
631 | }); |
||
632 | } |
||
633 | } |
||
634 | #endregion |
||
635 | } |
||
636 | } |
||
637 | |||
638 | private static ObservableCollection<MarkupInfoItem> SetDisplayColor(List<MarkupInfoItem> MarkupInfoList, string userID) |
||
639 | { |
||
640 | //var random = new Random(); |
||
641 | ObservableCollection<MarkupInfoItem> _result = new ObservableCollection<MarkupInfoItem>(); |
||
642 | |||
643 | MarkupInfoList.ForEach(delegate (MarkupInfoItem infoitem) |
||
644 | { |
||
645 | if (userID == infoitem.UserID) |
||
646 | { |
||
647 | infoitem.userDelete = true; |
||
648 | infoitem.DisplayColor = "#FFFF0000"; |
||
649 | } |
||
650 | else |
||
651 | { |
||
652 | infoitem.userDelete = false; |
||
653 | |||
654 | #region sample code |
||
655 | |||
656 | //string _ColorStr = "#FF"; |
||
657 | |||
658 | //for (int i = 0; i < infoitem.Depatment.Count(); i++) |
||
659 | //{ |
||
660 | // _ColorStr += Convert.ToByte(infoitem.Depatment[i]); |
||
661 | //} |
||
662 | |||
663 | //if (_ColorStr.Length < 9) |
||
664 | //{ |
||
665 | // for (int i = 0; i < 9 - _ColorStr.Length; i++) |
||
666 | // { |
||
667 | // _ColorStr += "F"; |
||
668 | // } |
||
669 | //} |
||
670 | //else |
||
671 | //{ |
||
672 | // _ColorStr = _ColorStr.Substring(0,9); |
||
673 | //} |
||
674 | //System.Diagnostics.Debug.WriteLine(_ColorStr); |
||
675 | //infoitem.DisplayColor = _ColorStr;// String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
676 | #endregion |
||
677 | } |
||
678 | |||
679 | _result.Add(infoitem); |
||
680 | }); |
||
681 | |||
682 | return _result; |
||
683 | } |
||
684 | |||
685 | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
||
686 | { |
||
687 | if (e.Result != null) |
||
688 | { |
||
689 | _DocItem = e.Result; |
||
690 | |||
691 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
692 | { |
||
693 | //장원 |
||
694 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
695 | } |
||
696 | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
697 | } |
||
698 | else |
||
699 | { |
||
700 | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
||
701 | { |
||
702 | if (ea.Error == null) |
||
703 | { |
||
704 | if (ea.Result) |
||
705 | { |
||
706 | this._ViewInfo.isAdmin = true; |
||
707 | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
708 | } |
||
709 | else |
||
710 | { |
||
711 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
712 | DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
713 | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
714 | } |
||
715 | |||
716 | } |
||
717 | else |
||
718 | { |
||
719 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
720 | } |
||
721 | }; |
||
722 | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
||
723 | } |
||
724 | } |
||
725 | |||
726 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
727 | { |
||
728 | if (e.Error == null && e.Result != null) |
||
729 | { |
||
730 | App.SystemInfo = e.Result; |
||
731 | |||
732 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
733 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
734 | |||
735 | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
736 | |||
737 | //if (App.urlHost.Contains("localhost")) |
||
738 | //{ |
||
739 | // App.urlHost = App.urlHost_DB; |
||
740 | //} |
||
741 | } |
||
742 | } |
||
743 | |||
744 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
745 | { |
||
746 | if (e.Error == null && e.Result != null && e.Result) |
||
747 | { |
||
748 | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
||
749 | |||
750 | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "" && App.ViewInfo.NewCommentPermission) |
||
751 | { |
||
752 | //BaseClient.GetUserDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
||
753 | |||
754 | |||
755 | using (CIEntities entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString())) |
||
756 | { |
||
757 | var _UserList = from member in entity.MEMBER |
||
758 | where member.ID == App.ViewInfo.UserID |
||
759 | select member; |
||
760 | userData = _UserList.FirstOrDefault(); |
||
761 | |||
762 | if (userData != null) |
||
763 | { |
||
764 | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); //테스트로 입력 |
||
765 | //BaseClient.GetPublicSymbolAsync(userData.dept); |
||
766 | //기계 장치 배관 설비 계장 건축 전기 환경.. |
||
767 | } |
||
768 | else |
||
769 | { |
||
770 | userData = new MEMBER(); |
||
771 | userData.DEPARTMENT = "ALL"; |
||
772 | } |
||
773 | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); //테스트로 입력 |
||
774 | } |
||
775 | } |
||
776 | } |
||
777 | else |
||
778 | { |
||
779 | DialogMessage_Alert("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!" |
||
780 | + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
781 | //System.Windows.Forms.MessageBox.Show("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!" |
||
782 | // + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
783 | //this.ParentOfType<MainPage>().DialogMessage_Alert("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!" |
||
784 | // + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
785 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
786 | } |
||
787 | } |
||
788 | |||
789 | private void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
||
790 | { |
||
791 | if (e.Error != null) |
||
792 | { |
||
793 | DialogMessage_Alert("페이지정보를 가져올 수 없습니다.", "Alert"); |
||
794 | //MessageBox.Show("페이지정보를 가져올 수 없습니다."); |
||
795 | //this.ParentOfType<MainPage>().DialogMessage_Alert("Failed to get page information from Server", "Alert"); |
||
796 | return; |
||
797 | } |
||
798 | |||
799 | var MainUrl = DeepZoomUrl.Replace("{baseUrl}", App.SystemInfo.HostName); |
||
800 | MainUrl = MainUrl.Replace("{TileSourcePath}", _ViewInfo.ProjectNO + "_Tile"); |
||
801 | MainUrl = MainUrl.Replace("{ItemsPath}", (Convert.ToInt64(_ViewInfo.DocumentItemID) / 100).ToString()); |
||
802 | MainUrl = MainUrl.Replace("{SharepointItemID}", _ViewInfo.DocumentItemID); |
||
803 | MainUrl = MainUrl.Replace(@"http://http://", @"http://"); |
||
804 | |||
805 | _DocInfo = e.Result; |
||
806 | foreach(var item in _DocInfo.DOCPAGE) |
||
807 | { |
||
808 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
809 | } |
||
810 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
811 | CurrentDoc = new Common.DocumentSet |
||
812 | { |
||
813 | docInfo = _DocInfo, |
||
814 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
815 | //Document_Name = docItem.DOCUMENT_NAME, |
||
816 | Document_NO = _DocItem.DOCUMENT_NO, |
||
817 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
818 | File_Result = _DocItem.RESULT_FILE, |
||
819 | Group_No = _DocItem.GROUP_NO, |
||
820 | ProjectNo = _DocItem.PROJECT_NO, |
||
821 | Revision = _DocItem.REVISION, |
||
822 | }; |
||
823 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
824 | instanceMain.dzTopMenu.tlcurrentPage.Text = _DocInfo.PAGE_COUNT.ToString(); |
||
825 | this.pageNavigator.SetPageNavi(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
||
826 | |||
827 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
828 | |||
829 | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
||
830 | //gridView.ItemsSource = CurrentDoc.docInfo.MARKUP_INFO.ToList(); |
||
831 | //BaseClient.GetMarkupInfoItemsAsync(CurrentDoc.ProjectNo, CurrentDoc.docInfo.ID); |
||
832 | } |
||
833 | |||
834 | |||
835 | public void SetView(ViewInfo info) |
||
836 | { |
||
837 | this._ViewInfo = info; |
||
838 | if (!(App.ViewInfo.ProjectNO == "000000" || App.ViewInfo.ProjectNO == "000001")) |
||
839 | { |
||
840 | ViewerDataModel.Instance.SystemMain.dzTopMenu.btnTopStamp.Visibility = Visibility.Collapsed; |
||
841 | } |
||
842 | BaseClient.GetSystemDataAsync(); |
||
843 | } |
||
844 | |||
845 | //public void HubSet() |
||
846 | //{ |
||
847 | |||
848 | // // 허브 연결 구성 |
||
849 | // var hubConnection = new HubConnection("http://cloud.devdoftech.co.kr:8089/"); |
||
850 | // IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
||
851 | |||
852 | |||
853 | // // 허브 연결 |
||
854 | // hubConnection.Start().ContinueWith(task => { |
||
855 | // if (task.IsFaulted) |
||
856 | // { |
||
857 | // Console.WriteLine("There was an error opening the connection:{0}", |
||
858 | // task.Exception.GetBaseException()); |
||
859 | // } |
||
860 | // else |
||
861 | // { |
||
862 | // Console.WriteLine("Connected :: " + task.Id); |
||
863 | // } |
||
864 | |||
865 | // }).Wait(); |
||
866 | |||
867 | |||
868 | // // [ 프로그램 시작 ] |
||
869 | // // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
870 | // //( "method name", arg1, arg2 ) |
||
871 | // MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => { |
||
872 | // if (task.IsFaulted) |
||
873 | // { |
||
874 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
875 | // } |
||
876 | // else |
||
877 | // { |
||
878 | // Console.WriteLine(task.Result); |
||
879 | // } |
||
880 | // }); |
||
881 | |||
882 | // // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
883 | // MarkusLicenseProxy.On<bool>("IsConnection", status => { |
||
884 | |||
885 | // if (status) |
||
886 | // { |
||
887 | // // 프로그램 시작 |
||
888 | // Console.WriteLine("connection status : " + status); |
||
889 | // } |
||
890 | // else |
||
891 | // { |
||
892 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
893 | // hubConnection.Stop(); |
||
894 | // } |
||
895 | // }); |
||
896 | |||
897 | // // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
898 | // MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
899 | // Console.WriteLine("Noficiation Message : " + msg) |
||
900 | // ); |
||
901 | |||
902 | |||
903 | // // 서버 메서드 호출 |
||
904 | // //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
905 | |||
906 | // Console.ReadKey(); |
||
907 | |||
908 | // hubConnection.Stop(); |
||
909 | //} |
||
910 | |||
911 | } |
||
912 | } |