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