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