markus / KCOM / Services / BaseServices.cs @ a7372e37
이력 | 보기 | 이력해설 | 다운로드 (44.2 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 | eeb0a39c | taeseongkim | private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
243 | d62c0439 | humkyung | { |
244 | 72424099 | taeseongkim | //Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
245 | d62c0439 | humkyung | |
246 | if (e.Error != null) |
||
247 | { |
||
248 | 503cb09e | taeseongkim | DialogMessage_Alert("The page cannot be displayed.", "Alert"); |
249 | d62c0439 | humkyung | 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 | eeb0a39c | 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 | eeb0a39c | 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 | a7372e37 | taeseongkim | |
383 | 787a4489 | KangIngu | if (currentUser == null) |
384 | { |
||
385 | a36a37c3 | humkyung | /// create a new markupinfo to do comments |
386 | 24678e06 | humkyung | var infoId = Commons.shortGuid(); |
387 | 787a4489 | KangIngu | PreviewUserMarkupInfoItem = new MarkupInfoItem |
388 | { |
||
389 | CreateTime = DateTime.Now, |
||
390 | 073f6118 | djkim | UpdateTime = DateTime.Now, |
391 | 787a4489 | KangIngu | Depatment = userData.DEPARTMENT, |
392 | DisplayColor = "#FFFF0000", |
||
393 | UserID = userData.ID, |
||
394 | UserName = userData.NAME, |
||
395 | PageCount = 1, |
||
396 | Description = "", |
||
397 | MarkupInfoID = infoId, |
||
398 | MarkupList = null, |
||
399 | 24678e06 | humkyung | MarkupVersionID = Commons.shortGuid(), |
400 | 787a4489 | KangIngu | Consolidate = 0, |
401 | PartConsolidate = 0, |
||
402 | userDelete = true, |
||
403 | AvoidConsolidate = 0, |
||
404 | 8129f2a5 | ljiyeon | IsPreviewUser = false |
405 | 787a4489 | KangIngu | }; |
406 | |||
407 | App.Custom_ViewInfoId = infoId; |
||
408 | 8129f2a5 | ljiyeon | |
409 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
410 | 787a4489 | KangIngu | } |
411 | else |
||
412 | { |
||
413 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
414 | } |
||
415 | |||
416 | a36a37c3 | humkyung | foreach(var info in e.Result) |
417 | d128ceb2 | humkyung | { |
418 | if (info.UserID == App.ViewInfo.UserID) info.DisplayColor = "#FFFF0000"; |
||
419 | } |
||
420 | 787a4489 | KangIngu | |
421 | 3ffd4b2d | humkyung | ViewerDataModel.Instance.PageNumber = 1; |
422 | |||
423 | a36a37c3 | humkyung | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
424 | 35a96e24 | humkyung | var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
425 | 787a4489 | KangIngu | markupItem.ForEach(data => |
426 | { |
||
427 | 35a96e24 | humkyung | if (data.Depatment == null) data.Depatment = "Unknown"; |
428 | 787a4489 | KangIngu | }); |
429 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
430 | 29010418 | ljiyeon | SetCommentPages(); |
431 | 992a98b4 | KangIngu | |
432 | a36a37c3 | humkyung | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
433 | this.gridViewMarkup.SelectedItem = (PreviewUserMarkupInfoItem != null) ? PreviewUserMarkupInfoItem : SelectedItem; |
||
434 | 073f6118 | djkim | |
435 | a36a37c3 | humkyung | /// create a group descriptor |
436 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Clear(); |
437 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
438 | descriptor.Member = "Depatment"; |
||
439 | descriptor.DisplayContent = "DEPT"; |
||
440 | dd0f7089 | djkim | //descriptor.SortDirection = ListSortDirection.Ascending; |
441 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Add(descriptor); |
442 | a36a37c3 | humkyung | /// up to here |
443 | 787a4489 | KangIngu | } |
444 | } |
||
445 | |||
446 | ac4f1e13 | taeseongkim | private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
447 | 787a4489 | KangIngu | { |
448 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
449 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
450 | //{ |
||
451 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
452 | //} |
||
453 | |||
454 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
455 | { |
||
456 | ViewerDataModel.Instance.PageNumber = 1; |
||
457 | } |
||
458 | if (e.AddedItems.Count() > 0) |
||
459 | { |
||
460 | foreach (var item in gridSelectionItem) |
||
461 | { |
||
462 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
463 | //{ |
||
464 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
465 | //}); |
||
466 | ac4f1e13 | taeseongkim | |
467 | var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList(); |
||
468 | |||
469 | foreach (var markupitem in pageItems) |
||
470 | 787a4489 | KangIngu | { |
471 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
472 | } |
||
473 | 787a4489 | KangIngu | } |
474 | } |
||
475 | else if (e.RemovedItems.Count > 0) |
||
476 | { |
||
477 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
478 | |||
479 | (from A in _infoItem |
||
480 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
481 | where A.MarkupInfoID == B.MarkupInfoID |
||
482 | select B).ToList().ForEach(data => |
||
483 | { |
||
484 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
485 | }); |
||
486 | } |
||
487 | } |
||
488 | e7dd7ae8 | humkyung | |
489 | /// <summary> |
||
490 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
491 | /// </summary> |
||
492 | /// <param name="sender"></param> |
||
493 | /// <param name="e"></param> |
||
494 | ac4f1e13 | taeseongkim | private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
495 | 787a4489 | KangIngu | { |
496 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
497 | |||
498 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
499 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
500 | var resultA = (from item_Select in dataSet |
||
501 | from item_Non in dataSet_User |
||
502 | where item_Select == item_Non |
||
503 | select item_Non).ToList(); |
||
504 | |||
505 | if (resultA.Count() >= 2) |
||
506 | { |
||
507 | eeb0a39c | taeseongkim | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
508 | 787a4489 | KangIngu | RadWindow.Confirm(new DialogParameters |
509 | { |
||
510 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
511 | eeb0a39c | taeseongkim | Header = "Info", |
512 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
513 | 787a4489 | KangIngu | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
514 | { |
||
515 | if (e.AddedItems.Count() == 1) |
||
516 | { |
||
517 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
518 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
519 | 787a4489 | KangIngu | |
520 | 8ab0d0b1 | 송근호 | |
521 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
522 | { |
||
523 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
524 | { |
||
525 | gridViewMarkup.SelectedItem = instanceItem; |
||
526 | } |
||
527 | else |
||
528 | { |
||
529 | //1. Consolidations이 있다면 하나 선택 |
||
530 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
531 | |||
532 | if (Consolidations.Count() > 0) |
||
533 | { |
||
534 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
535 | } |
||
536 | } |
||
537 | |||
538 | 787a4489 | KangIngu | } |
539 | 8ab0d0b1 | 송근호 | else { |
540 | //1. Consolidations 아닌게 있다면 Change |
||
541 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
542 | |||
543 | if(notConsolidations.Count() > 0) { |
||
544 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
545 | } |
||
546 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
547 | gridViewMarkup.SelectedItem = instanceItem; |
||
548 | } |
||
549 | |||
550 | 787a4489 | KangIngu | } |
551 | } |
||
552 | }), |
||
553 | Theme = new Windows8Theme(), |
||
554 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
555 | }); |
||
556 | } |
||
557 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
558 | { |
||
559 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
560 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
561 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
562 | #region 코멘트 보기 |
||
563 | if (e.AddedItems.Count() > 0) |
||
564 | { |
||
565 | foreach (var item in gridSelectionItem) |
||
566 | { |
||
567 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
568 | 6b5d33c6 | djkim | { |
569 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
570 | if (controls.Count == 0) |
||
571 | 6b5d33c6 | djkim | { |
572 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
573 | ac4f1e13 | taeseongkim | |
574 | 6b5d33c6 | djkim | foreach (var markup in instance) |
575 | { |
||
576 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
577 | 661b7416 | humkyung | item.MarkupInfoID, markup.ID); |
578 | 6b5d33c6 | djkim | } |
579 | } |
||
580 | 101da246 | humkyung | |
581 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
582 | foreach (var control in controls) |
||
583 | 6b5d33c6 | djkim | { |
584 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
585 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
586 | 6b5d33c6 | djkim | } |
587 | } |
||
588 | 3ffd4b2d | humkyung | else |
589 | 6b5d33c6 | djkim | { |
590 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
591 | if (controls.Count == 0) |
||
592 | { |
||
593 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
594 | 101da246 | humkyung | foreach (var markup in instance) |
595 | { |
||
596 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", |
597 | 101da246 | humkyung | item.MarkupInfoID, markup.ID); |
598 | } |
||
599 | } |
||
600 | |||
601 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
602 | foreach (var control in controls) |
||
603 | 6b5d33c6 | djkim | { |
604 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
605 | 6b5d33c6 | djkim | } |
606 | } |
||
607 | } |
||
608 | } |
||
609 | #endregion |
||
610 | #region 코멘트 숨기기 |
||
611 | else if (e.RemovedItems.Count > 0) |
||
612 | { |
||
613 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
614 | |||
615 | (from A in _infoItem |
||
616 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
617 | where A.MarkupInfoID == B.MarkupInfoID |
||
618 | select B).ToList().ForEach(data => |
||
619 | { |
||
620 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
621 | 6b5d33c6 | djkim | }); |
622 | |||
623 | b5ac6d6e | ljiyeon | |
624 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
625 | if (myComment != null) |
||
626 | { |
||
627 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
628 | { |
||
629 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
630 | 6b5d33c6 | djkim | }); |
631 | } |
||
632 | } |
||
633 | #endregion |
||
634 | 787a4489 | KangIngu | } |
635 | } |
||
636 | |||
637 | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
||
638 | { |
||
639 | 0f065e57 | ljiyeon | Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
640 | |||
641 | 787a4489 | KangIngu | if (e.Result != null) |
642 | { |
||
643 | _DocItem = e.Result; |
||
644 | |||
645 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
646 | { |
||
647 | //장원 |
||
648 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
649 | } |
||
650 | 29010418 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
651 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
652 | } |
||
653 | else |
||
654 | { |
||
655 | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
||
656 | { |
||
657 | 0f065e57 | ljiyeon | Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
658 | |||
659 | 787a4489 | KangIngu | if (ea.Error == null) |
660 | { |
||
661 | if (ea.Result) |
||
662 | { |
||
663 | this._ViewInfo.isAdmin = true; |
||
664 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
665 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
666 | } |
||
667 | else |
||
668 | { |
||
669 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
670 | 503cb09e | taeseongkim | DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info"); |
671 | 787a4489 | KangIngu | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
672 | } |
||
673 | |||
674 | } |
||
675 | else |
||
676 | { |
||
677 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
678 | } |
||
679 | }; |
||
680 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
681 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
682 | } |
||
683 | } |
||
684 | |||
685 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
686 | { |
||
687 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
688 | |||
689 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
690 | { |
||
691 | App.SystemInfo = e.Result; |
||
692 | |||
693 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
694 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
695 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
696 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
697 | |||
698 | //if (App.urlHost.Contains("localhost")) |
||
699 | //{ |
||
700 | // App.urlHost = App.urlHost_DB; |
||
701 | //} |
||
702 | } |
||
703 | } |
||
704 | |||
705 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
706 | { |
||
707 | 84c48033 | djkim | |
708 | 0f065e57 | ljiyeon | Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
709 | 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
710 | 53880c83 | ljiyeon | if (e.Error == null && e.Result == true) |
711 | 787a4489 | KangIngu | { |
712 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1); |
713 | |||
714 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
715 | |||
716 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
717 | 787a4489 | KangIngu | { |
718 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1); |
719 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
720 | if (userData != null) |
||
721 | 787a4489 | KangIngu | { |
722 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
723 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
724 | 787a4489 | KangIngu | } |
725 | 6c781c0c | djkim | else |
726 | { |
||
727 | userData = new MEMBER(); |
||
728 | userData.DEPARTMENT = "ALL"; |
||
729 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
730 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
731 | 29010418 | ljiyeon | } |
732 | 787a4489 | KangIngu | } |
733 | } |
||
734 | else |
||
735 | { |
||
736 | 84c48033 | djkim | |
737 | DialogMessage_Alert(failedmsg, "Warning"); |
||
738 | 787a4489 | KangIngu | } |
739 | } |
||
740 | 29010418 | ljiyeon | |
741 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
742 | 5a6493ad | humkyung | { |
743 | 787a4489 | KangIngu | this._ViewInfo = info; |
744 | 5a6493ad | humkyung | try |
745 | 5ded1e5a | djkim | { |
746 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
747 | /// 다른 Site를 대비하여 에러 처리함 |
||
748 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
749 | if (!string.IsNullOrEmpty(docid)) |
||
750 | { |
||
751 | this._ViewInfo.DocumentItemID = docid; |
||
752 | } |
||
753 | 5ded1e5a | djkim | } |
754 | 5a6493ad | humkyung | catch(Exception ex) |
755 | { |
||
756 | App.FileLogger.Fatal(ex); |
||
757 | } |
||
758 | |||
759 | 5ded1e5a | djkim | Logger.sendReqLog("GetSystemDataAsync", "", 1); |
760 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
761 | 787a4489 | KangIngu | } |
762 | |||
763 | 992a98b4 | KangIngu | public void HubSet() |
764 | { |
||
765 | // 허브 연결 구성 |
||
766 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
767 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
768 | |||
769 | |||
770 | // 허브 연결 |
||
771 | hubConnection.Start().ContinueWith(task => |
||
772 | { |
||
773 | if (task.IsFaulted) |
||
774 | { |
||
775 | Console.WriteLine("There was an error opening the connection:{0}", |
||
776 | task.Exception.GetBaseException()); |
||
777 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
778 | 992a98b4 | KangIngu | } |
779 | else |
||
780 | { |
||
781 | Console.WriteLine("Connected :: " + task.Id); |
||
782 | } |
||
783 | |||
784 | }).Wait(); |
||
785 | |||
786 | |||
787 | // [ 프로그램 시작 ] |
||
788 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
789 | //( "method name", arg1, arg2 ) |
||
790 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
791 | //{ |
||
792 | // if (task.IsFaulted) |
||
793 | // { |
||
794 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
795 | // } |
||
796 | // else |
||
797 | // { |
||
798 | // Console.WriteLine(task.Result); |
||
799 | // } |
||
800 | //}); |
||
801 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
802 | 992a98b4 | KangIngu | { |
803 | if (task.IsFaulted) |
||
804 | { |
||
805 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
806 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
807 | 992a98b4 | KangIngu | } |
808 | else |
||
809 | { |
||
810 | 29010418 | ljiyeon | switch (task.Result) |
811 | 992a98b4 | KangIngu | { |
812 | 53393bae | KangIngu | case "2": |
813 | { |
||
814 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
815 | if (result == MessageBoxResult.OK) |
||
816 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
817 | 53393bae | KangIngu | } |
818 | break; |
||
819 | case "404": |
||
820 | { |
||
821 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
822 | if(result == MessageBoxResult.OK) |
||
823 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
824 | 53393bae | KangIngu | } |
825 | break; |
||
826 | 992a98b4 | KangIngu | } |
827 | } |
||
828 | 53f96e00 | 송근호 | }); |
829 | 992a98b4 | KangIngu | |
830 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
831 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
832 | //{ |
||
833 | |||
834 | // if (status) |
||
835 | // { |
||
836 | // // 프로그램 시작 |
||
837 | // Console.WriteLine("connection status : " + status); |
||
838 | // } |
||
839 | // else |
||
840 | // { |
||
841 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
842 | // hubConnection.Stop(); |
||
843 | // } |
||
844 | //}); |
||
845 | |||
846 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
847 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
848 | Console.WriteLine("Noficiation Message : " + msg) |
||
849 | ); |
||
850 | |||
851 | |||
852 | // 서버 메서드 호출 |
||
853 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
854 | |||
855 | //Console.ReadKey(); |
||
856 | |||
857 | //hubConnection.Stop(); |
||
858 | } |
||
859 | 787a4489 | KangIngu | |
860 | ac4f1e13 | taeseongkim | public async void MarkupUserListDisplay() |
861 | 1f1c566e | djkim | { |
862 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
863 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
864 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
865 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
866 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
867 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
868 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
869 | //{ |
||
870 | // if (item.UserID == App.ViewInfo.UserID) |
||
871 | // { |
||
872 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
873 | f714bef8 | djkim | // { |
874 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
875 | // }); |
||
876 | // } |
||
877 | // else |
||
878 | // { |
||
879 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
880 | // { |
||
881 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
882 | // }); |
||
883 | // } |
||
884 | //} |
||
885 | 29010418 | ljiyeon | (from A in gridSelectionItem |
886 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
887 | where A.MarkupInfoID == B.MarkupInfoID |
||
888 | select B).ToList().ForEach(data => |
||
889 | { |
||
890 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
891 | }); |
||
892 | 1f1c566e | djkim | (from A in gridSelectionItem |
893 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
894 | where A.MarkupInfoID == B.MarkupInfoID |
||
895 | select B).ToList().ForEach(data => |
||
896 | { |
||
897 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
898 | }); |
||
899 | |||
900 | foreach (var item in gridSelectionItem) |
||
901 | { |
||
902 | ac4f1e13 | taeseongkim | |
903 | 1f1c566e | djkim | if (item.UserID == App.ViewInfo.UserID) |
904 | { |
||
905 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
906 | |||
907 | foreach (var markupitem in markupItems) |
||
908 | 1f1c566e | djkim | { |
909 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
910 | item.MarkupInfoID, markupitem.ID); |
||
911 | } |
||
912 | 1f1c566e | djkim | } |
913 | else |
||
914 | { |
||
915 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
916 | |||
917 | foreach (var markupitem in markupItems) |
||
918 | 1f1c566e | djkim | { |
919 | ac4f1e13 | taeseongkim | await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
920 | } |
||
921 | 1f1c566e | djkim | } |
922 | } |
||
923 | } |
||
924 | 787a4489 | KangIngu | } |
925 | } |