프로젝트

일반

사용자정보

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

markus / KCOM / Services / BaseServices.cs @ cdb2c0a2

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

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