프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Services / BaseServices.cs @ fd19a116

이력 | 보기 | 이력해설 | 다운로드 (66.7 KB)

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