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