markus / KCOM / Services / BaseServices.cs @ 5a223b60
이력 | 보기 | 이력해설 | 다운로드 (68.3 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 System; |
||
8 | using System.Collections.Generic; |
||
9 | using System.Collections.ObjectModel; |
||
10 | using System.ComponentModel; |
||
11 | using System.Linq; |
||
12 | using System.Runtime.CompilerServices; |
||
13 | using System.Text; |
||
14 | using System.Windows; |
||
15 | using System.Windows.Controls; |
||
16 | using Telerik.Windows.Controls; |
||
17 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
18 | fddb48f7 | ljiyeon | using Telerik.Windows.Data; |
19 | 90a0bfa9 | djkim | using System.Web; |
20 | 3b938959 | taeseongkim | using System.ServiceModel.Security; |
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 | 5c64268e | taeseongkim | public KcomService.ServiceDeepViewClient BaseTaskClient |
29 | { |
||
30 | 3b938959 | taeseongkim | get { |
31 | var service = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); |
||
32 | return service; |
||
33 | } |
||
34 | 5c64268e | taeseongkim | } |
35 | |||
36 | 787a4489 | KangIngu | public ViewInfo _ViewInfo; |
37 | public DOCINFO _DocInfo; |
||
38 | public DOCUMENT_ITEM _DocItem; |
||
39 | public MEMBER userData; |
||
40 | be72bfd6 | taeseongkim | public List<int> MarkupSortList = new List<int>(); |
41 | 787a4489 | KangIngu | |
42 | public event PropertyChangedEventHandler PropertyChanged; |
||
43 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
44 | { |
||
45 | if (PropertyChanged != null) |
||
46 | { |
||
47 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
52 | public Common.DocumentSet CurrentDoc |
||
53 | { |
||
54 | get |
||
55 | { |
||
56 | return _CurrentDoc; |
||
57 | } |
||
58 | set |
||
59 | { |
||
60 | if (value != CurrentDoc) |
||
61 | { |
||
62 | _CurrentDoc = value; |
||
63 | NotifyPropertyChanged(); |
||
64 | } |
||
65 | } |
||
66 | } |
||
67 | public void ServiceOn() |
||
68 | { |
||
69 | 5c64268e | taeseongkim | //BaseTaskClient = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); |
70 | 29010418 | ljiyeon | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
71 | |||
72 | 787a4489 | KangIngu | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
73 | 0f065e57 | ljiyeon | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
74 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
75 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
76 | 29010418 | ljiyeon | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
77 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
78 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
79 | 787a4489 | KangIngu | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
80 | 29010418 | ljiyeon | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
81 | BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted; |
||
82 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
83 | BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted; |
||
84 | BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted; |
||
85 | 992a98b4 | KangIngu | } |
86 | |||
87 | private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e) |
||
88 | { |
||
89 | 664ea2e1 | taeseongkim | //Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
90 | 0f065e57 | ljiyeon | |
91 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
92 | 992a98b4 | KangIngu | { |
93 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
94 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
95 | } |
||
96 | else |
||
97 | { |
||
98 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e) |
||
103 | { |
||
104 | 664ea2e1 | taeseongkim | //Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
105 | 0f065e57 | ljiyeon | |
106 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
107 | 992a98b4 | KangIngu | { |
108 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
109 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
110 | } |
||
111 | else |
||
112 | { |
||
113 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
114 | } |
||
115 | 787a4489 | KangIngu | } |
116 | |||
117 | 9294fed6 | humkyung | /// <summary> |
118 | /// Compare 결과를 받아 화면에 표시한다 |
||
119 | /// </summary> |
||
120 | /// <param name="sender"></param> |
||
121 | /// <param name="e"></param> |
||
122 | 787a4489 | KangIngu | private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e) |
123 | { |
||
124 | if (e.Error != null || e.Result == null) |
||
125 | { |
||
126 | 9294fed6 | humkyung | if (e.Error != null) |
127 | { |
||
128 | DialogMessage_Alert(e.Error.ToString(), "Error"); |
||
129 | } |
||
130 | else |
||
131 | { |
||
132 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
133 | } |
||
134 | 787a4489 | KangIngu | } |
135 | else |
||
136 | { |
||
137 | e.Result.ForEach(d => |
||
138 | { |
||
139 | 43d2041c | taeseongkim | d.Width = d.Width; |
140 | d.Height = d.Height; |
||
141 | 787a4489 | KangIngu | var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d); |
142 | a1142a6b | taeseongkim | System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle(); |
143 | 752b18ef | taeseongkim | myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 215, 119)); |
144 | myEllipse.Opacity = 1; |
||
145 | 787a4489 | KangIngu | myEllipse.Width = d.Width; |
146 | myEllipse.Height = d.Height; |
||
147 | Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0)); |
||
148 | Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0)); |
||
149 | myEllipse.RenderTransformOrigin = point; |
||
150 | canvas_compareBorder.Children.Add(myEllipse); |
||
151 | }); |
||
152 | 43d2041c | taeseongkim | canvas_compareBorder.Visibility = Visibility.Visible; |
153 | 752b18ef | taeseongkim | da.From = 1; |
154 | da.To = 0.5; |
||
155 | 787a4489 | KangIngu | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
156 | da.AutoReverse = true; |
||
157 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
158 | } |
||
159 | } |
||
160 | |||
161 | 58dd9e89 | humkyung | /// <summary> |
162 | /// FinalPDF를 수행 후 관련 메시지를 표시한다. |
||
163 | /// </summary> |
||
164 | /// <param name="sender"></param> |
||
165 | /// <param name="e"></param> |
||
166 | 787a4489 | KangIngu | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
167 | { |
||
168 | 29010418 | ljiyeon | if (e.Error != null || e.Result.Status == FinalStatus.Error) |
169 | 787a4489 | KangIngu | { |
170 | 58dd9e89 | humkyung | string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", $"최종 파일을 만드는데 문제가 발생하였습니다{System.Environment.NewLine}{e.Result.Exception}"); |
171 | 84c48033 | djkim | DialogMessage_Alert(errormsg, "안내"); |
172 | 787a4489 | KangIngu | } |
173 | else |
||
174 | { |
||
175 | 58dd9e89 | humkyung | string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요"); |
176 | 84c48033 | djkim | DialogMessage_Alert(successmsg, "안내"); |
177 | 787a4489 | KangIngu | } |
178 | } |
||
179 | |||
180 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
181 | { |
||
182 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
183 | 0f065e57 | ljiyeon | |
184 | 787a4489 | KangIngu | if (e.Result != null && e.Error == null) |
185 | { |
||
186 | 90a0bfa9 | djkim | List<VPRevision> list = e.Result; |
187 | foreach (var item in list) |
||
188 | { |
||
189 | 24ac2a04 | taeseongkim | |
190 | if (App.isExternal) |
||
191 | { |
||
192 | f35c95d8 | taeseongkim | var sBaseServiceURL = CommonLib.Common.GetConfigString("ExternalOriginalFileUrl", "URL", "", App.isExternal); |
193 | 24ac2a04 | taeseongkim | |
194 | db545833 | taeseongkim | if (!string.IsNullOrWhiteSpace(item.TO_VENDOR)) |
195 | { |
||
196 | var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR)); |
||
197 | item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}"; |
||
198 | } |
||
199 | |||
200 | if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR)) |
||
201 | { |
||
202 | var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR)); |
||
203 | item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}"; |
||
204 | } |
||
205 | 24ac2a04 | taeseongkim | } |
206 | else |
||
207 | { |
||
208 | 38d69491 | taeseongkim | item.TO_VENDOR = HttpUtility.UrlDecode(item.TO_VENDOR); |
209 | 24ac2a04 | taeseongkim | item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR); |
210 | 38d69491 | taeseongkim | item.EnsembleLink = HttpUtility.UrlDecode(item.EnsembleLink); |
211 | 24ac2a04 | taeseongkim | } |
212 | 90a0bfa9 | djkim | } |
213 | f0c9e80e | 이지연 | //int result; |
214 | //bool iCheck = true; |
||
215 | //foreach (var li in list) |
||
216 | //{ |
||
217 | // iCheck = int.TryParse(li.GroupNo, out result); |
||
218 | // if (!iCheck) |
||
219 | // break; |
||
220 | //} |
||
221 | //if(iCheck) |
||
222 | gridViewHistory.ItemsSource = list.OrderByDescending(x => x.GroupNo); //20240611 LJY string 인거 전달드림 slip no 내림차순으로 그냥 해달라고 요청 |
||
223 | //else |
||
224 | // gridViewHistory.ItemsSource = list.OrderByDescending(x => x.RevNo); |
||
225 | 6c45db59 | taeseongkim | |
226 | 787a4489 | KangIngu | } |
227 | f9fb5500 | ljiyeon | //TempFile.TempLoad(); |
228 | 787a4489 | KangIngu | } |
229 | |||
230 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
231 | { |
||
232 | 664ea2e1 | taeseongkim | //Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
233 | 0f065e57 | ljiyeon | |
234 | d128ceb2 | humkyung | foreach(var info in ViewerDataModel.Instance._markupInfoList) |
235 | { |
||
236 | if(info.UserID == App.ViewInfo.UserID) |
||
237 | { |
||
238 | info.userDelete = true; |
||
239 | cf1cc862 | taeseongkim | info.DisplayColor = "#FFFF0000"; |
240 | d128ceb2 | humkyung | } |
241 | else |
||
242 | { |
||
243 | info.userDelete = false; |
||
244 | } |
||
245 | } |
||
246 | 787a4489 | KangIngu | } |
247 | |||
248 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
249 | { |
||
250 | 0585d5cc | taeseongkim | if (e.Error == null) |
251 | { |
||
252 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
253 | 0585d5cc | taeseongkim | } |
254 | else |
||
255 | { |
||
256 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDeptDataCompleted", "\r Error :" + e.Error, 1); |
257 | 0585d5cc | taeseongkim | } |
258 | 0f065e57 | ljiyeon | |
259 | 787a4489 | KangIngu | if (e.Result != null) |
260 | { |
||
261 | e.Result.Sort(); |
||
262 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
263 | } |
||
264 | } |
||
265 | 0585d5cc | taeseongkim | |
266 | f258d884 | humkyung | /// <summary> |
267 | /// ??? |
||
268 | /// </summary> |
||
269 | 29010418 | ljiyeon | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
270 | 787a4489 | KangIngu | |
271 | 35a96e24 | humkyung | /// <summary> |
272 | d62c0439 | humkyung | /// 문서 정보를 가져온다 |
273 | /// </summary> |
||
274 | /// <param name="sender"></param> |
||
275 | /// <param name="e"></param> |
||
276 | eeb0a39c | taeseongkim | private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
277 | d62c0439 | humkyung | { |
278 | 664ea2e1 | taeseongkim | ////Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
279 | d62c0439 | humkyung | |
280 | if (e.Error != null) |
||
281 | { |
||
282 | 503cb09e | taeseongkim | DialogMessage_Alert("The page cannot be displayed.", "Alert"); |
283 | d62c0439 | humkyung | } |
284 | 5aa6a59a | taeseongkim | else if (e.Result == null) |
285 | d62c0439 | humkyung | { |
286 | cdb2c0a2 | taeseongkim | DialogMessage_Alert("Document information is missing.", "Alert"); |
287 | d62c0439 | humkyung | } |
288 | cdb2c0a2 | taeseongkim | else |
289 | d62c0439 | humkyung | { |
290 | fdfa126d | taeseongkim | string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt64(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID); |
291 | 45ac2822 | taeseongkim | |
292 | /// 화면의 좌측 Thumbnail의 주소 |
||
293 | cdb2c0a2 | taeseongkim | var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png", "jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}"); |
294 | _DocInfo = e.Result; |
||
295 | _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE); |
||
296 | foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER)) |
||
297 | { |
||
298 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
299 | } |
||
300 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
301 | cdb2c0a2 | taeseongkim | CurrentDoc = new Common.DocumentSet |
302 | { |
||
303 | docInfo = _DocInfo, |
||
304 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
305 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
306 | 0585d5cc | taeseongkim | |
307 | cdb2c0a2 | taeseongkim | Document_NO = _DocItem?.DOCUMENT_NO, |
308 | File_Result = _DocItem?.RESULT_FILE, |
||
309 | Group_No = _DocItem?.GROUP_NO, |
||
310 | 26ec6226 | taeseongkim | ProjectNo = _DocItem?.PROJECT_NO, |
311 | cdb2c0a2 | taeseongkim | Revision = _DocItem?.REVISION, |
312 | }; |
||
313 | 0585d5cc | taeseongkim | |
314 | cdb2c0a2 | taeseongkim | var instanceMain = this.ParentOfType<MainWindow>(); |
315 | string firstpage = "1"; |
||
316 | string lastpage = _DocInfo.PAGE_COUNT.ToString(); |
||
317 | instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage; |
||
318 | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage; |
||
319 | a1e2ba68 | taeseongkim | App.MarkusVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
320 | |||
321 | string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem?.DOCUMENT_NO, _DocItem?.REVISION, App.MarkusVersion); |
||
322 | d33ef543 | taeseongkim | |
323 | cdb2c0a2 | taeseongkim | instanceMain.Title = apptitle; |
324 | eeb0a39c | taeseongkim | |
325 | cdb2c0a2 | taeseongkim | #region 페이지 이미지를 로컬에 저장 |
326 | string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName()); |
||
327 | eeb0a39c | taeseongkim | |
328 | cdb2c0a2 | taeseongkim | //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문 |
329 | eeb0a39c | taeseongkim | |
330 | cdb2c0a2 | taeseongkim | #endregion |
331 | eeb0a39c | taeseongkim | |
332 | 6a19b48d | taeseongkim | App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, "png", _DocInfo.PAGE_COUNT, 1); |
333 | 77cdac33 | taeseongkim | |
334 | 2007ecaa | taeseongkim | //App.SamplePageStorage = new PageManager.PageStorage(MainUrl.Replace("png", "jpg"), tempStoragePath, "jpg", _DocInfo.PAGE_COUNT); |
335 | cdb2c0a2 | taeseongkim | await this.pageNavigator.SetPageNaviAsync(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
336 | } |
||
337 | 54a28343 | taeseongkim | } |
338 | d62c0439 | humkyung | |
339 | 3b81b385 | taeseongkim | private void pageNavigator_ThumbInitialized(object sender,EventArgs e) |
340 | 54a28343 | taeseongkim | { |
341 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
342 | d62c0439 | humkyung | |
343 | 54a28343 | taeseongkim | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
344 | d62c0439 | humkyung | //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
345 | |||
346 | 9d5b4bc2 | taeseongkim | /// 기존 임시파일 정리 |
347 | 6af42ff0 | taeseongkim | #region 단어 검색용 파일 다운로드 |
348 | 9d5b4bc2 | taeseongkim | |
349 | 2007ecaa | taeseongkim | DownloadOriginalFile(); |
350 | 6af42ff0 | taeseongkim | |
351 | #endregion |
||
352 | |||
353 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1); |
354 | 6af42ff0 | taeseongkim | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
355 | |||
356 | d62c0439 | humkyung | } |
357 | |||
358 | 54a28343 | taeseongkim | |
359 | d62c0439 | humkyung | /// <summary> |
360 | 35a96e24 | humkyung | /// get markupinfo and markupitem from database |
361 | a36a37c3 | humkyung | /// - 1. called when document is loaded |
362 | /// - 2. called when user do consolidation |
||
363 | 35a96e24 | humkyung | /// </summary> |
364 | /// <param name="sender"></param> |
||
365 | /// <param name="e"></param> |
||
366 | 787a4489 | KangIngu | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
367 | { |
||
368 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
369 | 0f065e57 | ljiyeon | |
370 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
371 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
372 | be72bfd6 | taeseongkim | |
373 | 274cde11 | taeseongkim | try |
374 | 787a4489 | KangIngu | { |
375 | |||
376 | 274cde11 | taeseongkim | if (e.Result != null) |
377 | d128ceb2 | humkyung | { |
378 | 274cde11 | taeseongkim | ViewerDataModel.Instance._markupInfoList.Clear(); |
379 | b2d0f316 | humkyung | if (e.Result.Any()) ViewerDataModel.Instance.MyMarkupList.Clear(); |
380 | be72bfd6 | taeseongkim | |
381 | 274cde11 | taeseongkim | foreach (var info in e.Result) |
382 | d128ceb2 | humkyung | { |
383 | 274cde11 | taeseongkim | if (info.Depatment == null) info.Depatment = "Unknown"; |
384 | be72bfd6 | taeseongkim | |
385 | ecf8a079 | 이지연 | else if (info.UserID == App.ViewInfo.UserID) |
386 | 274cde11 | taeseongkim | { |
387 | ecf8a079 | 이지연 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) //조회모드는 delete 버튼 모두 비활성화 |
388 | { |
||
389 | info.userDelete = false; |
||
390 | } |
||
391 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1).Count() > 0) //Team Consolidation Mode이고 Team Consolidation Layer가 있을 경우 |
||
392 | { |
||
393 | if(App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1 && x.MarkupInfoID == info.MarkupInfoID).Count() > 0) |
||
394 | info.userDelete = true; |
||
395 | } |
||
396 | else if(App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) //Consolidation Mode 일 때는 해당 Comment Layer의 Status가 Avoid or Consolidation인 것만 Delete 버튼 활성화 |
||
397 | { |
||
398 | if(info.AvoidConsolidate == 1 || info.Consolidate == 1) |
||
399 | info.userDelete = true; |
||
400 | } |
||
401 | else |
||
402 | { |
||
403 | info.userDelete = true; |
||
404 | } |
||
405 | 274cde11 | taeseongkim | info.DisplayColor = "#FFFF0000"; |
406 | } |
||
407 | else |
||
408 | { |
||
409 | info.userDelete = false; |
||
410 | } |
||
411 | d128ceb2 | humkyung | |
412 | 274cde11 | taeseongkim | ViewerDataModel.Instance._markupInfoList.Add(info); |
413 | } |
||
414 | 8e5a4a6a | taeseongkim | |
415 | 274cde11 | taeseongkim | var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f => new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName }); |
416 | 8e5a4a6a | taeseongkim | |
417 | 274cde11 | taeseongkim | userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x)); |
418 | |||
419 | e.Result.ToList().ForEach(d => |
||
420 | 787a4489 | KangIngu | { |
421 | 274cde11 | taeseongkim | if (d.MarkupList != null) |
422 | 787a4489 | KangIngu | { |
423 | 274cde11 | taeseongkim | d.MarkupList.ForEach(p => |
424 | 0585d5cc | taeseongkim | { |
425 | 274cde11 | taeseongkim | if (d.UserID == App.ViewInfo.UserID) |
426 | 0585d5cc | taeseongkim | { |
427 | ecf8a079 | 이지연 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) //조회모드는 delete 버튼 모두 비활성화 |
428 | { |
||
429 | d.userDelete = false; |
||
430 | } |
||
431 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1).Count() > 0)//Team Consolidation Mode이고 Team Consolidation Layer가 있을 경우 |
||
432 | { |
||
433 | if (App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1 && x.MarkupInfoID == d.MarkupInfoID).Count() > 0) |
||
434 | d.userDelete = true; |
||
435 | } |
||
436 | else if (App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) //Consolidation Mode 일 때는 해당 Comment Layer의 Status가 Avoid or Consolidation인 것만 Delete 버튼 활성화 |
||
437 | { |
||
438 | if (d.AvoidConsolidate == 1 || d.Consolidate == 1) |
||
439 | d.userDelete = true; |
||
440 | } |
||
441 | else |
||
442 | { |
||
443 | d.userDelete = true; |
||
444 | } |
||
445 | 274cde11 | taeseongkim | d.DisplayColor = "#FFFF0000"; |
446 | MarkupItemEx markup = new MarkupItemEx |
||
447 | { |
||
448 | Data = p.Data, |
||
449 | Data_Type = p.Data_Type, |
||
450 | ID = p.ID, |
||
451 | IsUpdate = false, |
||
452 | MarkupInfoID = d.MarkupInfoID, |
||
453 | PageNumber = p.PageNumber, |
||
454 | Symbol_ID = p.Symbol_ID, |
||
455 | //Group_ID = p.Group_ID |
||
456 | }; |
||
457 | ViewerDataModel.Instance.MyMarkupList.Add(markup); |
||
458 | } |
||
459 | else |
||
460 | 0585d5cc | taeseongkim | { |
461 | 274cde11 | taeseongkim | MarkupItemEx markup = new MarkupItemEx |
462 | { |
||
463 | Data = p.Data, |
||
464 | Data_Type = p.Data_Type, |
||
465 | ID = p.ID, |
||
466 | IsUpdate = false, |
||
467 | MarkupInfoID = d.MarkupInfoID, |
||
468 | PageNumber = p.PageNumber, |
||
469 | Symbol_ID = p.Symbol_ID, |
||
470 | //Group_ID = p.Group_ID |
||
471 | }; |
||
472 | ViewerDataModel.Instance.MarkupList_Pre.Add(markup); |
||
473 | } |
||
474 | }); |
||
475 | } |
||
476 | }); |
||
477 | 787a4489 | KangIngu | |
478 | f258d884 | humkyung | var currentUser = e.Result.Find(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0); |
479 | 274cde11 | taeseongkim | if (currentUser == null) |
480 | 27cf69cd | taeseongkim | { |
481 | 274cde11 | taeseongkim | /// create a new markupinfo to do comments |
482 | if (App.ViewInfo.NewCommentPermission) |
||
483 | 27cf69cd | taeseongkim | { |
484 | 5a223b60 | humkyung | var infoId = Commons.ShortGuid(); |
485 | 274cde11 | taeseongkim | PreviewUserMarkupInfoItem = new MarkupInfoItem |
486 | { |
||
487 | CreateTime = DateTime.Now, |
||
488 | UpdateTime = DateTime.Now, |
||
489 | Depatment = userData.DEPARTMENT, |
||
490 | DisplayColor = "#FFFF0000", |
||
491 | UserID = userData.ID, |
||
492 | UserName = userData.NAME, |
||
493 | PageCount = 1, |
||
494 | Description = "", |
||
495 | MarkupInfoID = infoId, |
||
496 | MarkupList = null, |
||
497 | 5a223b60 | humkyung | MarkupVersionID = Commons.ShortGuid(), |
498 | 274cde11 | taeseongkim | Consolidate = 0, |
499 | PartConsolidate = 0, |
||
500 | userDelete = true, |
||
501 | AvoidConsolidate = 0, |
||
502 | IsPreviewUser = false |
||
503 | }; |
||
504 | |||
505 | App.Custom_ViewInfoId = infoId; |
||
506 | |||
507 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
508 | } |
||
509 | } |
||
510 | else |
||
511 | { |
||
512 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
513 | 27cf69cd | taeseongkim | } |
514 | 787a4489 | KangIngu | |
515 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
516 | 3ffd4b2d | humkyung | |
517 | 274cde11 | taeseongkim | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
518 | //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
||
519 | be72bfd6 | taeseongkim | |
520 | 274cde11 | taeseongkim | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
521 | 53deabaf | taeseongkim | |
522 | 274cde11 | taeseongkim | SetCommentPages(null); |
523 | 992a98b4 | KangIngu | |
524 | 274cde11 | taeseongkim | // GRIDVIEW에서 팀별 GROUPING |
525 | // 효성은 안함 |
||
526 | 1f2348b2 | taeseongkim | #if (Hyosung) |
527 | #else |
||
528 | 274cde11 | taeseongkim | /// create a group descriptor |
529 | gridViewMarkup.GroupDescriptors.Clear(); |
||
530 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
531 | descriptor.Member = "Depatment"; |
||
532 | descriptor.DisplayContent = "DEPT"; |
||
533 | //descriptor.SortDirection = ListSortDirection.Ascending; |
||
534 | gridViewMarkup.GroupDescriptors.Add(descriptor); |
||
535 | 47b95004 | taeseongkim | #endif |
536 | be72bfd6 | taeseongkim | |
537 | 274cde11 | taeseongkim | GridViewMarkup_Sorting(gridViewMarkup, new GridViewSortingEventArgs(gridViewMarkup.Columns[0], SortingState.None, SortingState.None)); |
538 | be72bfd6 | taeseongkim | |
539 | f38ed998 | humkyung | SelectInitialMarkupInfo(); |
540 | 53deabaf | taeseongkim | } |
541 | 787a4489 | KangIngu | } |
542 | 274cde11 | taeseongkim | catch (Exception ex) |
543 | { |
||
544 | App.FileLogger.Fatal(ex); |
||
545 | } |
||
546 | cf1cc862 | taeseongkim | finally |
547 | { |
||
548 | if(!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled) |
||
549 | { |
||
550 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled = true; |
||
551 | } |
||
552 | 6a19b48d | taeseongkim | |
553 | if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled) |
||
554 | { |
||
555 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled = true; |
||
556 | } |
||
557 | cf1cc862 | taeseongkim | } |
558 | 787a4489 | KangIngu | } |
559 | |||
560 | f38ed998 | humkyung | /// <summary> |
561 | /// 프로그램이 로딩되고 난 후 맨처음으로 MarkupInfo를 선택한다. |
||
562 | /// </summary> |
||
563 | private void SelectInitialMarkupInfo() |
||
564 | { |
||
565 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
566 | { |
||
567 | #region Consolidate 항목이 있으면 Consolidate 항목만 추가 |
||
568 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
569 | { |
||
570 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
571 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
572 | } |
||
573 | #endregion |
||
574 | 053f2163 | humkyung | #region Consolidate 항목이 없을 경우에는 사용자 별로 AvoidConsolidate를 제외한 우선 순위가 높은(Team,Comment)항목들을 선택 |
575 | f38ed998 | humkyung | else |
576 | { |
||
577 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
578 | |||
579 | #region Team consolidate 항목 선택 |
||
580 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
581 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
582 | #endregion |
||
583 | |||
584 | #region 추가되지 않은 사용자들을 추가 |
||
585 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
586 | { |
||
587 | Candidates.Add(item); |
||
588 | } |
||
589 | #endregion |
||
590 | |||
591 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
592 | f38ed998 | humkyung | } |
593 | #endregion |
||
594 | } |
||
595 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) /// Eng'r Comment Mode |
||
596 | { |
||
597 | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
||
598 | |||
599 | #region Team consolidate 항목 선택 |
||
600 | 053f2163 | humkyung | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
601 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
602 | f38ed998 | humkyung | #endregion |
603 | |||
604 | #region 추가되지 않은 사용자들을 추가 |
||
605 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
606 | { |
||
607 | Candidates.Add(item); |
||
608 | } |
||
609 | #endregion |
||
610 | |||
611 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
612 | } |
||
613 | 053f2163 | humkyung | else if (App.ViewInfo.CreateFinalPDFPermission) /// Orig Comment Model |
614 | f38ed998 | humkyung | { |
615 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
616 | { |
||
617 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
618 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
619 | } |
||
620 | 053f2163 | humkyung | else if (ViewerDataModel.Instance._markupInfoList.Any(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0)) |
621 | f38ed998 | humkyung | { |
622 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
623 | |||
624 | #region Team consolidate 항목 선택 |
||
625 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
626 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
627 | #endregion |
||
628 | |||
629 | #region 추가되지 않은 사용자들을 추가 |
||
630 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
631 | { |
||
632 | Candidates.Add(item); |
||
633 | } |
||
634 | #endregion |
||
635 | |||
636 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
637 | f38ed998 | humkyung | } |
638 | else |
||
639 | { |
||
640 | 053f2163 | humkyung | var Comments = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 0 && x.AvoidConsolidate == 0).ToList(); |
641 | f38ed998 | humkyung | Comments.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
642 | } |
||
643 | } |
||
644 | |||
645 | if (!gridViewMarkup.SelectedItems.Any()) |
||
646 | { |
||
647 | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
||
648 | |||
649 | if (PreviewUserMarkupInfoItem != null) |
||
650 | { |
||
651 | this.gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
652 | } |
||
653 | else if (SelectedItem != null) |
||
654 | { |
||
655 | this.gridViewMarkup.SelectedItem = SelectedItem; |
||
656 | } |
||
657 | else if (ViewerDataModel.Instance._markupInfoList.Any()) |
||
658 | { |
||
659 | this.gridViewMarkup.SelectedItem = ViewerDataModel.Instance._markupInfoList[0]; |
||
660 | } |
||
661 | } |
||
662 | } |
||
663 | |||
664 | be72bfd6 | taeseongkim | private void GridViewMarkup_Sorting(object sender, GridViewSortingEventArgs e) |
665 | { |
||
666 | IEnumerable<IKCOM.MarkupInfoItem> markuplist = e.DataControl.ItemsSource as IEnumerable<IKCOM.MarkupInfoItem>; |
||
667 | |||
668 | if(markuplist == null) |
||
669 | { |
||
670 | e.Cancel = true; |
||
671 | return; |
||
672 | } |
||
673 | |||
674 | if(e.NewSortingState == SortingState.None) |
||
675 | { |
||
676 | markuplist = markuplist.OrderByDescending(x => SortIndex(x)) |
||
677 | .ThenBy(x => x.Depatment) |
||
678 | .ThenBy(x => x.UserID); |
||
679 | |||
680 | e.DataControl.ItemsSource = markuplist.ToList(); |
||
681 | } |
||
682 | } |
||
683 | |||
684 | |||
685 | // 마크업 리스트 정렬 |
||
686 | private int SortIndex(IKCOM.MarkupInfoItem markupInfoItem) |
||
687 | { |
||
688 | int result = 0; |
||
689 | |||
690 | // Consolidate은 최상단 |
||
691 | if (markupInfoItem.Consolidate == 1) |
||
692 | { |
||
693 | result += 2; |
||
694 | } |
||
695 | |||
696 | /// Consolidate 다음으로 우선순위 |
||
697 | if (markupInfoItem.UserID == App.ViewInfo.UserID) |
||
698 | { |
||
699 | result += 1; |
||
700 | } |
||
701 | |||
702 | return result; |
||
703 | } |
||
704 | |||
705 | |||
706 | private void GridViewMarkup_Sorted(object sender, GridViewSortedEventArgs e) |
||
707 | { |
||
708 | |||
709 | } |
||
710 | |||
711 | ac4f1e13 | taeseongkim | private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
712 | 787a4489 | KangIngu | { |
713 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
714 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
715 | //{ |
||
716 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
717 | //} |
||
718 | |||
719 | 752b18ef | taeseongkim | if (ViewerDataModel.Instance.SyncPageNumber == 0) |
720 | 787a4489 | KangIngu | { |
721 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
722 | 787a4489 | KangIngu | } |
723 | b2d0f316 | humkyung | if (e.AddedItems.Any()) |
724 | 787a4489 | KangIngu | { |
725 | foreach (var item in gridSelectionItem) |
||
726 | { |
||
727 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
728 | //{ |
||
729 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
730 | //}); |
||
731 | ac4f1e13 | taeseongkim | |
732 | 752b18ef | taeseongkim | var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList(); |
733 | ac4f1e13 | taeseongkim | |
734 | foreach (var markupitem in pageItems) |
||
735 | 787a4489 | KangIngu | { |
736 | 58dd9e89 | humkyung | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID, |
737 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
738 | ac4f1e13 | taeseongkim | } |
739 | 787a4489 | KangIngu | } |
740 | } |
||
741 | b2d0f316 | humkyung | else if (e.RemovedItems.Any()) |
742 | 787a4489 | KangIngu | { |
743 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
744 | |||
745 | (from A in _infoItem |
||
746 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
747 | where A.MarkupInfoID == B.MarkupInfoID |
||
748 | select B).ToList().ForEach(data => |
||
749 | { |
||
750 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
751 | }); |
||
752 | } |
||
753 | } |
||
754 | e7dd7ae8 | humkyung | |
755 | /// <summary> |
||
756 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
757 | /// </summary> |
||
758 | /// <param name="sender"></param> |
||
759 | /// <param name="e"></param> |
||
760 | ac4f1e13 | taeseongkim | private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
761 | 787a4489 | KangIngu | { |
762 | 3abe8d4e | taeseongkim | |
763 | foreach (var item in e.AddedItems) |
||
764 | { |
||
765 | var cellToSelect = new GridViewCellInfo(item, this.gridViewMarkup.Columns["color"], this.gridViewMarkup); |
||
766 | |||
767 | if(cellToSelect != null) |
||
768 | { |
||
769 | |||
770 | } |
||
771 | } |
||
772 | |||
773 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
774 | |||
775 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
776 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
777 | var resultA = (from item_Select in dataSet |
||
778 | from item_Non in dataSet_User |
||
779 | where item_Select == item_Non |
||
780 | select item_Non).ToList(); |
||
781 | |||
782 | if (resultA.Count() >= 2) |
||
783 | { |
||
784 | eeb0a39c | taeseongkim | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
785 | 787a4489 | KangIngu | RadWindow.Confirm(new DialogParameters |
786 | { |
||
787 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
788 | eeb0a39c | taeseongkim | Header = "Info", |
789 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
790 | 787a4489 | KangIngu | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
791 | { |
||
792 | 90d1dee0 | swate0609 | if(ea.DialogResult == null) |
793 | { |
||
794 | return; |
||
795 | } |
||
796 | 787a4489 | KangIngu | if (e.AddedItems.Count() == 1) |
797 | { |
||
798 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
799 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
800 | 787a4489 | KangIngu | |
801 | 8ab0d0b1 | 송근호 | |
802 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
803 | { |
||
804 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
805 | { |
||
806 | gridViewMarkup.SelectedItem = instanceItem; |
||
807 | } |
||
808 | else |
||
809 | { |
||
810 | //1. Consolidations이 있다면 하나 선택 |
||
811 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
812 | |||
813 | if (Consolidations.Count() > 0) |
||
814 | { |
||
815 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
816 | } |
||
817 | } |
||
818 | |||
819 | 787a4489 | KangIngu | } |
820 | 8ab0d0b1 | 송근호 | else { |
821 | //1. Consolidations 아닌게 있다면 Change |
||
822 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
823 | |||
824 | if(notConsolidations.Count() > 0) { |
||
825 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
826 | } |
||
827 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
828 | gridViewMarkup.SelectedItem = instanceItem; |
||
829 | } |
||
830 | |||
831 | 787a4489 | KangIngu | } |
832 | } |
||
833 | }), |
||
834 | Theme = new Windows8Theme(), |
||
835 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
836 | }); |
||
837 | } |
||
838 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
839 | { |
||
840 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
841 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
842 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
843 | 47b95004 | taeseongkim | #region 코멘트 보기 |
844 | d18ea2bd | taeseongkim | if (e.AddedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
845 | 6b5d33c6 | djkim | { |
846 | foreach (var item in gridSelectionItem) |
||
847 | { |
||
848 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
849 | 6b5d33c6 | djkim | { |
850 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
851 | if (controls.Count == 0) |
||
852 | 6b5d33c6 | djkim | { |
853 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
854 | ac4f1e13 | taeseongkim | |
855 | 6b5d33c6 | djkim | foreach (var markup in instance) |
856 | { |
||
857 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
858 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents:App.SystemInfo.STAMP_CONTENTS); |
859 | 6b5d33c6 | djkim | } |
860 | } |
||
861 | 101da246 | humkyung | |
862 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
863 | foreach (var control in controls) |
||
864 | 6b5d33c6 | djkim | { |
865 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
866 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
867 | 6b5d33c6 | djkim | } |
868 | } |
||
869 | 3ffd4b2d | humkyung | else |
870 | 6b5d33c6 | djkim | { |
871 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
872 | if (controls.Count == 0) |
||
873 | { |
||
874 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
875 | 101da246 | humkyung | foreach (var markup in instance) |
876 | { |
||
877 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
878 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
879 | 101da246 | humkyung | } |
880 | } |
||
881 | |||
882 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
883 | foreach (var control in controls) |
||
884 | 6b5d33c6 | djkim | { |
885 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
886 | 6b5d33c6 | djkim | } |
887 | } |
||
888 | } |
||
889 | } |
||
890 | 47b95004 | taeseongkim | #endregion |
891 | #region 코멘트 숨기기 |
||
892 | 6b5d33c6 | djkim | else if (e.RemovedItems.Count > 0) |
893 | { |
||
894 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
895 | |||
896 | (from A in _infoItem |
||
897 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
898 | where A.MarkupInfoID == B.MarkupInfoID |
||
899 | select B).ToList().ForEach(data => |
||
900 | { |
||
901 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
902 | 6b5d33c6 | djkim | }); |
903 | |||
904 | b5ac6d6e | ljiyeon | |
905 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
906 | if (myComment != null) |
||
907 | { |
||
908 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
909 | { |
||
910 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
911 | 6b5d33c6 | djkim | }); |
912 | } |
||
913 | } |
||
914 | 47b95004 | taeseongkim | #endregion |
915 | 787a4489 | KangIngu | } |
916 | } |
||
917 | |||
918 | 3abe8d4e | taeseongkim | private async void gridViewMarkup_SelectedCellsChanged(object sender, Telerik.Windows.Controls.GridView.GridViewSelectedCellsChangedEventArgs e) |
919 | { |
||
920 | if (e.AddedCells.Count() > 0) |
||
921 | { |
||
922 | if(e.AddedCells[0].Column.Name == "color") |
||
923 | { |
||
924 | |||
925 | } |
||
926 | else |
||
927 | { |
||
928 | List<MarkupInfoItem> removeItems = new List<MarkupInfoItem>(); |
||
929 | |||
930 | if (!gridViewMarkup.SelectedItems.Contains(e.AddedCells[0].Item)) |
||
931 | { |
||
932 | gridViewMarkup.SelectedItems.Add(e.AddedCells[0].Item); |
||
933 | } |
||
934 | else |
||
935 | { |
||
936 | gridViewMarkup.Unselect(new[] { e.AddedCells[0].Item }); |
||
937 | |||
938 | removeItems.Add(e.AddedCells[0].Item as MarkupInfoItem); |
||
939 | } |
||
940 | |||
941 | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
||
942 | |||
943 | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
944 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
945 | var resultA = (from item_Select in dataSet |
||
946 | from item_Non in dataSet_User |
||
947 | where item_Select == item_Non |
||
948 | select item_Non).ToList(); |
||
949 | |||
950 | if (resultA.Count() >= 2) |
||
951 | { |
||
952 | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
||
953 | RadWindow.Confirm(new DialogParameters |
||
954 | { |
||
955 | Owner = Application.Current.MainWindow, |
||
956 | Header = "Info", |
||
957 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
958 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
959 | { |
||
960 | 90d1dee0 | swate0609 | if (ea.DialogResult == null) |
961 | { |
||
962 | return; |
||
963 | } |
||
964 | 3abe8d4e | taeseongkim | if (gridViewMarkup.SelectedItems.Count() == 1) |
965 | { |
||
966 | MarkupInfoItem instanceItem = gridViewMarkup.SelectedItems.FirstOrDefault() as MarkupInfoItem; |
||
967 | gridViewMarkup.SelectedItem = null; |
||
968 | |||
969 | |||
970 | if (ea.DialogResult.Value) |
||
971 | { |
||
972 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
||
973 | { |
||
974 | gridViewMarkup.SelectedItem = instanceItem; |
||
975 | } |
||
976 | else |
||
977 | { |
||
978 | //1. Consolidations이 있다면 하나 선택 |
||
979 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
980 | |||
981 | if (Consolidations.Count() > 0) |
||
982 | { |
||
983 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
984 | } |
||
985 | } |
||
986 | |||
987 | } |
||
988 | else |
||
989 | { |
||
990 | //1. Consolidations 아닌게 있다면 Change |
||
991 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
992 | |||
993 | if (notConsolidations.Count() > 0) |
||
994 | { |
||
995 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
996 | } |
||
997 | else |
||
998 | {//1. Consolidations 아닌게 없다면 그대로 |
||
999 | gridViewMarkup.SelectedItem = instanceItem; |
||
1000 | } |
||
1001 | |||
1002 | } |
||
1003 | } |
||
1004 | }), |
||
1005 | Theme = new Windows8Theme(), |
||
1006 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
1007 | }); |
||
1008 | } |
||
1009 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
1010 | { |
||
1011 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1012 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1013 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1014 | #region 코멘트 보기 |
||
1015 | if (gridViewMarkup.SelectedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
||
1016 | { |
||
1017 | foreach (var item in gridSelectionItem) |
||
1018 | { |
||
1019 | if (item.UserID == App.ViewInfo.UserID) |
||
1020 | { |
||
1021 | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1022 | if (controls.Count == 0) |
||
1023 | { |
||
1024 | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1025 | |||
1026 | foreach (var markup in instance) |
||
1027 | { |
||
1028 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1029 | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1030 | } |
||
1031 | } |
||
1032 | |||
1033 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1034 | foreach (var control in controls) |
||
1035 | { |
||
1036 | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
||
1037 | control.Visibility = Visibility.Visible; |
||
1038 | } |
||
1039 | } |
||
1040 | else |
||
1041 | { |
||
1042 | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1043 | if (controls.Count == 0) |
||
1044 | { |
||
1045 | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1046 | foreach (var markup in instance) |
||
1047 | { |
||
1048 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1049 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1050 | 3abe8d4e | taeseongkim | } |
1051 | } |
||
1052 | |||
1053 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1054 | foreach (var control in controls) |
||
1055 | { |
||
1056 | control.Visibility = Visibility.Visible; |
||
1057 | } |
||
1058 | } |
||
1059 | } |
||
1060 | } |
||
1061 | #endregion |
||
1062 | #region 코멘트 숨기기 |
||
1063 | else if (removeItems.Count > 0) |
||
1064 | { |
||
1065 | (from A in removeItems |
||
1066 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1067 | where A.MarkupInfoID == B.MarkupInfoID |
||
1068 | select B).ToList().ForEach(data => |
||
1069 | { |
||
1070 | data.Visibility = Visibility.Hidden; |
||
1071 | }); |
||
1072 | |||
1073 | |||
1074 | var myComment = removeItems.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
||
1075 | if (myComment != null) |
||
1076 | { |
||
1077 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
1078 | { |
||
1079 | markupitem.Visibility = Visibility.Hidden; |
||
1080 | }); |
||
1081 | } |
||
1082 | } |
||
1083 | #endregion |
||
1084 | } |
||
1085 | } |
||
1086 | } |
||
1087 | } |
||
1088 | |||
1089 | 787a4489 | KangIngu | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
1090 | { |
||
1091 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.DOCUMENT_ID + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1092 | 0f065e57 | ljiyeon | |
1093 | 787a4489 | KangIngu | if (e.Result != null) |
1094 | { |
||
1095 | _DocItem = e.Result; |
||
1096 | |||
1097 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
1098 | { |
||
1099 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
1100 | } |
||
1101 | 664ea2e1 | taeseongkim | ////Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1102 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1103 | } |
||
1104 | else |
||
1105 | { |
||
1106 | 0585d5cc | taeseongkim | DialogMessage_Alert("Document Information Not Found.", "Error"); |
1107 | |||
1108 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
1109 | { |
||
1110 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
1111 | 0f065e57 | ljiyeon | |
1112 | 787a4489 | KangIngu | if (ea.Error == null) |
1113 | { |
||
1114 | if (ea.Result) |
||
1115 | { |
||
1116 | this._ViewInfo.isAdmin = true; |
||
1117 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1118 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1119 | } |
||
1120 | else |
||
1121 | { |
||
1122 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
1123 | 503cb09e | taeseongkim | DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info"); |
1124 | 787a4489 | KangIngu | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
1125 | } |
||
1126 | |||
1127 | } |
||
1128 | else |
||
1129 | { |
||
1130 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
1131 | } |
||
1132 | }; |
||
1133 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
1134 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
1135 | } |
||
1136 | } |
||
1137 | |||
1138 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
1139 | { |
||
1140 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1141 | 0f065e57 | ljiyeon | |
1142 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
1143 | { |
||
1144 | App.SystemInfo = e.Result; |
||
1145 | |||
1146 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
1147 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
1148 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1149 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1150 | |||
1151 | //if (App.urlHost.Contains("localhost")) |
||
1152 | //{ |
||
1153 | // App.urlHost = App.urlHost_DB; |
||
1154 | //} |
||
1155 | } |
||
1156 | } |
||
1157 | |||
1158 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
1159 | { |
||
1160 | f38ed998 | humkyung | if (e.Error == null && e.Result) |
1161 | 787a4489 | KangIngu | { |
1162 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1); |
1163 | 0f065e57 | ljiyeon | |
1164 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
1165 | |||
1166 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
1167 | 787a4489 | KangIngu | { |
1168 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1); |
1169 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
1170 | if (userData != null) |
||
1171 | 787a4489 | KangIngu | { |
1172 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
1173 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
1174 | 787a4489 | KangIngu | } |
1175 | 6c781c0c | djkim | else |
1176 | { |
||
1177 | userData = new MEMBER(); |
||
1178 | userData.DEPARTMENT = "ALL"; |
||
1179 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
1180 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
1181 | 29010418 | ljiyeon | } |
1182 | 787a4489 | KangIngu | } |
1183 | } |
||
1184 | else |
||
1185 | { |
||
1186 | f38ed998 | humkyung | 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
1187 | 84c48033 | djkim | DialogMessage_Alert(failedmsg, "Warning"); |
1188 | 787a4489 | KangIngu | } |
1189 | } |
||
1190 | 29010418 | ljiyeon | |
1191 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
1192 | 5a6493ad | humkyung | { |
1193 | 787a4489 | KangIngu | this._ViewInfo = info; |
1194 | 5a6493ad | humkyung | try |
1195 | 5ded1e5a | djkim | { |
1196 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
1197 | /// 다른 Site를 대비하여 에러 처리함 |
||
1198 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
1199 | if (!string.IsNullOrEmpty(docid)) |
||
1200 | { |
||
1201 | this._ViewInfo.DocumentItemID = docid; |
||
1202 | } |
||
1203 | 5ded1e5a | djkim | } |
1204 | a8aec13a | taeseongkim | catch (Exception ex) |
1205 | 5a6493ad | humkyung | { |
1206 | 664ea2e1 | taeseongkim | |
1207 | //App.FileLogger.Fatal(ex); |
||
1208 | 5a6493ad | humkyung | } |
1209 | |||
1210 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetSystemDataAsync", "", 1); |
1211 | |||
1212 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
1213 | 787a4489 | KangIngu | } |
1214 | |||
1215 | 992a98b4 | KangIngu | public void HubSet() |
1216 | { |
||
1217 | // 허브 연결 구성 |
||
1218 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
1219 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
1220 | |||
1221 | |||
1222 | // 허브 연결 |
||
1223 | hubConnection.Start().ContinueWith(task => |
||
1224 | { |
||
1225 | if (task.IsFaulted) |
||
1226 | { |
||
1227 | Console.WriteLine("There was an error opening the connection:{0}", |
||
1228 | task.Exception.GetBaseException()); |
||
1229 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1230 | 992a98b4 | KangIngu | } |
1231 | else |
||
1232 | { |
||
1233 | Console.WriteLine("Connected :: " + task.Id); |
||
1234 | } |
||
1235 | |||
1236 | }).Wait(); |
||
1237 | |||
1238 | |||
1239 | // [ 프로그램 시작 ] |
||
1240 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
1241 | //( "method name", arg1, arg2 ) |
||
1242 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
1243 | //{ |
||
1244 | // if (task.IsFaulted) |
||
1245 | // { |
||
1246 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1247 | // } |
||
1248 | // else |
||
1249 | // { |
||
1250 | // Console.WriteLine(task.Result); |
||
1251 | // } |
||
1252 | //}); |
||
1253 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
1254 | 992a98b4 | KangIngu | { |
1255 | if (task.IsFaulted) |
||
1256 | { |
||
1257 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1258 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1259 | 992a98b4 | KangIngu | } |
1260 | else |
||
1261 | { |
||
1262 | 29010418 | ljiyeon | switch (task.Result) |
1263 | 992a98b4 | KangIngu | { |
1264 | 53393bae | KangIngu | case "2": |
1265 | { |
||
1266 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
1267 | if (result == MessageBoxResult.OK) |
||
1268 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1269 | 53393bae | KangIngu | } |
1270 | break; |
||
1271 | case "404": |
||
1272 | { |
||
1273 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
1274 | if(result == MessageBoxResult.OK) |
||
1275 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1276 | 53393bae | KangIngu | } |
1277 | break; |
||
1278 | 992a98b4 | KangIngu | } |
1279 | } |
||
1280 | 53f96e00 | 송근호 | }); |
1281 | 992a98b4 | KangIngu | |
1282 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
1283 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
1284 | //{ |
||
1285 | |||
1286 | // if (status) |
||
1287 | // { |
||
1288 | // // 프로그램 시작 |
||
1289 | // Console.WriteLine("connection status : " + status); |
||
1290 | // } |
||
1291 | // else |
||
1292 | // { |
||
1293 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
1294 | // hubConnection.Stop(); |
||
1295 | // } |
||
1296 | //}); |
||
1297 | |||
1298 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
1299 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
1300 | Console.WriteLine("Noficiation Message : " + msg) |
||
1301 | ); |
||
1302 | |||
1303 | |||
1304 | // 서버 메서드 호출 |
||
1305 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
1306 | |||
1307 | //Console.ReadKey(); |
||
1308 | |||
1309 | //hubConnection.Stop(); |
||
1310 | } |
||
1311 | 787a4489 | KangIngu | |
1312 | ac4f1e13 | taeseongkim | public async void MarkupUserListDisplay() |
1313 | 1f1c566e | djkim | { |
1314 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1315 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1316 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1317 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
1318 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
1319 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
1320 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
1321 | //{ |
||
1322 | // if (item.UserID == App.ViewInfo.UserID) |
||
1323 | // { |
||
1324 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
1325 | f714bef8 | djkim | // { |
1326 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
1327 | // }); |
||
1328 | // } |
||
1329 | // else |
||
1330 | // { |
||
1331 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
1332 | // { |
||
1333 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
1334 | // }); |
||
1335 | // } |
||
1336 | //} |
||
1337 | 29010418 | ljiyeon | (from A in gridSelectionItem |
1338 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
1339 | where A.MarkupInfoID == B.MarkupInfoID |
||
1340 | select B).ToList().ForEach(data => |
||
1341 | { |
||
1342 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
1343 | }); |
||
1344 | 1f1c566e | djkim | (from A in gridSelectionItem |
1345 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1346 | where A.MarkupInfoID == B.MarkupInfoID |
||
1347 | select B).ToList().ForEach(data => |
||
1348 | { |
||
1349 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
1350 | }); |
||
1351 | |||
1352 | foreach (var item in gridSelectionItem) |
||
1353 | { |
||
1354 | ac4f1e13 | taeseongkim | |
1355 | 1f1c566e | djkim | if (item.UserID == App.ViewInfo.UserID) |
1356 | { |
||
1357 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1358 | |||
1359 | foreach (var markupitem in markupItems) |
||
1360 | 1f1c566e | djkim | { |
1361 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
1362 | 58dd9e89 | humkyung | item.MarkupInfoID, markupitem.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1363 | ac4f1e13 | taeseongkim | } |
1364 | 1f1c566e | djkim | } |
1365 | else |
||
1366 | { |
||
1367 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1368 | |||
1369 | foreach (var markupitem in markupItems) |
||
1370 | 1f1c566e | djkim | { |
1371 | 58dd9e89 | humkyung | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID, |
1372 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1373 | ac4f1e13 | taeseongkim | } |
1374 | 1f1c566e | djkim | } |
1375 | } |
||
1376 | } |
||
1377 | 787a4489 | KangIngu | } |
1378 | } |