프로젝트

일반

사용자정보

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

markus / KCOM / Services / BaseServices.cs @ ddc223b4

이력 | 보기 | 이력해설 | 다운로드 (49 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 43d2041c taeseongkim
                    d.Width = d.Width;
134
                    d.Height = d.Height;
135 787a4489 KangIngu
                    var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d);
136 a1142a6b taeseongkim
                    System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle();
137 752b18ef taeseongkim
                    myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 215, 119));
138
                    myEllipse.Opacity = 1;
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 43d2041c taeseongkim
                canvas_compareBorder.Visibility = Visibility.Visible;
147 752b18ef taeseongkim
                da.From = 1;
148
                da.To = 0.5;
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 6c45db59 taeseongkim
203
                gridViewHistory.ItemsSource = list.OrderByDescending(x=>x.RevNo);
204 787a4489 KangIngu
            }
205 f9fb5500 ljiyeon
            //TempFile.TempLoad();
206 787a4489 KangIngu
        }
207
208
        private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e)
209
        {
210 664ea2e1 taeseongkim
            //Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
211 0f065e57 ljiyeon
212 d128ceb2 humkyung
            foreach(var info in ViewerDataModel.Instance._markupInfoList)
213
            {
214
                if(info.UserID == App.ViewInfo.UserID)
215
                {
216
                    info.userDelete = true;
217 cf1cc862 taeseongkim
                    info.DisplayColor = "#FFFF0000";
218 d128ceb2 humkyung
                }
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 664ea2e1 taeseongkim
                //Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
231 0585d5cc taeseongkim
            }
232
            else
233
            {
234 664ea2e1 taeseongkim
                //Logger.sendResLog("GetDeptDataCompleted",  "\r Error :" + e.Error, 1);
235 0585d5cc taeseongkim
            }
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 664ea2e1 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 5aa6a59a taeseongkim
            else if (e.Result == 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 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
274 cdb2c0a2 taeseongkim
                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 a1e2ba68 taeseongkim
                App.MarkusVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
293
294
                string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem?.DOCUMENT_NO, _DocItem?.REVISION, App.MarkusVersion);
295 d33ef543 taeseongkim
296 cdb2c0a2 taeseongkim
                instanceMain.Title = apptitle;
297 eeb0a39c taeseongkim
298 cdb2c0a2 taeseongkim
                #region 페이지 이미지를 로컬에 저장
299
                string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName());
300 eeb0a39c taeseongkim
301 cdb2c0a2 taeseongkim
                //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문
302 eeb0a39c taeseongkim
303 cdb2c0a2 taeseongkim
                #endregion
304 eeb0a39c taeseongkim
305 2007ecaa taeseongkim
                App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, "png", _DocInfo.PAGE_COUNT);
306 77cdac33 taeseongkim
307 2007ecaa taeseongkim
                //App.SamplePageStorage = new PageManager.PageStorage(MainUrl.Replace("png", "jpg"), tempStoragePath, "jpg", _DocInfo.PAGE_COUNT);
308 cdb2c0a2 taeseongkim
                await this.pageNavigator.SetPageNaviAsync(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl);
309
            }
310 54a28343 taeseongkim
        }
311 d62c0439 humkyung
312 3b81b385 taeseongkim
        private void pageNavigator_ThumbInitialized(object sender,EventArgs e)
313 54a28343 taeseongkim
        {
314
            BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID);
315 d62c0439 humkyung
316 54a28343 taeseongkim
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
317 d62c0439 humkyung
            //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad();
318
319 9d5b4bc2 taeseongkim
            /// 기존 임시파일 정리
320 6af42ff0 taeseongkim
            #region 단어 검색용 파일 다운로드
321 9d5b4bc2 taeseongkim
322 2007ecaa taeseongkim
            DownloadOriginalFile();
323 6af42ff0 taeseongkim
324
            #endregion
325
326 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1);
327 6af42ff0 taeseongkim
            BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id);
328
329 d62c0439 humkyung
        }
330
331 54a28343 taeseongkim
332 d62c0439 humkyung
        /// <summary>
333 35a96e24 humkyung
        /// get markupinfo and markupitem from database
334 a36a37c3 humkyung
        ///  - 1. called when document is loaded
335
        ///  - 2. called when user do consolidation
336 35a96e24 humkyung
        /// </summary>
337
        /// <param name="sender"></param>
338
        /// <param name="e"></param>
339 787a4489 KangIngu
        private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e)
340
        {
341 664ea2e1 taeseongkim
            //Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
342 0f065e57 ljiyeon
343 787a4489 KangIngu
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
344
            ViewerDataModel.Instance.MarkupControls.Clear();
345 be72bfd6 taeseongkim
346 274cde11 taeseongkim
            try
347 787a4489 KangIngu
            {
348
349 274cde11 taeseongkim
                if (e.Result != null)
350 d128ceb2 humkyung
                {
351 274cde11 taeseongkim
                    ViewerDataModel.Instance._markupInfoList.Clear();
352
                    if (e.Result.Count > 0) ViewerDataModel.Instance.MyMarkupList.Clear();
353 be72bfd6 taeseongkim
354 274cde11 taeseongkim
                    foreach (var info in e.Result)
355 d128ceb2 humkyung
                    {
356 274cde11 taeseongkim
                        if (info.Depatment == null) info.Depatment = "Unknown";
357 be72bfd6 taeseongkim
358 274cde11 taeseongkim
                        if (info.UserID == App.ViewInfo.UserID)
359
                        {
360
                            info.userDelete = true;
361
                            info.DisplayColor = "#FFFF0000";
362
                        }
363
                        else
364
                        {
365
                            info.userDelete = false;
366
                        }
367 d128ceb2 humkyung
368 274cde11 taeseongkim
                        ViewerDataModel.Instance._markupInfoList.Add(info);
369
                    }
370 8e5a4a6a taeseongkim
371 274cde11 taeseongkim
                    var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f => new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName });
372 8e5a4a6a taeseongkim
373 274cde11 taeseongkim
                    userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x));
374
375
                    e.Result.ToList().ForEach(d =>
376 787a4489 KangIngu
                    {
377 274cde11 taeseongkim
                        if (d.MarkupList != null)
378 787a4489 KangIngu
                        {
379 274cde11 taeseongkim
                            d.MarkupList.ForEach(p =>
380 0585d5cc taeseongkim
                            {
381 274cde11 taeseongkim
                                if (d.UserID == App.ViewInfo.UserID)
382 0585d5cc taeseongkim
                                {
383 274cde11 taeseongkim
                                    d.userDelete = true;
384
                                    d.DisplayColor = "#FFFF0000";
385
386
                                    MarkupItemEx markup = new MarkupItemEx
387
                                    {
388
                                        Data = p.Data,
389
                                        Data_Type = p.Data_Type,
390
                                        ID = p.ID,
391
                                        IsUpdate = false,
392
                                        MarkupInfoID = d.MarkupInfoID,
393
                                        PageNumber = p.PageNumber,
394
                                        Symbol_ID = p.Symbol_ID,
395
                                        //Group_ID = p.Group_ID
396
                                    };
397
                                    ViewerDataModel.Instance.MyMarkupList.Add(markup);
398
                                }
399
                                else
400 0585d5cc taeseongkim
                                {
401 274cde11 taeseongkim
                                    MarkupItemEx markup = new MarkupItemEx
402
                                    {
403
                                        Data = p.Data,
404
                                        Data_Type = p.Data_Type,
405
                                        ID = p.ID,
406
                                        IsUpdate = false,
407
                                        MarkupInfoID = d.MarkupInfoID,
408
                                        PageNumber = p.PageNumber,
409
                                        Symbol_ID = p.Symbol_ID,
410
                                        //Group_ID = p.Group_ID
411
                                    };
412
                                    ViewerDataModel.Instance.MarkupList_Pre.Add(markup);
413
                                }
414
                            });
415
                        }
416
                    });
417 787a4489 KangIngu
418 274cde11 taeseongkim
                    var currentUser = e.Result.Where(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0).FirstOrDefault();
419 a7372e37 taeseongkim
420 274cde11 taeseongkim
                    if (currentUser == null)
421 27cf69cd taeseongkim
                    {
422 274cde11 taeseongkim
                        /// create a new markupinfo to do comments
423
                        /// 
424
                        if (App.ViewInfo.NewCommentPermission)
425 27cf69cd taeseongkim
                        {
426 274cde11 taeseongkim
                            var infoId = Commons.shortGuid();
427
                            PreviewUserMarkupInfoItem = new MarkupInfoItem
428
                            {
429
                                CreateTime = DateTime.Now,
430
                                UpdateTime = DateTime.Now,
431
                                Depatment = userData.DEPARTMENT,
432
                                DisplayColor = "#FFFF0000",
433
                                UserID = userData.ID,
434
                                UserName = userData.NAME,
435
                                PageCount = 1,
436
                                Description = "",
437
                                MarkupInfoID = infoId,
438
                                MarkupList = null,
439
                                MarkupVersionID = Commons.shortGuid(),
440
                                Consolidate = 0,
441
                                PartConsolidate = 0,
442
                                userDelete = true,
443
                                AvoidConsolidate = 0,
444
                                IsPreviewUser = false
445
                            };
446
447
                            App.Custom_ViewInfoId = infoId;
448
449
                            ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
450
                        }
451
                    }
452
                    else
453
                    {
454
                        App.Custom_ViewInfoId = currentUser.MarkupInfoID;
455 27cf69cd taeseongkim
                    }
456 787a4489 KangIngu
457 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 1;
458 3ffd4b2d humkyung
459 274cde11 taeseongkim
                    /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경
460
                    //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList();
461 be72bfd6 taeseongkim
462 274cde11 taeseongkim
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
463 53deabaf taeseongkim
464 274cde11 taeseongkim
                    SetCommentPages(null);
465 992a98b4 KangIngu
466 274cde11 taeseongkim
                    // GRIDVIEW에서 팀별 GROUPING
467
                    // 효성은 안함
468 1f2348b2 taeseongkim
#if (Hyosung)
469
#else
470 274cde11 taeseongkim
                    /// create a group descriptor
471
                    gridViewMarkup.GroupDescriptors.Clear();
472
                    GroupDescriptor descriptor = new GroupDescriptor();
473
                    descriptor.Member = "Depatment";
474
                    descriptor.DisplayContent = "DEPT";
475
                    //descriptor.SortDirection = ListSortDirection.Ascending;
476
                    gridViewMarkup.GroupDescriptors.Add(descriptor);
477 47b95004 taeseongkim
#endif
478 be72bfd6 taeseongkim
479 274cde11 taeseongkim
                    GridViewMarkup_Sorting(gridViewMarkup, new GridViewSortingEventArgs(gridViewMarkup.Columns[0], SortingState.None, SortingState.None));
480 be72bfd6 taeseongkim
481 274cde11 taeseongkim
                    var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault();
482 53deabaf taeseongkim
483 274cde11 taeseongkim
                    if (PreviewUserMarkupInfoItem != null)
484
                    {
485
                        this.gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
486
                    }
487
                    else if (SelectedItem != null)
488
                    {
489
                        this.gridViewMarkup.SelectedItem = SelectedItem;
490
                    }
491
                    else if (ViewerDataModel.Instance._markupInfoList.Count() > 0)
492
                    {
493
                        this.gridViewMarkup.SelectedItem = ViewerDataModel.Instance._markupInfoList.First();
494
                    }
495 53deabaf taeseongkim
                }
496 787a4489 KangIngu
            }
497 274cde11 taeseongkim
            catch (Exception ex) 
498
            {
499
                App.FileLogger.Fatal(ex);
500
            }
501 cf1cc862 taeseongkim
            finally
502
            {
503
                if(!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled)
504
                {
505
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled = true;
506
                }
507
            }
508 787a4489 KangIngu
        }
509
510 be72bfd6 taeseongkim
        private void GridViewMarkup_Sorting(object sender, GridViewSortingEventArgs e)
511
        {
512
            IEnumerable<IKCOM.MarkupInfoItem> markuplist = e.DataControl.ItemsSource as IEnumerable<IKCOM.MarkupInfoItem>;
513
514
            if(markuplist == null)
515
            {
516
                e.Cancel = true;
517
                return;
518
            }
519
520
            if(e.NewSortingState == SortingState.None)
521
            {
522
                markuplist = markuplist.OrderByDescending(x => SortIndex(x))
523
                                            .ThenBy(x => x.Depatment)
524
                                            .ThenBy(x => x.UserID);
525
526
                e.DataControl.ItemsSource = markuplist.ToList();
527
            }
528
        }
529
530
531
        // 마크업 리스트 정렬
532
        private int SortIndex(IKCOM.MarkupInfoItem markupInfoItem)
533
        {
534
            int result = 0;
535
536
            // Consolidate은 최상단
537
            if (markupInfoItem.Consolidate == 1)
538
            {
539
                result += 2;
540
            }
541
542
            /// Consolidate 다음으로 우선순위
543
            if (markupInfoItem.UserID == App.ViewInfo.UserID)
544
            {
545
                result += 1;
546
            }
547
548
            return result;
549
        }
550
551
552
        private void GridViewMarkup_Sorted(object sender, GridViewSortedEventArgs e)
553
        {
554
555
        }
556
557 ac4f1e13 taeseongkim
        private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
558 787a4489 KangIngu
        {
559
            List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
560
            //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
561
            //{
562
            //    ViewerDataModel.Instance.PageBalanceNumber = 1;
563
            //}
564
565 752b18ef taeseongkim
            if (ViewerDataModel.Instance.SyncPageNumber == 0)
566 787a4489 KangIngu
            {
567 752b18ef taeseongkim
                ViewerDataModel.Instance.SyncPageNumber = 1;
568 787a4489 KangIngu
            }
569
            if (e.AddedItems.Count() > 0)
570
            {
571
                foreach (var item in gridSelectionItem)
572
                {
573
                    //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem)
574
                    //{
575
                    //    layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
576
                    //});
577 ac4f1e13 taeseongkim
578 752b18ef taeseongkim
                    var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList();
579 ac4f1e13 taeseongkim
580
                    foreach (var markupitem in pageItems)
581 787a4489 KangIngu
                    {
582 a1e2ba68 taeseongkim
                       await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
583 ac4f1e13 taeseongkim
                    }
584 787a4489 KangIngu
                }
585
            }
586
            else if (e.RemovedItems.Count > 0)
587
            {
588
                var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
589
590
                (from A in _infoItem
591
                 from B in Common.ViewerDataModel.Instance.MarkupControls_Sync
592
                 where A.MarkupInfoID == B.MarkupInfoID
593
                 select B).ToList().ForEach(data =>
594
                 {
595
                     Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data);
596
                 });
597
            }
598
        }
599 e7dd7ae8 humkyung
600
        /// <summary>
601
        /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다.
602
        /// </summary>
603
        /// <param name="sender"></param>
604
        /// <param name="e"></param>
605 ac4f1e13 taeseongkim
        private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
606 787a4489 KangIngu
        {
607 2089959a taeseongkim
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
608
609 787a4489 KangIngu
            var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
610
            var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
611
            var resultA = (from item_Select in dataSet
612
                           from item_Non in dataSet_User
613
                           where item_Select == item_Non
614
                           select item_Non).ToList();
615
616
            if (resultA.Count() >= 2)
617
            {
618 eeb0a39c taeseongkim
                // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?
619 787a4489 KangIngu
                RadWindow.Confirm(new DialogParameters
620
                {
621 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
622 eeb0a39c taeseongkim
                    Header = "Info",
623
                    Content = "Selected more than two identical user data. Do you want to select consolidation?",
624 787a4489 KangIngu
                    Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) =>
625
                    {
626
                        if (e.AddedItems.Count() == 1)
627
                        {
628
                            MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem;
629 8ab0d0b1 송근호
                            gridViewMarkup.SelectedItem = null;
630 787a4489 KangIngu
631 8ab0d0b1 송근호
                        
632 787a4489 KangIngu
                            if (ea.DialogResult.Value)
633
                            {
634 8ab0d0b1 송근호
                                if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1)
635
                                {
636
                                    gridViewMarkup.SelectedItem = instanceItem;
637
                                }
638
                                else
639
                                {
640
                                    //1. Consolidations이 있다면 하나 선택
641
                                    var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1));
642
643
                                    if (Consolidations.Count() > 0)
644
                                    {
645
                                        gridViewMarkup.SelectedItem = Consolidations.First();
646
                                    }
647
                                }
648
                              
649 787a4489 KangIngu
                            }
650 8ab0d0b1 송근호
                            else {
651
                                //1. Consolidations 아닌게 있다면 Change
652
                                var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1));
653
654
                                if(notConsolidations.Count() > 0) {
655
                                    gridViewMarkup.SelectedItem = notConsolidations.First();
656
                                }
657
                                else {//1. Consolidations 아닌게 없다면 그대로
658
                                    gridViewMarkup.SelectedItem = instanceItem;
659
                                }
660
                                
661 787a4489 KangIngu
                            }
662
                        }
663
                    }),
664
                    Theme = new Windows8Theme(),
665
                    ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 },
666
                });
667
            }
668
            else //파라미터로 넘어온 사용자가 걸리지 않은 경우
669
            {
670 6b5d33c6 djkim
                List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
671
                List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
672
                List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
673 47b95004 taeseongkim
#region 코멘트 보기
674 d18ea2bd taeseongkim
                if (e.AddedItems.Count() > 0 && this.pageNavigator.CurrentPage != null)
675 6b5d33c6 djkim
                {
676
                    foreach (var item in gridSelectionItem)
677
                    {
678 3ffd4b2d humkyung
                        if (item.UserID == App.ViewInfo.UserID)
679 6b5d33c6 djkim
                        {
680 101da246 humkyung
                            var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
681
                            if (controls.Count == 0)
682 6b5d33c6 djkim
                            {
683 129ca191 humkyung
                                var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
684 ac4f1e13 taeseongkim
685 6b5d33c6 djkim
                                foreach (var markup in instance)
686
                                {
687 a1e2ba68 taeseongkim
                                    await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", 
688 43e1d368 taeseongkim
                                        item.MarkupInfoID, markup.ID,STAMP_Contents:App.SystemInfo.STAMP_CONTENTS);
689 6b5d33c6 djkim
                                }
690
                            }
691 101da246 humkyung
692
                            controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
693
                            foreach (var control in controls)
694 6b5d33c6 djkim
                            {
695 d62c0439 humkyung
                                Logger.sendCheckLog(String.Format("=={0}", control), 1);
696 101da246 humkyung
                                control.Visibility = Visibility.Visible;
697 6b5d33c6 djkim
                            }
698
                        }
699 3ffd4b2d humkyung
                        else
700 6b5d33c6 djkim
                        {
701 101da246 humkyung
                            var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
702
                            if (controls.Count == 0)
703
                            {
704 129ca191 humkyung
                                var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
705 101da246 humkyung
                                foreach (var markup in instance)
706
                                {
707 a1e2ba68 taeseongkim
                                    await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
708 101da246 humkyung
                                        item.MarkupInfoID, markup.ID);
709
                                }
710
                            }
711
712
                            controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
713
                            foreach (var control in controls)
714 6b5d33c6 djkim
                            {
715 e7dd7ae8 humkyung
                                control.Visibility = Visibility.Visible;
716 6b5d33c6 djkim
                            }
717
                        }
718
                    }
719
                }
720 47b95004 taeseongkim
#endregion
721
#region 코멘트 숨기기
722 6b5d33c6 djkim
                else if (e.RemovedItems.Count > 0)
723
                {
724
                    var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
725
726
                    (from A in _infoItem
727
                     from B in Common.ViewerDataModel.Instance.MarkupControls
728
                     where A.MarkupInfoID == B.MarkupInfoID
729
                     select B).ToList().ForEach(data =>
730
                     {
731 b5ac6d6e ljiyeon
                         data.Visibility = Visibility.Hidden;                         
732 6b5d33c6 djkim
                     });
733
734 b5ac6d6e ljiyeon
735 6b5d33c6 djkim
                    var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault();
736
                    if (myComment != null)
737
                    {
738
                        Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem)
739
                        {
740 e7dd7ae8 humkyung
                            markupitem.Visibility = Visibility.Hidden;
741 6b5d33c6 djkim
                        });
742
                    }
743
                }
744 47b95004 taeseongkim
#endregion
745 787a4489 KangIngu
            }
746
        }
747
748
        private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e)
749
        {
750 664ea2e1 taeseongkim
            //Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.DOCUMENT_ID + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
751 0f065e57 ljiyeon
752 787a4489 KangIngu
            if (e.Result != null)
753
            {
754
                _DocItem = e.Result;
755
756
                if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0")
757
                {
758
                    _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", "");
759
                }
760 664ea2e1 taeseongkim
                ////Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
761 787a4489 KangIngu
                BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
762
            }
763
            else
764
            {
765 0585d5cc taeseongkim
                DialogMessage_Alert("Document Information Not Found.", "Error");
766
767 787a4489 KangIngu
                BaseClient.GetCheckSystemAdminCompleted += (sen, ea) =>
768
                {
769 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
770 0f065e57 ljiyeon
771 787a4489 KangIngu
                    if (ea.Error == null)
772
                    {
773
                        if (ea.Result)
774
                        {
775
                            this._ViewInfo.isAdmin = true;
776 664ea2e1 taeseongkim
                            //Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
777 787a4489 KangIngu
                            BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
778
                        }
779
                        else
780
                        {
781
                            //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
782 503cb09e taeseongkim
                            DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info");
783 787a4489 KangIngu
                            //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
784
                        }
785
786
                    }
787
                    else
788
                    {
789
                        //System.Windows.Browser.HtmlPage.Window.Invoke("close");
790
                    }
791
                };
792 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1);
793 787a4489 KangIngu
                BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID);
794
            }
795
        }
796
797
        private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e)
798
        {
799 664ea2e1 taeseongkim
            //Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
800 0f065e57 ljiyeon
801 787a4489 KangIngu
            if (e.Error == null && e.Result != null)
802
            {
803
                App.SystemInfo = e.Result;
804
805
                //App.urlPort_DB = App.SystemInfo.HostPort;
806
                //App.urlHost_DB = App.SystemInfo.HostName;
807 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
808 787a4489 KangIngu
                BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
809
810
                //if (App.urlHost.Contains("localhost"))
811
                //{
812
                //    App.urlHost = App.urlHost_DB;
813
                //}
814
            }
815
        }
816
817
        private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e)
818
        {
819 84c48033 djkim
            
820 664ea2e1 taeseongkim
            //Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
821 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다");
822 53880c83 ljiyeon
            if (e.Error == null && e.Result == true)
823 787a4489 KangIngu
            {
824 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1);
825 0f065e57 ljiyeon
826 787a4489 KangIngu
                BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID });
827
828 992a98b4 KangIngu
                if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "")
829 787a4489 KangIngu
                {
830 664ea2e1 taeseongkim
                    //Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1);
831 6c781c0c djkim
                    userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
832
                    if (userData != null)
833 787a4489 KangIngu
                    {
834 664ea2e1 taeseongkim
                        //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
835 6c781c0c djkim
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
836 787a4489 KangIngu
                    }
837 6c781c0c djkim
                    else
838
                    {
839
                        userData = new MEMBER();
840
                        userData.DEPARTMENT = "ALL";
841 664ea2e1 taeseongkim
                        //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
842 6c781c0c djkim
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
843 29010418 ljiyeon
                    }
844 787a4489 KangIngu
                }
845
            }
846
            else
847
            {
848 84c48033 djkim
                
849
                DialogMessage_Alert(failedmsg, "Warning");
850 787a4489 KangIngu
            }
851
        }
852 29010418 ljiyeon
853 787a4489 KangIngu
        public void SetView(ViewInfo info)
854 5a6493ad humkyung
        { 
855 787a4489 KangIngu
            this._ViewInfo = info;
856 5a6493ad humkyung
            try
857 5ded1e5a djkim
            {
858 5a6493ad humkyung
                /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함
859
                /// 다른 Site를 대비하여 에러 처리함
860
                string docid = BaseClient.GetDocItemID(info.EnsembleID);
861
                if (!string.IsNullOrEmpty(docid))
862
                {
863
                    this._ViewInfo.DocumentItemID = docid;
864
                }
865 5ded1e5a djkim
            }
866 5a6493ad humkyung
            catch(Exception ex)
867
            {
868 664ea2e1 taeseongkim
869
                //App.FileLogger.Fatal(ex);
870 5a6493ad humkyung
            }
871
872 664ea2e1 taeseongkim
            //Logger.sendReqLog("GetSystemDataAsync", "", 1);
873
874 29010418 ljiyeon
            BaseClient.GetSystemDataAsync();
875 787a4489 KangIngu
        }
876
877 992a98b4 KangIngu
        public void HubSet()
878
        {
879
            // 허브 연결 구성
880 84c48033 djkim
            var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal));
881 992a98b4 KangIngu
            IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub");
882
883
884
            // 허브 연결 
885
            hubConnection.Start().ContinueWith(task =>
886
            {
887
                if (task.IsFaulted)
888
                {
889
                    Console.WriteLine("There was an error opening the connection:{0}",
890
                                      task.Exception.GetBaseException());
891 53f96e00 송근호
                    //throw task.Exception.GetBaseException();
892 992a98b4 KangIngu
                }
893
                else
894
                {
895
                    Console.WriteLine("Connected :: " + task.Id);
896
                }
897
898
            }).Wait();
899
900
901
            // [ 프로그램 시작 ]
902
            // 클라이언트에서 서버를 호출 ( 접속 시 )  : 라이센스 체크
903
            //( "method name", arg1, arg2 )
904
            //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task =>
905
            //{
906
            //    if (task.IsFaulted)
907
            //    {
908
            //        Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
909
            //    }
910
            //    else
911
            //    {
912
            //        Console.WriteLine(task.Result);
913
            //    }
914
            //});
915 0af41bf0 djkim
            MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task =>
916 992a98b4 KangIngu
            {
917
                if (task.IsFaulted)
918
                {
919
                    Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
920 53f96e00 송근호
                    //throw task.Exception.GetBaseException();
921 992a98b4 KangIngu
                }
922
                else
923
                {
924 29010418 ljiyeon
                    switch (task.Result)
925 992a98b4 KangIngu
                    {
926 53393bae KangIngu
                        case "2":
927
                            {
928 0af41bf0 djkim
                                var result = MessageBox.Show("권한이 없습니다.");
929
                                if (result == MessageBoxResult.OK)
930
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
931 53393bae KangIngu
                            }
932
                            break;
933
                        case "404":
934
                            {
935 0af41bf0 djkim
                                var result = MessageBox.Show("등록된 사용자가 아닙니다.");
936
                                if(result == MessageBoxResult.OK)
937
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
938 53393bae KangIngu
                            }
939
                            break;
940 992a98b4 KangIngu
                    }
941
                }
942 53f96e00 송근호
            });
943 992a98b4 KangIngu
944
            // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) 
945
            //MarkusLicenseProxy.On<bool>("IsConnection", status =>
946
            //{
947
948
            //    if (status)
949
            //    {
950
            //        // 프로그램 시작 
951
            //        Console.WriteLine("connection status : " + status);
952
            //    }
953
            //    else
954
            //    {
955
            //        // 프로그램 종료 ( signalr 접속 끊기 )  
956
            //        hubConnection.Stop();
957
            //    }
958
            //});
959
960
            // 공지 메세지 ( 서버에서 클라이언트 호출 ) 
961
            MarkusLicenseProxy.On<string>("MarkusNotification", msg =>
962
                Console.WriteLine("Noficiation Message : " + msg)
963
            );
964
965
966
            // 서버 메서드 호출 
967
            //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait();
968
969
            //Console.ReadKey();
970
971
            //hubConnection.Stop();
972
        }
973 787a4489 KangIngu
974 ac4f1e13 taeseongkim
        public async void MarkupUserListDisplay()
975 1f1c566e djkim
        {
976
            List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
977
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
978
            List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
979 29010418 ljiyeon
                                                                                                     //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
980 1f1c566e djkim
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
981 29010418 ljiyeon
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
982 f714bef8 djkim
            //foreach (var item in gridSelectionItem)
983
            //{
984
            //    if (item.UserID == App.ViewInfo.UserID)
985
            //    {
986 d62c0439 humkyung
            //        ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
987 f714bef8 djkim
            //        {
988
            //            layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
989
            //        });
990
            //    }
991
            //    else
992
            //    {
993
            //        ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
994
            //        {
995
            //            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
996
            //        });
997
            //    }
998
            //}
999 29010418 ljiyeon
                (from A in gridSelectionItem
1000
                 from B in Common.ViewerDataModel.Instance.MarkupControls_USER
1001
                 where A.MarkupInfoID == B.MarkupInfoID
1002
                 select B).ToList().ForEach(data =>
1003
                 {
1004
                     Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data);
1005
                 });
1006 1f1c566e djkim
            (from A in gridSelectionItem
1007
             from B in Common.ViewerDataModel.Instance.MarkupControls
1008
             where A.MarkupInfoID == B.MarkupInfoID
1009
             select B).ToList().ForEach(data =>
1010
             {
1011
                 Common.ViewerDataModel.Instance.MarkupControls.Remove(data);
1012
             });
1013
1014
            foreach (var item in gridSelectionItem)
1015
            {
1016 ac4f1e13 taeseongkim
1017 1f1c566e djkim
                if (item.UserID == App.ViewInfo.UserID)
1018
                {
1019 ac4f1e13 taeseongkim
                    var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
1020
1021
                    foreach (var markupitem in markupItems)
1022 1f1c566e djkim
                    {
1023 a1e2ba68 taeseongkim
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", 
1024 ac4f1e13 taeseongkim
                                item.MarkupInfoID, markupitem.ID);
1025
                    }
1026 1f1c566e djkim
                }
1027
                else
1028
                {
1029 ac4f1e13 taeseongkim
                    var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
1030
1031
                    foreach (var markupitem in markupItems)
1032 1f1c566e djkim
                    {
1033 a1e2ba68 taeseongkim
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
1034 ac4f1e13 taeseongkim
                    }
1035 1f1c566e djkim
                }
1036
            }
1037
        }
1038 787a4489 KangIngu
    }
1039
}
클립보드 이미지 추가 (최대 크기: 500 MB)