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