프로젝트

일반

사용자정보

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

markus / KCOM / Services / BaseServices.cs @ f3ab410f

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

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