markus / KCOM / Services / BaseServices.cs @ dea3d68a
이력 | 보기 | 이력해설 | 다운로드 (68.6 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 | 274cde11 | taeseongkim | userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x)); |
423 | |||
424 | e.Result.ToList().ForEach(d => |
||
425 | 787a4489 | KangIngu | { |
426 | 274cde11 | taeseongkim | if (d.MarkupList != null) |
427 | 787a4489 | KangIngu | { |
428 | 274cde11 | taeseongkim | d.MarkupList.ForEach(p => |
429 | 0585d5cc | taeseongkim | { |
430 | 274cde11 | taeseongkim | if (d.UserID == App.ViewInfo.UserID) |
431 | 0585d5cc | taeseongkim | { |
432 | ecf8a079 | 이지연 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) //조회모드는 delete 버튼 모두 비활성화 |
433 | { |
||
434 | d.userDelete = false; |
||
435 | } |
||
436 | 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가 있을 경우 |
||
437 | { |
||
438 | if (App.ViewInfo.NewCommentPermission && e.Result.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1 && x.MarkupInfoID == d.MarkupInfoID).Count() > 0) |
||
439 | d.userDelete = true; |
||
440 | } |
||
441 | else if (App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) //Consolidation Mode 일 때는 해당 Comment Layer의 Status가 Avoid or Consolidation인 것만 Delete 버튼 활성화 |
||
442 | { |
||
443 | if (d.AvoidConsolidate == 1 || d.Consolidate == 1) |
||
444 | d.userDelete = true; |
||
445 | } |
||
446 | else |
||
447 | { |
||
448 | d.userDelete = true; |
||
449 | } |
||
450 | 274cde11 | taeseongkim | d.DisplayColor = "#FFFF0000"; |
451 | MarkupItemEx markup = new MarkupItemEx |
||
452 | { |
||
453 | Data = p.Data, |
||
454 | Data_Type = p.Data_Type, |
||
455 | ID = p.ID, |
||
456 | IsUpdate = false, |
||
457 | MarkupInfoID = d.MarkupInfoID, |
||
458 | PageNumber = p.PageNumber, |
||
459 | Symbol_ID = p.Symbol_ID, |
||
460 | //Group_ID = p.Group_ID |
||
461 | }; |
||
462 | ViewerDataModel.Instance.MyMarkupList.Add(markup); |
||
463 | } |
||
464 | else |
||
465 | 0585d5cc | taeseongkim | { |
466 | 274cde11 | taeseongkim | MarkupItemEx markup = new MarkupItemEx |
467 | { |
||
468 | Data = p.Data, |
||
469 | Data_Type = p.Data_Type, |
||
470 | ID = p.ID, |
||
471 | IsUpdate = false, |
||
472 | MarkupInfoID = d.MarkupInfoID, |
||
473 | PageNumber = p.PageNumber, |
||
474 | Symbol_ID = p.Symbol_ID, |
||
475 | //Group_ID = p.Group_ID |
||
476 | }; |
||
477 | ViewerDataModel.Instance.MarkupList_Pre.Add(markup); |
||
478 | } |
||
479 | }); |
||
480 | } |
||
481 | }); |
||
482 | 787a4489 | KangIngu | |
483 | f258d884 | humkyung | var currentUser = e.Result.Find(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0); |
484 | 274cde11 | taeseongkim | if (currentUser == null) |
485 | 27cf69cd | taeseongkim | { |
486 | 274cde11 | taeseongkim | /// create a new markupinfo to do comments |
487 | if (App.ViewInfo.NewCommentPermission) |
||
488 | 27cf69cd | taeseongkim | { |
489 | 5a223b60 | humkyung | var infoId = Commons.ShortGuid(); |
490 | 274cde11 | taeseongkim | PreviewUserMarkupInfoItem = new MarkupInfoItem |
491 | { |
||
492 | CreateTime = DateTime.Now, |
||
493 | UpdateTime = DateTime.Now, |
||
494 | Depatment = userData.DEPARTMENT, |
||
495 | DisplayColor = "#FFFF0000", |
||
496 | UserID = userData.ID, |
||
497 | UserName = userData.NAME, |
||
498 | PageCount = 1, |
||
499 | Description = "", |
||
500 | MarkupInfoID = infoId, |
||
501 | MarkupList = null, |
||
502 | 5a223b60 | humkyung | MarkupVersionID = Commons.ShortGuid(), |
503 | 274cde11 | taeseongkim | Consolidate = 0, |
504 | PartConsolidate = 0, |
||
505 | userDelete = true, |
||
506 | AvoidConsolidate = 0, |
||
507 | IsPreviewUser = false |
||
508 | }; |
||
509 | |||
510 | App.Custom_ViewInfoId = infoId; |
||
511 | |||
512 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
513 | } |
||
514 | } |
||
515 | else |
||
516 | { |
||
517 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
518 | 27cf69cd | taeseongkim | } |
519 | 787a4489 | KangIngu | |
520 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
521 | 3ffd4b2d | humkyung | |
522 | 274cde11 | taeseongkim | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
523 | //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
||
524 | be72bfd6 | taeseongkim | |
525 | 274cde11 | taeseongkim | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
526 | 53deabaf | taeseongkim | |
527 | 274cde11 | taeseongkim | SetCommentPages(null); |
528 | 992a98b4 | KangIngu | |
529 | 274cde11 | taeseongkim | // GRIDVIEW에서 팀별 GROUPING |
530 | // 효성은 안함 |
||
531 | 1f2348b2 | taeseongkim | #if (Hyosung) |
532 | #else |
||
533 | 274cde11 | taeseongkim | /// create a group descriptor |
534 | gridViewMarkup.GroupDescriptors.Clear(); |
||
535 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
536 | descriptor.Member = "Depatment"; |
||
537 | descriptor.DisplayContent = "DEPT"; |
||
538 | //descriptor.SortDirection = ListSortDirection.Ascending; |
||
539 | gridViewMarkup.GroupDescriptors.Add(descriptor); |
||
540 | 47b95004 | taeseongkim | #endif |
541 | be72bfd6 | taeseongkim | |
542 | 274cde11 | taeseongkim | GridViewMarkup_Sorting(gridViewMarkup, new GridViewSortingEventArgs(gridViewMarkup.Columns[0], SortingState.None, SortingState.None)); |
543 | be72bfd6 | taeseongkim | |
544 | f38ed998 | humkyung | SelectInitialMarkupInfo(); |
545 | 53deabaf | taeseongkim | } |
546 | 787a4489 | KangIngu | } |
547 | 274cde11 | taeseongkim | catch (Exception ex) |
548 | { |
||
549 | App.FileLogger.Fatal(ex); |
||
550 | } |
||
551 | cf1cc862 | taeseongkim | finally |
552 | { |
||
553 | if(!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled) |
||
554 | { |
||
555 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled = true; |
||
556 | } |
||
557 | 6a19b48d | taeseongkim | |
558 | if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled) |
||
559 | { |
||
560 | ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled = true; |
||
561 | } |
||
562 | cf1cc862 | taeseongkim | } |
563 | 787a4489 | KangIngu | } |
564 | |||
565 | f38ed998 | humkyung | /// <summary> |
566 | /// 프로그램이 로딩되고 난 후 맨처음으로 MarkupInfo를 선택한다. |
||
567 | /// </summary> |
||
568 | private void SelectInitialMarkupInfo() |
||
569 | { |
||
570 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
571 | { |
||
572 | #region Consolidate 항목이 있으면 Consolidate 항목만 추가 |
||
573 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
574 | { |
||
575 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
576 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
577 | } |
||
578 | #endregion |
||
579 | 053f2163 | humkyung | #region Consolidate 항목이 없을 경우에는 사용자 별로 AvoidConsolidate를 제외한 우선 순위가 높은(Team,Comment)항목들을 선택 |
580 | f38ed998 | humkyung | else |
581 | { |
||
582 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
583 | |||
584 | #region Team consolidate 항목 선택 |
||
585 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
586 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
587 | #endregion |
||
588 | |||
589 | #region 추가되지 않은 사용자들을 추가 |
||
590 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
591 | { |
||
592 | Candidates.Add(item); |
||
593 | } |
||
594 | #endregion |
||
595 | |||
596 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
597 | f38ed998 | humkyung | } |
598 | #endregion |
||
599 | } |
||
600 | else if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) /// Eng'r Comment Mode |
||
601 | { |
||
602 | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
||
603 | |||
604 | #region Team consolidate 항목 선택 |
||
605 | 053f2163 | humkyung | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
606 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
607 | f38ed998 | humkyung | #endregion |
608 | |||
609 | #region 추가되지 않은 사용자들을 추가 |
||
610 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
611 | { |
||
612 | Candidates.Add(item); |
||
613 | } |
||
614 | #endregion |
||
615 | |||
616 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
617 | } |
||
618 | 053f2163 | humkyung | else if (App.ViewInfo.CreateFinalPDFPermission) /// Orig Comment Model |
619 | f38ed998 | humkyung | { |
620 | if (ViewerDataModel.Instance._markupInfoList.Any(x => x.Consolidate == 1 && x.AvoidConsolidate == 0)) |
||
621 | { |
||
622 | var Consolidates = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
623 | Consolidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
624 | } |
||
625 | 053f2163 | humkyung | else if (ViewerDataModel.Instance._markupInfoList.Any(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0)) |
626 | f38ed998 | humkyung | { |
627 | 053f2163 | humkyung | var MarkupInfoColl = ViewerDataModel.Instance._markupInfoList.Where(x => x.AvoidConsolidate == 0).ToList(); |
628 | |||
629 | #region Team consolidate 항목 선택 |
||
630 | var Candidates = MarkupInfoColl.Where(x => x.PartConsolidate == 1 && x.AvoidConsolidate == 0).ToList(); |
||
631 | MarkupInfoColl.RemoveAll(x => Candidates.Exists(y => y.UserID == x.UserID)); |
||
632 | #endregion |
||
633 | |||
634 | #region 추가되지 않은 사용자들을 추가 |
||
635 | foreach (var item in MarkupInfoColl.Where(x => !Candidates.Exists(y => y.UserID == x.UserID))) |
||
636 | { |
||
637 | Candidates.Add(item); |
||
638 | } |
||
639 | #endregion |
||
640 | |||
641 | Candidates.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
||
642 | f38ed998 | humkyung | } |
643 | else |
||
644 | { |
||
645 | 053f2163 | humkyung | var Comments = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 0 && x.AvoidConsolidate == 0).ToList(); |
646 | f38ed998 | humkyung | Comments.ForEach(x => gridViewMarkup.SelectedItems.Add(x)); |
647 | } |
||
648 | } |
||
649 | |||
650 | if (!gridViewMarkup.SelectedItems.Any()) |
||
651 | { |
||
652 | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
||
653 | |||
654 | if (PreviewUserMarkupInfoItem != null) |
||
655 | { |
||
656 | this.gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
657 | } |
||
658 | else if (SelectedItem != null) |
||
659 | { |
||
660 | this.gridViewMarkup.SelectedItem = SelectedItem; |
||
661 | } |
||
662 | else if (ViewerDataModel.Instance._markupInfoList.Any()) |
||
663 | { |
||
664 | this.gridViewMarkup.SelectedItem = ViewerDataModel.Instance._markupInfoList[0]; |
||
665 | } |
||
666 | } |
||
667 | } |
||
668 | |||
669 | be72bfd6 | taeseongkim | private void GridViewMarkup_Sorting(object sender, GridViewSortingEventArgs e) |
670 | { |
||
671 | IEnumerable<IKCOM.MarkupInfoItem> markuplist = e.DataControl.ItemsSource as IEnumerable<IKCOM.MarkupInfoItem>; |
||
672 | |||
673 | if(markuplist == null) |
||
674 | { |
||
675 | e.Cancel = true; |
||
676 | return; |
||
677 | } |
||
678 | |||
679 | if(e.NewSortingState == SortingState.None) |
||
680 | { |
||
681 | markuplist = markuplist.OrderByDescending(x => SortIndex(x)) |
||
682 | .ThenBy(x => x.Depatment) |
||
683 | .ThenBy(x => x.UserID); |
||
684 | |||
685 | e.DataControl.ItemsSource = markuplist.ToList(); |
||
686 | } |
||
687 | } |
||
688 | |||
689 | |||
690 | // 마크업 리스트 정렬 |
||
691 | private int SortIndex(IKCOM.MarkupInfoItem markupInfoItem) |
||
692 | { |
||
693 | int result = 0; |
||
694 | |||
695 | // Consolidate은 최상단 |
||
696 | if (markupInfoItem.Consolidate == 1) |
||
697 | { |
||
698 | result += 2; |
||
699 | } |
||
700 | |||
701 | /// Consolidate 다음으로 우선순위 |
||
702 | if (markupInfoItem.UserID == App.ViewInfo.UserID) |
||
703 | { |
||
704 | result += 1; |
||
705 | } |
||
706 | |||
707 | return result; |
||
708 | } |
||
709 | |||
710 | |||
711 | private void GridViewMarkup_Sorted(object sender, GridViewSortedEventArgs e) |
||
712 | { |
||
713 | |||
714 | } |
||
715 | |||
716 | ac4f1e13 | taeseongkim | private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
717 | 787a4489 | KangIngu | { |
718 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
719 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
720 | //{ |
||
721 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
722 | //} |
||
723 | |||
724 | 752b18ef | taeseongkim | if (ViewerDataModel.Instance.SyncPageNumber == 0) |
725 | 787a4489 | KangIngu | { |
726 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 1; |
727 | 787a4489 | KangIngu | } |
728 | b2d0f316 | humkyung | if (e.AddedItems.Any()) |
729 | 787a4489 | KangIngu | { |
730 | foreach (var item in gridSelectionItem) |
||
731 | { |
||
732 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
733 | //{ |
||
734 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
735 | //}); |
||
736 | ac4f1e13 | taeseongkim | |
737 | 752b18ef | taeseongkim | var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList(); |
738 | ac4f1e13 | taeseongkim | |
739 | foreach (var markupitem in pageItems) |
||
740 | 787a4489 | KangIngu | { |
741 | 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, |
742 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
743 | ac4f1e13 | taeseongkim | } |
744 | 787a4489 | KangIngu | } |
745 | } |
||
746 | b2d0f316 | humkyung | else if (e.RemovedItems.Any()) |
747 | 787a4489 | KangIngu | { |
748 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
749 | |||
750 | (from A in _infoItem |
||
751 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
752 | where A.MarkupInfoID == B.MarkupInfoID |
||
753 | select B).ToList().ForEach(data => |
||
754 | { |
||
755 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
756 | }); |
||
757 | } |
||
758 | } |
||
759 | e7dd7ae8 | humkyung | |
760 | /// <summary> |
||
761 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
762 | /// </summary> |
||
763 | /// <param name="sender"></param> |
||
764 | /// <param name="e"></param> |
||
765 | ac4f1e13 | taeseongkim | private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
766 | 787a4489 | KangIngu | { |
767 | 3abe8d4e | taeseongkim | |
768 | foreach (var item in e.AddedItems) |
||
769 | { |
||
770 | var cellToSelect = new GridViewCellInfo(item, this.gridViewMarkup.Columns["color"], this.gridViewMarkup); |
||
771 | |||
772 | if(cellToSelect != null) |
||
773 | { |
||
774 | |||
775 | } |
||
776 | } |
||
777 | |||
778 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
779 | |||
780 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
781 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
782 | var resultA = (from item_Select in dataSet |
||
783 | from item_Non in dataSet_User |
||
784 | where item_Select == item_Non |
||
785 | select item_Non).ToList(); |
||
786 | |||
787 | if (resultA.Count() >= 2) |
||
788 | { |
||
789 | eeb0a39c | taeseongkim | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
790 | 787a4489 | KangIngu | RadWindow.Confirm(new DialogParameters |
791 | { |
||
792 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
793 | eeb0a39c | taeseongkim | Header = "Info", |
794 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
795 | 787a4489 | KangIngu | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
796 | { |
||
797 | 90d1dee0 | swate0609 | if(ea.DialogResult == null) |
798 | { |
||
799 | return; |
||
800 | } |
||
801 | 787a4489 | KangIngu | if (e.AddedItems.Count() == 1) |
802 | { |
||
803 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
804 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
805 | 787a4489 | KangIngu | |
806 | 8ab0d0b1 | 송근호 | |
807 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
808 | { |
||
809 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
810 | { |
||
811 | gridViewMarkup.SelectedItem = instanceItem; |
||
812 | } |
||
813 | else |
||
814 | { |
||
815 | //1. Consolidations이 있다면 하나 선택 |
||
816 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
817 | |||
818 | if (Consolidations.Count() > 0) |
||
819 | { |
||
820 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
821 | } |
||
822 | } |
||
823 | |||
824 | 787a4489 | KangIngu | } |
825 | 8ab0d0b1 | 송근호 | else { |
826 | //1. Consolidations 아닌게 있다면 Change |
||
827 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
828 | |||
829 | if(notConsolidations.Count() > 0) { |
||
830 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
831 | } |
||
832 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
833 | gridViewMarkup.SelectedItem = instanceItem; |
||
834 | } |
||
835 | |||
836 | 787a4489 | KangIngu | } |
837 | } |
||
838 | }), |
||
839 | Theme = new Windows8Theme(), |
||
840 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
841 | }); |
||
842 | } |
||
843 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
844 | { |
||
845 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
846 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
847 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
848 | 47b95004 | taeseongkim | #region 코멘트 보기 |
849 | d18ea2bd | taeseongkim | if (e.AddedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
850 | 6b5d33c6 | djkim | { |
851 | foreach (var item in gridSelectionItem) |
||
852 | { |
||
853 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
854 | 6b5d33c6 | djkim | { |
855 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
856 | if (controls.Count == 0) |
||
857 | 6b5d33c6 | djkim | { |
858 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
859 | ac4f1e13 | taeseongkim | |
860 | 6b5d33c6 | djkim | foreach (var markup in instance) |
861 | { |
||
862 | 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, "", |
863 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents:App.SystemInfo.STAMP_CONTENTS); |
864 | 6b5d33c6 | djkim | } |
865 | } |
||
866 | 101da246 | humkyung | |
867 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
868 | foreach (var control in controls) |
||
869 | 6b5d33c6 | djkim | { |
870 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
871 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
872 | 6b5d33c6 | djkim | } |
873 | } |
||
874 | 3ffd4b2d | humkyung | else |
875 | 6b5d33c6 | djkim | { |
876 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
877 | if (controls.Count == 0) |
||
878 | { |
||
879 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
880 | 101da246 | humkyung | foreach (var markup in instance) |
881 | { |
||
882 | f5f788c2 | taeseongkim | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
883 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
884 | 101da246 | humkyung | } |
885 | } |
||
886 | |||
887 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
888 | foreach (var control in controls) |
||
889 | 6b5d33c6 | djkim | { |
890 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
891 | 6b5d33c6 | djkim | } |
892 | } |
||
893 | } |
||
894 | } |
||
895 | 47b95004 | taeseongkim | #endregion |
896 | #region 코멘트 숨기기 |
||
897 | 6b5d33c6 | djkim | else if (e.RemovedItems.Count > 0) |
898 | { |
||
899 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
900 | |||
901 | (from A in _infoItem |
||
902 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
903 | where A.MarkupInfoID == B.MarkupInfoID |
||
904 | select B).ToList().ForEach(data => |
||
905 | { |
||
906 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
907 | 6b5d33c6 | djkim | }); |
908 | |||
909 | b5ac6d6e | ljiyeon | |
910 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
911 | if (myComment != null) |
||
912 | { |
||
913 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
914 | { |
||
915 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
916 | 6b5d33c6 | djkim | }); |
917 | } |
||
918 | } |
||
919 | 47b95004 | taeseongkim | #endregion |
920 | 787a4489 | KangIngu | } |
921 | } |
||
922 | |||
923 | 3abe8d4e | taeseongkim | private async void gridViewMarkup_SelectedCellsChanged(object sender, Telerik.Windows.Controls.GridView.GridViewSelectedCellsChangedEventArgs e) |
924 | { |
||
925 | if (e.AddedCells.Count() > 0) |
||
926 | { |
||
927 | if(e.AddedCells[0].Column.Name == "color") |
||
928 | { |
||
929 | |||
930 | } |
||
931 | else |
||
932 | { |
||
933 | List<MarkupInfoItem> removeItems = new List<MarkupInfoItem>(); |
||
934 | |||
935 | if (!gridViewMarkup.SelectedItems.Contains(e.AddedCells[0].Item)) |
||
936 | { |
||
937 | gridViewMarkup.SelectedItems.Add(e.AddedCells[0].Item); |
||
938 | } |
||
939 | else |
||
940 | { |
||
941 | gridViewMarkup.Unselect(new[] { e.AddedCells[0].Item }); |
||
942 | |||
943 | removeItems.Add(e.AddedCells[0].Item as MarkupInfoItem); |
||
944 | } |
||
945 | |||
946 | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
||
947 | |||
948 | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
949 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
950 | var resultA = (from item_Select in dataSet |
||
951 | from item_Non in dataSet_User |
||
952 | where item_Select == item_Non |
||
953 | select item_Non).ToList(); |
||
954 | |||
955 | if (resultA.Count() >= 2) |
||
956 | { |
||
957 | // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요? |
||
958 | RadWindow.Confirm(new DialogParameters |
||
959 | { |
||
960 | Owner = Application.Current.MainWindow, |
||
961 | Header = "Info", |
||
962 | Content = "Selected more than two identical user data. Do you want to select consolidation?", |
||
963 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
964 | { |
||
965 | 90d1dee0 | swate0609 | if (ea.DialogResult == null) |
966 | { |
||
967 | return; |
||
968 | } |
||
969 | 3abe8d4e | taeseongkim | if (gridViewMarkup.SelectedItems.Count() == 1) |
970 | { |
||
971 | MarkupInfoItem instanceItem = gridViewMarkup.SelectedItems.FirstOrDefault() as MarkupInfoItem; |
||
972 | gridViewMarkup.SelectedItem = null; |
||
973 | |||
974 | |||
975 | if (ea.DialogResult.Value) |
||
976 | { |
||
977 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
||
978 | { |
||
979 | gridViewMarkup.SelectedItem = instanceItem; |
||
980 | } |
||
981 | else |
||
982 | { |
||
983 | //1. Consolidations이 있다면 하나 선택 |
||
984 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
985 | |||
986 | if (Consolidations.Count() > 0) |
||
987 | { |
||
988 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
989 | } |
||
990 | } |
||
991 | |||
992 | } |
||
993 | else |
||
994 | { |
||
995 | //1. Consolidations 아닌게 있다면 Change |
||
996 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
997 | |||
998 | if (notConsolidations.Count() > 0) |
||
999 | { |
||
1000 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
1001 | } |
||
1002 | else |
||
1003 | {//1. Consolidations 아닌게 없다면 그대로 |
||
1004 | gridViewMarkup.SelectedItem = instanceItem; |
||
1005 | } |
||
1006 | |||
1007 | } |
||
1008 | } |
||
1009 | }), |
||
1010 | Theme = new Windows8Theme(), |
||
1011 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
1012 | }); |
||
1013 | } |
||
1014 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
1015 | { |
||
1016 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1017 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1018 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1019 | #region 코멘트 보기 |
||
1020 | if (gridViewMarkup.SelectedItems.Count() > 0 && this.pageNavigator.CurrentPage != null) |
||
1021 | { |
||
1022 | foreach (var item in gridSelectionItem) |
||
1023 | { |
||
1024 | if (item.UserID == App.ViewInfo.UserID) |
||
1025 | { |
||
1026 | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1027 | if (controls.Count == 0) |
||
1028 | { |
||
1029 | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1030 | |||
1031 | foreach (var markup in instance) |
||
1032 | { |
||
1033 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1034 | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1035 | } |
||
1036 | } |
||
1037 | |||
1038 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1039 | foreach (var control in controls) |
||
1040 | { |
||
1041 | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
||
1042 | control.Visibility = Visibility.Visible; |
||
1043 | } |
||
1044 | } |
||
1045 | else |
||
1046 | { |
||
1047 | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1048 | if (controls.Count == 0) |
||
1049 | { |
||
1050 | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1051 | foreach (var markup in instance) |
||
1052 | { |
||
1053 | await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", |
||
1054 | 58dd9e89 | humkyung | item.MarkupInfoID, markup.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1055 | 3abe8d4e | taeseongkim | } |
1056 | } |
||
1057 | |||
1058 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
1059 | foreach (var control in controls) |
||
1060 | { |
||
1061 | control.Visibility = Visibility.Visible; |
||
1062 | } |
||
1063 | } |
||
1064 | } |
||
1065 | } |
||
1066 | #endregion |
||
1067 | #region 코멘트 숨기기 |
||
1068 | else if (removeItems.Count > 0) |
||
1069 | { |
||
1070 | (from A in removeItems |
||
1071 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1072 | where A.MarkupInfoID == B.MarkupInfoID |
||
1073 | select B).ToList().ForEach(data => |
||
1074 | { |
||
1075 | data.Visibility = Visibility.Hidden; |
||
1076 | }); |
||
1077 | |||
1078 | |||
1079 | var myComment = removeItems.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
||
1080 | if (myComment != null) |
||
1081 | { |
||
1082 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
1083 | { |
||
1084 | markupitem.Visibility = Visibility.Hidden; |
||
1085 | }); |
||
1086 | } |
||
1087 | } |
||
1088 | #endregion |
||
1089 | } |
||
1090 | } |
||
1091 | } |
||
1092 | } |
||
1093 | |||
1094 | 787a4489 | KangIngu | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
1095 | { |
||
1096 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.DOCUMENT_ID + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1097 | 0f065e57 | ljiyeon | |
1098 | 787a4489 | KangIngu | if (e.Result != null) |
1099 | { |
||
1100 | _DocItem = e.Result; |
||
1101 | |||
1102 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
1103 | { |
||
1104 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
1105 | } |
||
1106 | 664ea2e1 | taeseongkim | ////Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1107 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1108 | } |
||
1109 | else |
||
1110 | { |
||
1111 | 0585d5cc | taeseongkim | DialogMessage_Alert("Document Information Not Found.", "Error"); |
1112 | |||
1113 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
1114 | { |
||
1115 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
1116 | 0f065e57 | ljiyeon | |
1117 | 787a4489 | KangIngu | if (ea.Error == null) |
1118 | { |
||
1119 | if (ea.Result) |
||
1120 | { |
||
1121 | this._ViewInfo.isAdmin = true; |
||
1122 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1123 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1124 | } |
||
1125 | else |
||
1126 | { |
||
1127 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
1128 | 503cb09e | taeseongkim | DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info"); |
1129 | 787a4489 | KangIngu | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
1130 | } |
||
1131 | |||
1132 | } |
||
1133 | else |
||
1134 | { |
||
1135 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
1136 | } |
||
1137 | }; |
||
1138 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
1139 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
1140 | } |
||
1141 | } |
||
1142 | |||
1143 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
1144 | { |
||
1145 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
1146 | 0f065e57 | ljiyeon | |
1147 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
1148 | { |
||
1149 | App.SystemInfo = e.Result; |
||
1150 | |||
1151 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
1152 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
1153 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
1154 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
1155 | |||
1156 | //if (App.urlHost.Contains("localhost")) |
||
1157 | //{ |
||
1158 | // App.urlHost = App.urlHost_DB; |
||
1159 | //} |
||
1160 | } |
||
1161 | } |
||
1162 | |||
1163 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
1164 | { |
||
1165 | f38ed998 | humkyung | if (e.Error == null && e.Result) |
1166 | 787a4489 | KangIngu | { |
1167 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1); |
1168 | 0f065e57 | ljiyeon | |
1169 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
1170 | |||
1171 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
1172 | 787a4489 | KangIngu | { |
1173 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1); |
1174 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
1175 | if (userData != null) |
||
1176 | 787a4489 | KangIngu | { |
1177 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
1178 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
1179 | 787a4489 | KangIngu | } |
1180 | 6c781c0c | djkim | else |
1181 | { |
||
1182 | userData = new MEMBER(); |
||
1183 | userData.DEPARTMENT = "ALL"; |
||
1184 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
1185 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
1186 | 29010418 | ljiyeon | } |
1187 | 787a4489 | KangIngu | } |
1188 | } |
||
1189 | else |
||
1190 | { |
||
1191 | 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
1192 | 84c48033 | djkim | DialogMessage_Alert(failedmsg, "Warning"); |
1193 | 787a4489 | KangIngu | } |
1194 | } |
||
1195 | 29010418 | ljiyeon | |
1196 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
1197 | 5a6493ad | humkyung | { |
1198 | 787a4489 | KangIngu | this._ViewInfo = info; |
1199 | 5a6493ad | humkyung | try |
1200 | 5ded1e5a | djkim | { |
1201 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
1202 | /// 다른 Site를 대비하여 에러 처리함 |
||
1203 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
1204 | if (!string.IsNullOrEmpty(docid)) |
||
1205 | { |
||
1206 | this._ViewInfo.DocumentItemID = docid; |
||
1207 | } |
||
1208 | 5ded1e5a | djkim | } |
1209 | a8aec13a | taeseongkim | catch (Exception ex) |
1210 | 5a6493ad | humkyung | { |
1211 | 664ea2e1 | taeseongkim | |
1212 | //App.FileLogger.Fatal(ex); |
||
1213 | 5a6493ad | humkyung | } |
1214 | |||
1215 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetSystemDataAsync", "", 1); |
1216 | |||
1217 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
1218 | 787a4489 | KangIngu | } |
1219 | |||
1220 | 992a98b4 | KangIngu | public void HubSet() |
1221 | { |
||
1222 | // 허브 연결 구성 |
||
1223 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
1224 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
1225 | |||
1226 | |||
1227 | // 허브 연결 |
||
1228 | hubConnection.Start().ContinueWith(task => |
||
1229 | { |
||
1230 | if (task.IsFaulted) |
||
1231 | { |
||
1232 | Console.WriteLine("There was an error opening the connection:{0}", |
||
1233 | task.Exception.GetBaseException()); |
||
1234 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1235 | 992a98b4 | KangIngu | } |
1236 | else |
||
1237 | { |
||
1238 | Console.WriteLine("Connected :: " + task.Id); |
||
1239 | } |
||
1240 | |||
1241 | }).Wait(); |
||
1242 | |||
1243 | |||
1244 | // [ 프로그램 시작 ] |
||
1245 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
1246 | //( "method name", arg1, arg2 ) |
||
1247 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
1248 | //{ |
||
1249 | // if (task.IsFaulted) |
||
1250 | // { |
||
1251 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1252 | // } |
||
1253 | // else |
||
1254 | // { |
||
1255 | // Console.WriteLine(task.Result); |
||
1256 | // } |
||
1257 | //}); |
||
1258 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
1259 | 992a98b4 | KangIngu | { |
1260 | if (task.IsFaulted) |
||
1261 | { |
||
1262 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
1263 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
1264 | 992a98b4 | KangIngu | } |
1265 | else |
||
1266 | { |
||
1267 | 29010418 | ljiyeon | switch (task.Result) |
1268 | 992a98b4 | KangIngu | { |
1269 | 53393bae | KangIngu | case "2": |
1270 | { |
||
1271 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
1272 | if (result == MessageBoxResult.OK) |
||
1273 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1274 | 53393bae | KangIngu | } |
1275 | break; |
||
1276 | case "404": |
||
1277 | { |
||
1278 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
1279 | if(result == MessageBoxResult.OK) |
||
1280 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
1281 | 53393bae | KangIngu | } |
1282 | break; |
||
1283 | 992a98b4 | KangIngu | } |
1284 | } |
||
1285 | 53f96e00 | 송근호 | }); |
1286 | 992a98b4 | KangIngu | |
1287 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
1288 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
1289 | //{ |
||
1290 | |||
1291 | // if (status) |
||
1292 | // { |
||
1293 | // // 프로그램 시작 |
||
1294 | // Console.WriteLine("connection status : " + status); |
||
1295 | // } |
||
1296 | // else |
||
1297 | // { |
||
1298 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
1299 | // hubConnection.Stop(); |
||
1300 | // } |
||
1301 | //}); |
||
1302 | |||
1303 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
1304 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
1305 | Console.WriteLine("Noficiation Message : " + msg) |
||
1306 | ); |
||
1307 | |||
1308 | |||
1309 | // 서버 메서드 호출 |
||
1310 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
1311 | |||
1312 | //Console.ReadKey(); |
||
1313 | |||
1314 | //hubConnection.Stop(); |
||
1315 | } |
||
1316 | 787a4489 | KangIngu | |
1317 | ac4f1e13 | taeseongkim | public async void MarkupUserListDisplay() |
1318 | 1f1c566e | djkim | { |
1319 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
1320 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
1321 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
1322 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
1323 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
1324 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
1325 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
1326 | //{ |
||
1327 | // if (item.UserID == App.ViewInfo.UserID) |
||
1328 | // { |
||
1329 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
1330 | f714bef8 | djkim | // { |
1331 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
1332 | // }); |
||
1333 | // } |
||
1334 | // else |
||
1335 | // { |
||
1336 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
1337 | // { |
||
1338 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
1339 | // }); |
||
1340 | // } |
||
1341 | //} |
||
1342 | 29010418 | ljiyeon | (from A in gridSelectionItem |
1343 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
1344 | where A.MarkupInfoID == B.MarkupInfoID |
||
1345 | select B).ToList().ForEach(data => |
||
1346 | { |
||
1347 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
1348 | }); |
||
1349 | 1f1c566e | djkim | (from A in gridSelectionItem |
1350 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
1351 | where A.MarkupInfoID == B.MarkupInfoID |
||
1352 | select B).ToList().ForEach(data => |
||
1353 | { |
||
1354 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
1355 | }); |
||
1356 | |||
1357 | foreach (var item in gridSelectionItem) |
||
1358 | { |
||
1359 | ac4f1e13 | taeseongkim | |
1360 | 1f1c566e | djkim | if (item.UserID == App.ViewInfo.UserID) |
1361 | { |
||
1362 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1363 | |||
1364 | foreach (var markupitem in markupItems) |
||
1365 | 1f1c566e | djkim | { |
1366 | 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, "", |
1367 | 58dd9e89 | humkyung | item.MarkupInfoID, markupitem.ID, STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
1368 | ac4f1e13 | taeseongkim | } |
1369 | 1f1c566e | djkim | } |
1370 | else |
||
1371 | { |
||
1372 | ac4f1e13 | taeseongkim | var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList(); |
1373 | |||
1374 | foreach (var markupitem in markupItems) |
||
1375 | 1f1c566e | djkim | { |
1376 | 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, |
1377 | STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
||
1378 | ac4f1e13 | taeseongkim | } |
1379 | 1f1c566e | djkim | } |
1380 | } |
||
1381 | } |
||
1382 | 787a4489 | KangIngu | } |
1383 | } |