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