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