프로젝트

일반

사용자정보

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

markus / KCOM / Services / BaseServices.cs @ 5c64268e

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

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