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