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