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