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