프로젝트

일반

사용자정보

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

markus / KCOM / Controls / CheckList.xaml.cs @ 6c687be8

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

1 787a4489 KangIngu
using KCOMDataModel.Common;
2
using KCOMDataModel.DataModel;
3
using System;
4
using System.Collections.Generic;
5
using System.Collections.ObjectModel;
6
using System.Linq;
7
using System.Text;
8
using System.Windows;
9
using System.Windows.Controls;
10
using System.Windows.Data;
11
using System.Windows.Documents;
12
using System.Windows.Input;
13
using System.Windows.Media;
14
using System.Windows.Media.Imaging;
15
using System.Windows.Navigation;
16
using System.Windows.Shapes;
17
using Telerik.Windows.Controls;
18
using KCOM.Common.Converter;
19
using System.ComponentModel;
20
using Telerik.Windows.Controls.GridView;
21
using KCOM.Controls;
22
using KCOM.Common;
23
using IKCOM;
24
using Excel = Microsoft.Office.Interop.Excel;
25 24a3178d djkim
using System.Text.RegularExpressions;
26 787a4489 KangIngu
27
namespace KCOM.Controls
28
{
29
30
    #region Customer
31
    public class Customer
32
    {
33
        public string ID { get; set; }
34
        public string DOCUMENT_ID { get; set; }
35
        public string USER_ID { get; set; }
36
        public string REVISION { get; set; }
37
        public int PAGENUMBER { get; set; }
38
        public string TODOLIST { get; set; }
39
        public string IMAGE_URL { get; set; }
40
        public string STATUS { get; set; }
41
        public string STATUS_ { get; set; }
42
        public string _STATUS { get; set; }
43
        public string VENDOR { get; set; }
44
        public string REMARK { get; set; }
45
        public string PROJECT_NO { get; set; }
46
        public string REV_19 { get; set; }
47
        public string REV_18 { get; set; }
48
        public string REV_17 { get; set; }
49
        public string REV_16 { get; set; }
50
        public string REV_15 { get; set; }
51
        public string REV_14 { get; set; }
52
        public string REV_13 { get; set; }
53
        public string REV_12 { get; set; }
54
        public string REV_11 { get; set; }
55
        public string REV_10 { get; set; }
56
        public string REV_9 { get; set; }
57
        public string REV_8 { get; set; }
58
        public string REV_7 { get; set; }
59
        public string REV_6 { get; set; }
60
        public string REV_5 { get; set; }
61
        public string REV_4 { get; set; }
62
        public string REV_3 { get; set; }
63
        public string REV_2 { get; set; }
64
        public string REV_1 { get; set; }
65
        public string REV_0 { get; set; }
66
        public string IMAGE_ANCHOR { get; set; }
67
        public byte[] IMAGE_PATH { get; set; }
68
        public string STATUS_DESC { get; set; }
69
        public string REPLY { get; set; }
70
        public DateTime CREATE_TIME { get; set; }
71 90e7968d ljiyeon
    } 
72 787a4489 KangIngu
    #endregion
73
74
    /// <summary>
75
    /// Interaction logic for CheckList.xaml
76
    /// </summary>
77
    public partial class CheckList : UserControl
78
    {
79
        #region 프로퍼티
80
        List<CHECK_LIST> items = new List<CHECK_LIST>();
81
        List<Customer> Lists = new List<Customer>();
82 77922798 송근호
        MainWindow mainWindow;
83 53880c83 ljiyeon
        //string old_Revision = "";
84 787a4489 KangIngu
        string old_DocID = "";
85
        string Current_Revision = "";
86 53880c83 ljiyeon
        //string Current_DocNo = "";
87
        //string Current_Slip = "";
88 787a4489 KangIngu
        bool Isinit = false;
89
        int rev_cnt = 1;
90 69ef0800 KangIngu
        bool isCheck_Status = false;
91
        string Select_StatusID = "";
92 787a4489 KangIngu
        #endregion
93
94
        #region 생성자
95 77922798 송근호
        public CheckList(MainWindow main)
96 787a4489 KangIngu
        {
97
            Common.ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
98
            InitializeComponent();
99 77922798 송근호
            mainWindow = main;
100 787a4489 KangIngu
            this.Loaded += CheckList_Loaded;
101
            this.KeyDown += new KeyEventHandler(KeyEventDownAction);
102
            this.AddHandler(Image.MouseLeftButtonDownEvent, new MouseButtonEventHandler(mousedownOnImage), true);
103 90e7968d ljiyeon
            
104 77922798 송근호
105 787a4489 KangIngu
        }
106
        #endregion
107
108
        public void DataBind()
109
        {
110 24a3178d djkim
            try
111
            {
112
                Isinit = false;
113 0f065e57 ljiyeon
114 24a3178d djkim
                Lists = new List<Customer>();
115 77922798 송근호
                string doc_no = mainWindow.dzMainMenu._DocItem.DOCUMENT_NO;
116 24a3178d djkim
                string project_no = App.ViewInfo.ProjectNO;
117
                string user_id = App.ViewInfo.UserID;
118
119
                Logger.sendReqLog("GetUserCheckList: ", project_no + "," + user_id + "," + doc_no, 1);
120
121
                items = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetUserCheckList(project_no, user_id, doc_no);
122
                if (items.Count() > 0)
123
                {
124
                    Logger.sendResLog("GetUserCheckList", "TRUE", 1);
125
                }
126
                else
127
                {
128
                    Logger.sendResLog("GetUserCheckList", "FALSE", 1);
129
                }
130 0f065e57 ljiyeon
131 6c781c0c djkim
                foreach (var item in items)
132 787a4489 KangIngu
                {
133 6c781c0c djkim
                    Customer customer = new Customer();
134
                    customer.ID = item.ID;
135
                    customer.IMAGE_ANCHOR = item.IMAGE_ANCHOR;
136
                    if (item.IMAGE_URL != null && item.IMAGE_URL != "")
137
                        customer.IMAGE_PATH = Convert.FromBase64String(item.IMAGE_URL);
138
                    customer.PAGENUMBER = item.PAGENUMBER;
139
                    customer.PROJECT_NO = item.PROJECT_NO;
140
                    customer.REMARK = item.REMARK;
141
                    customer.REVISION = item.REVISION;
142
143
                    #region history
144 24a3178d djkim
                    Logger.sendReqLog("GetCheckListHistory: ", project_no + "," + item.ID, 1);
145 0f065e57 ljiyeon
                    var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(project_no, item.ID);
146
147
                    if (history.Count() > 0)
148
                    {
149
                        Logger.sendResLog("GetCheckListHistory", "TRUE", 1);
150
                    }
151
                    else
152
                    {
153
                        Logger.sendResLog("GetCheckListHistory", "FALSE", 1);
154
                    }
155
156 6c781c0c djkim
                    foreach (var rev in history)
157 787a4489 KangIngu
                    {
158 6c781c0c djkim
                        if (rev.REVISION == "A")
159
                        { customer.REV_0 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); }
160
                        if (rev.REVISION == "B")
161
                        { customer.REV_1 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 2 ? 2 : rev_cnt; }
162
                        if (rev.REVISION == "C")
163
                        { customer.REV_2 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 3 ? 3 : rev_cnt; }
164
                        if (rev.REVISION == "D")
165
                        { customer.REV_3 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 4 ? 4 : rev_cnt; }
166
                        if (rev.REVISION == "E")
167
                        { customer.REV_4 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 5 ? 5 : rev_cnt; }
168
                        if (rev.REVISION == "F")
169
                        { customer.REV_5 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 6 ? 6 : rev_cnt; }
170
                        if (rev.REVISION == "G")
171
                        { customer.REV_6 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 7 ? 7 : rev_cnt; }
172
                        if (rev.REVISION == "H")
173
                        { customer.REV_7 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 8 ? 8 : rev_cnt; }
174
                        if (rev.REVISION == "I")
175
                        { customer.REV_8 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 9 ? 9 : rev_cnt; }
176
                        if (rev.REVISION == "J")
177
                        { customer.REV_9 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 10 ? 10 : rev_cnt; }
178
                        if (rev.REVISION == "K")
179
                        { customer.REV_10 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 11 ? 11 : rev_cnt; }
180
                        if (rev.REVISION == "L")
181
                        { customer.REV_11 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 12 ? 12 : rev_cnt; }
182
                        if (rev.REVISION == "M")
183
                        { customer.REV_12 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 13 ? 13 : rev_cnt; }
184
                        if (rev.REVISION == "N")
185
                        { customer.REV_13 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 14 ? 14 : rev_cnt; }
186
                        if (rev.REVISION == "O")
187
                        { customer.REV_14 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 15 ? 15 : rev_cnt; }
188
                        if (rev.REVISION == "P")
189
                        { customer.REV_15 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 16 ? 16 : rev_cnt; }
190
                        if (rev.REVISION == "Q")
191
                        { customer.REV_16 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 17 ? 17 : rev_cnt; }
192
                        if (rev.REVISION == "R")
193
                        { customer.REV_17 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 18 ? 18 : rev_cnt; }
194
                        if (rev.REVISION == "S")
195
                        { customer.REV_18 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 19 ? 19 : rev_cnt; }
196
                        if (rev.REVISION == "T")
197
                        { customer.REV_19 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 20 ? 20 : rev_cnt; }
198
                    }
199
                    #endregion
200 787a4489 KangIngu
201 6c781c0c djkim
                    customer.STATUS = item.STATUS;
202
                    customer.REPLY = item.REPLY;
203
                    customer.TODOLIST = item.TODOLIST;
204
                    customer.USER_ID = item.USER_ID;
205
                    customer.VENDOR = item.VENDOR;
206
                    customer.DOCUMENT_ID = item.DOCUMENT_ID;
207
                    customer.CREATE_TIME = DateTime.Parse(item.CREATE_TIME.ToString());
208 787a4489 KangIngu
209 6c781c0c djkim
                    if (item.STATUS == "True")
210
                    {
211
                        customer._STATUS = "Close";
212
                        customer.STATUS_ = "False";
213
                        customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
214 787a4489 KangIngu
                    }
215 6c781c0c djkim
                    else
216
                    {
217
                        customer._STATUS = "Open";
218
                        customer.STATUS_ = "True";
219
                        customer.STATUS_DESC = item.STATUS_DESC_OPEN;
220
                    }
221
222
                    Lists.Add(customer);
223 787a4489 KangIngu
                }
224 24a3178d djkim
            }
225
            catch (Exception ex)
226
            {
227
                Logger.sendResLog("Checklist DataBind", ex.Message, 0);
228
            }
229
230
231 787a4489 KangIngu
        }
232
233
        private void ChangeSize(double width, double height)
234
        {
235
            this.Width = width;
236
            this.Height = height;
237
        }
238
239
        private void SyncInit()
240
        {
241 24a3178d djkim
            try
242 787a4489 KangIngu
            {
243 24a3178d djkim
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
244
                {
245
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
246
                    ViewerDataModel.Instance.PageBalanceMode = false;
247
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
248
                    ViewerDataModel.Instance.PageNumber = 0;
249
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
250
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
251
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
252
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
253
                }
254 787a4489 KangIngu
            }
255 90e7968d ljiyeon
            catch(Exception ex)
256 24a3178d djkim
            {
257
                Logger.sendResLog("SyncInit", ex.Message, 0);
258
            }
259 90e7968d ljiyeon
            
260 787a4489 KangIngu
        }
261
262
        private void DialogMessage_Alert(string Msg)
263
        {
264 24a3178d djkim
            try
265
            {
266
                RadWindow CheckPop = new RadWindow();
267
                Alert check = new Alert(Msg);
268 787a4489 KangIngu
269 24a3178d djkim
                CheckPop = new RadWindow
270
                {
271
                    MinWidth = 400,
272
                    MinHeight = 100,
273
                    //Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
274
                    Header = "Alert",
275
                    Content = check,
276
                    ResizeMode = System.Windows.ResizeMode.NoResize,
277
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
278
                    IsTopmost = true,
279
                };
280
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
281
                CheckPop.ShowDialog();
282
            }
283
            catch (Exception ex)
284 787a4489 KangIngu
            {
285 24a3178d djkim
                Logger.sendResLog("DialogMessage_Alert", ex.Message, 0);
286
            }
287
288 787a4489 KangIngu
        }
289
290
        private void History_Set()
291
        {
292 24a3178d djkim
            try
293 787a4489 KangIngu
            {
294 24a3178d djkim
                if (col1.Width != new GridLength(1200))
295
                {
296
                    Col_Remark.IsVisible = true;
297
                    Col_Reply.IsVisible = true;
298
                    Col_Vendor.IsVisible = true;
299 787a4489 KangIngu
300 24a3178d djkim
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
301
                        REV_1.IsVisible = true;
302 787a4489 KangIngu
303 24a3178d djkim
                    #region history
304
                    REV_0.IsVisible = true;
305
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
306 787a4489 KangIngu
                    { REV_1.IsVisible = true; REV_0.Width = 70; }
307 24a3178d djkim
                    else
308
                    { REV_0.Width = 140; }
309
                    if (Lists.Where(info => info.REV_2 != null).FirstOrDefault() != null)
310
                        REV_2.IsVisible = true; REV_2.IsVisible = true;
311
                    if (Lists.Where(info => info.REV_3 != null).FirstOrDefault() != null)
312
                        REV_3.IsVisible = true;
313
                    if (Lists.Where(info => info.REV_4 != null).FirstOrDefault() != null)
314
                        REV_4.IsVisible = true;
315
                    if (Lists.Where(info => info.REV_5 != null).FirstOrDefault() != null)
316
                        REV_5.IsVisible = true;
317
                    if (Lists.Where(info => info.REV_6 != null).FirstOrDefault() != null)
318
                        REV_6.IsVisible = true;
319
                    if (Lists.Where(info => info.REV_7 != null).FirstOrDefault() != null)
320
                        REV_7.IsVisible = true;
321
                    if (Lists.Where(info => info.REV_8 != null).FirstOrDefault() != null)
322
                        REV_8.IsVisible = true;
323
                    if (Lists.Where(info => info.REV_9 != null).FirstOrDefault() != null)
324
                        REV_9.IsVisible = true;
325
                    if (Lists.Where(info => info.REV_10 != null).FirstOrDefault() != null)
326
                        REV_10.IsVisible = true;
327
                    if (Lists.Where(info => info.REV_11 != null).FirstOrDefault() != null)
328
                        REV_11.IsVisible = true;
329
                    if (Lists.Where(info => info.REV_12 != null).FirstOrDefault() != null)
330
                        REV_12.IsVisible = true;
331
                    if (Lists.Where(info => info.REV_13 != null).FirstOrDefault() != null)
332
                        REV_13.IsVisible = true;
333
                    if (Lists.Where(info => info.REV_14 != null).FirstOrDefault() != null)
334
                        REV_14.IsVisible = true;
335
                    if (Lists.Where(info => info.REV_15 != null).FirstOrDefault() != null)
336
                        REV_15.IsVisible = true;
337
                    if (Lists.Where(info => info.REV_16 != null).FirstOrDefault() != null)
338
                        REV_16.IsVisible = true;
339
                    if (Lists.Where(info => info.REV_17 != null).FirstOrDefault() != null)
340
                        REV_17.IsVisible = true;
341
                    if (Lists.Where(info => info.REV_18 != null).FirstOrDefault() != null)
342
                        REV_18.IsVisible = true;
343
                    if (Lists.Where(info => info.REV_19 != null).FirstOrDefault() != null)
344
                        REV_19.IsVisible = true;
345
                    #endregion
346
347
                }
348 787a4489 KangIngu
                else
349 24a3178d djkim
                {
350
                    Col_Remark.IsVisible = false;
351
                    Col_Reply.IsVisible = false;
352
                    Col_Vendor.IsVisible = false;
353 787a4489 KangIngu
354 24a3178d djkim
                    #region history
355
                    REV_0.IsVisible = false;
356
                    REV_1.IsVisible = false;
357
                    REV_2.IsVisible = false;
358
                    REV_3.IsVisible = false;
359
                    REV_4.IsVisible = false;
360
                    REV_5.IsVisible = false;
361
                    REV_6.IsVisible = false;
362
                    REV_7.IsVisible = false;
363
                    REV_8.IsVisible = false;
364
                    REV_9.IsVisible = false;
365
                    REV_10.IsVisible = false;
366
                    REV_11.IsVisible = false;
367
                    REV_12.IsVisible = false;
368
                    REV_13.IsVisible = false;
369
                    REV_14.IsVisible = false;
370
                    REV_15.IsVisible = false;
371
                    REV_16.IsVisible = false;
372
                    REV_17.IsVisible = false;
373
                    REV_18.IsVisible = false;
374
                    REV_19.IsVisible = false;
375
                    #endregion
376
                }
377 787a4489 KangIngu
            }
378 24a3178d djkim
            catch (Exception ex)
379 787a4489 KangIngu
            {
380 24a3178d djkim
                Logger.sendResLog("History_Set", ex.Message, 0);
381 787a4489 KangIngu
            }
382 24a3178d djkim
383 787a4489 KangIngu
        }
384
385
        #region Excel Export
386
387
        private void ExportEvent(object sender, RoutedEventArgs e)
388
        {
389 24a3178d djkim
            try
390 787a4489 KangIngu
            {
391 77922798 송근호
                if (mainWindow.dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
392 24a3178d djkim
                {
393
                    DialogMessage_Alert("Capture중 입니다.");
394
                    return;
395
                }
396
                this.ExportIndy.IsBusy = true;
397 787a4489 KangIngu
398 24a3178d djkim
                if (Lists.Count == 0)
399 787a4489 KangIngu
                {
400 24a3178d djkim
                    DialogMessage_Alert("Data Not Found");
401
                    this.ExportIndy.IsBusy = false;
402
                    return;
403
                }
404 787a4489 KangIngu
405 24a3178d djkim
                string extension = "xlsx";
406 84c48033 djkim
                string excelpath = CommonLib.Common.GetConfigString("excelFilePath", "URL", "", App.isExternal);
407 b7637656 djkim
                Uri url = new Uri(excelpath);
408 787a4489 KangIngu
409 24a3178d djkim
                System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog()
410
                {
411
                    DefaultExt = extension,
412
                    Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
413
                    FilterIndex = 1
414
                };
415 787a4489 KangIngu
416 24a3178d djkim
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
417
                {
418
                    using (var client = new System.Net.WebClient())
419
                    {
420
                        client.DownloadFile(url, dialog.FileName);
421 787a4489 KangIngu
422 24a3178d djkim
                        Excel.Application application = null;
423
                        Excel.Workbook workbook = null;
424
                        Excel.Worksheet worksheet = null;
425 787a4489 KangIngu
426 24a3178d djkim
                        try
427 787a4489 KangIngu
                        {
428 24a3178d djkim
                            // Excel 첫번째 워크시트 가져오기                
429
                            application = new Excel.Application();
430
                            workbook = application.Workbooks.Open(dialog.FileName);
431
                            worksheet = (Excel.Worksheet)workbook.Worksheets.get_Item("Sheet1");
432
433
                            // 데이타 넣기
434
                            int h = 9;
435
                            int w = 2;
436
                            string project_no = App.ViewInfo.ProjectNO;
437
                            worksheet.Cells[2, w + 8] = project_no;
438
                            Logger.sendReqLog("GetProjectName: ", project_no, 1);
439
440
                            string project_name = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetProjectName(project_no);
441
                            if (project_name != null || project_name != "")
442
                            {
443
                                Logger.sendResLog("GetProjectName", "TRUE", 1);
444
                            }
445
                            else
446
                            {
447
                                Logger.sendResLog("GetProjectName", "FALSE", 1);
448
                            }
449
                            worksheet.Cells[3, w + 8] = project_name;
450 787a4489 KangIngu
451 77922798 송근호
                            worksheet.Cells[4, w + 8] = (mainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
452
                            worksheet.Cells[5, w + 8] = (mainWindow as MainWindow).dzMainMenu.userData.NAME + " (" + App.ViewInfo.UserID + ")";
453 24a3178d djkim
                            worksheet.Cells[6, w + 8] = DateTime.Now.ToString("yyyy.MM.dd");
454 787a4489 KangIngu
455 24a3178d djkim
                            Excel.Range Range_I = worksheet.Range["K9"];
456
                            Excel.Range Range_O = null;
457
                            Excel.Borders border_ = null;
458 787a4489 KangIngu
459 24a3178d djkim
                            var Rev = Lists.Select(info => info.REVISION).Distinct();
460
                            string[] Cell = { "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T" };
461
                            string[] Range = { "L9", "M9", "N9", "O9", "P9", "Q9", "R9", "S9", "T9", "U9", "V9", "W9", "X9", "Y9", "Z9", "AA9", "AB9", "AC9", "AD9" };
462
                            string Ran = "K";
463 787a4489 KangIngu
464 24a3178d djkim
                            for (int i = 0; i < rev_cnt - 1; i++)
465
                            {
466
                                worksheet.Cells[9, 12 + i] = Cell[i];
467
                                Range_O = worksheet.Range[Range[i]];
468
                                border_ = Range_O.Borders;
469
                                border_.LineStyle = Range_I.Borders.LineStyle;
470
                                border_.Weight = Range_I.Borders.Weight;
471
                                Range_O.Interior.Color = Range_I.Interior.Color;
472
                            }
473 787a4489 KangIngu
474 24a3178d djkim
                            worksheet.Range[worksheet.Cells[8, 11], worksheet.Cells[8, 11 + rev_cnt - 1]].Merge();
475 787a4489 KangIngu
476 24a3178d djkim
                            if (rev_cnt != 1)
477 787a4489 KangIngu
                            {
478 24a3178d djkim
                                Ran = Range[rev_cnt - 2].Substring(0, Range[rev_cnt - 2].Length - 1);
479
                            }
480
                            Excel.Range iRange = worksheet.Range["B10:" + Ran + "10"];
481 787a4489 KangIngu
482 24a3178d djkim
                            //필터 기능 추가
483
                            Excel.Range Filter_Range = worksheet.Range["B9:" + Ran + "9"];
484
                            Filter_Range.AutoFilter(1, Type.Missing, Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
485 787a4489 KangIngu
486 24a3178d djkim
                            Lists.ForEach(data =>
487
                            {
488
                                h++;
489 787a4489 KangIngu
490 24a3178d djkim
                                Excel.Range oRange = worksheet.Range["B" + h + ":" + Ran + h];
491
                                oRange.RowHeight = iRange.RowHeight;
492
                                Excel.Borders border = oRange.Borders;
493
                                border.LineStyle = Excel.XlLineStyle.xlContinuous;
494
                                border.Weight = 2d;
495 787a4489 KangIngu
496 24a3178d djkim
                                if (data.IMAGE_PATH != null)
497 787a4489 KangIngu
                                {
498 24a3178d djkim
                                    Excel.Range ImageRange = worksheet.Cells[h, w + 2];
499
500
                                    System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH);
501
                                    System.Drawing.Image o_Image = Resize(I_Image, 80, 80);
502
                                    System.Windows.Forms.Clipboard.SetDataObject(o_Image, true);
503
504
                                    ImageRange.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenterAcrossSelection;
505
                                    ImageRange.Cells.VerticalAlignment = Excel.XlHAlign.xlHAlignCenter;
506
507
                                    worksheet.Paste(ImageRange.Cells, "TEST");
508 787a4489 KangIngu
509 24a3178d djkim
                                    foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes)
510
                                    {
511
                                        if (shp.TopLeftCell.Address != ImageRange.Address)
512
                                            continue;
513 787a4489 KangIngu
514 24a3178d djkim
                                        double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
515
                                        double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
516 787a4489 KangIngu
517 24a3178d djkim
                                        shp.Left = float.Parse(Left.ToString());
518
                                        shp.Top = float.Parse(Top.ToString());
519
520
                                        break;
521
                                    }
522 787a4489 KangIngu
                                }
523
524 24a3178d djkim
                                #region Excel Bind
525
                                worksheet.Cells[h, w] = data.REVISION;
526
                                worksheet.Cells[h, w + 1] = data.PAGENUMBER;
527
                                worksheet.Cells[h, w + 3] = data.TODOLIST;
528
                                worksheet.Cells[h, w + 4] = data.STATUS.ToUpper() == "TRUE" ? "closed" : "open";
529
                                worksheet.Cells[h, w + 5] = data.STATUS_DESC;
530
                                worksheet.Cells[h, w + 6] = data.VENDOR;
531
                                worksheet.Cells[h, w + 7] = data.REMARK;
532
                                worksheet.Cells[h, w + 8] = data.REPLY;
533
                                worksheet.Cells[h, w + 9] = data.REV_0 == null ? "" : data.REV_0.Replace("", " / ");
534
                                worksheet.Cells[h, w + 10] = data.REV_1 == null ? "" : data.REV_1.Replace("", " / ");
535
                                worksheet.Cells[h, w + 11] = data.REV_2 == null ? "" : data.REV_2.Replace("", " / ");
536
                                worksheet.Cells[h, w + 12] = data.REV_3 == null ? "" : data.REV_3.Replace("", " / ");
537
                                worksheet.Cells[h, w + 13] = data.REV_4 == null ? "" : data.REV_4.Replace("", " / ");
538
                                worksheet.Cells[h, w + 14] = data.REV_5 == null ? "" : data.REV_5.Replace("", " / ");
539
                                worksheet.Cells[h, w + 15] = data.REV_6 == null ? "" : data.REV_6.Replace("", " / ");
540
                                worksheet.Cells[h, w + 16] = data.REV_7 == null ? "" : data.REV_7.Replace("", " / ");
541
                                worksheet.Cells[h, w + 17] = data.REV_8 == null ? "" : data.REV_8.Replace("", " / ");
542
                                worksheet.Cells[h, w + 18] = data.REV_9 == null ? "" : data.REV_9.Replace("", " / ");
543
                                worksheet.Cells[h, w + 19] = data.REV_10 == null ? "" : data.REV_10.Replace("", " / ");
544
                                worksheet.Cells[h, w + 20] = data.REV_11 == null ? "" : data.REV_11.Replace("", " / ");
545
                                worksheet.Cells[h, w + 21] = data.REV_12 == null ? "" : data.REV_12.Replace("", " / ");
546
                                worksheet.Cells[h, w + 22] = data.REV_13 == null ? "" : data.REV_13.Replace("", " / ");
547
                                worksheet.Cells[h, w + 23] = data.REV_14 == null ? "" : data.REV_14.Replace("", " / ");
548
                                worksheet.Cells[h, w + 24] = data.REV_15 == null ? "" : data.REV_15.Replace("", " / ");
549
                                worksheet.Cells[h, w + 25] = data.REV_16 == null ? "" : data.REV_16.Replace("", " / ");
550
                                worksheet.Cells[h, w + 26] = data.REV_17 == null ? "" : data.REV_17.Replace("", " / ");
551
                                worksheet.Cells[h, w + 27] = data.REV_18 == null ? "" : data.REV_18.Replace("", " / ");
552
                                worksheet.Cells[h, w + 28] = data.REV_19 == null ? "" : data.REV_19.Replace("", " / ");
553
                                #endregion
554
                            });
555
556
                            worksheet.Columns.AutoFit();
557
                            // 엑셀파일 저장
558
                            workbook.Save();
559
                            workbook.Close(true);
560
                            application.Quit();
561 787a4489 KangIngu
                        }
562 24a3178d djkim
                        finally
563
                        {
564
                            System.Diagnostics.Process[] ExCel = System.Diagnostics.Process.GetProcessesByName("EXCEL");
565
                            if (ExCel.Count() != 0)
566
                            {
567
                                ExCel[0].Kill();
568
                            }
569 787a4489 KangIngu
570 24a3178d djkim
                            // Clean up
571
                            ReleaseExcelObject(worksheet);
572
                            ReleaseExcelObject(workbook);
573
                            ReleaseExcelObject(application);
574
                        }
575 787a4489 KangIngu
                    }
576 24a3178d djkim
                    DialogMessage_Alert("Success");
577 787a4489 KangIngu
                }
578 24a3178d djkim
579
                this.ExportIndy.IsBusy = false;
580
            }
581
            catch (Exception ex)
582
            {
583
                Logger.sendResLog("CheckList ExportEvent", ex.Message, 0);
584 787a4489 KangIngu
            }
585
586
        }
587
588
        public System.Drawing.Image byteArrayToImage(byte[] byteArrayIn)
589
        {
590
            using (var ms = new System.IO.MemoryStream(byteArrayIn))
591
            {
592
                return System.Drawing.Image.FromStream(ms);
593
            }
594
        }
595
596
        public System.Drawing.Image Resize(System.Drawing.Image image, int newWidth, int maxHeight)
597
        {
598
            //if (onlyResizeIfWider && image.Width <= newWidth) newWidth = image.Width;
599
600 24a3178d djkim
            try
601 787a4489 KangIngu
            {
602 24a3178d djkim
                var newHeight = image.Height * newWidth / image.Width;
603
                if (newHeight > maxHeight)
604
                {
605
                    // Resize with height instead  
606
                    newWidth = image.Width * maxHeight / image.Height;
607
                    newHeight = maxHeight;
608
                }
609 787a4489 KangIngu
610 24a3178d djkim
                var res = new System.Drawing.Bitmap(newWidth, newHeight);
611 787a4489 KangIngu
612 24a3178d djkim
                using (var graphic = System.Drawing.Graphics.FromImage(res))
613
                {
614
                    graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
615
                    graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
616
                    graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
617
                    graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
618
                    graphic.DrawImage(image, 0, 0, newWidth, newHeight);
619
                }
620
                return res;
621
            }
622
            catch (Exception ex)
623 787a4489 KangIngu
            {
624 24a3178d djkim
                Logger.sendResLog("Resize", ex.Message, 0);
625
                return null;
626 787a4489 KangIngu
            }
627 90e7968d ljiyeon
            
628 787a4489 KangIngu
629 90e7968d ljiyeon
            
630 787a4489 KangIngu
        }
631
632
        private static void ReleaseExcelObject(object obj)
633
        {
634
            try
635
            {
636
                if (obj != null)
637
                {
638
                    obj = null;
639
                }
640
            }
641
            catch (Exception ex)
642
            {
643
                obj = null;
644
                throw ex;
645
            }
646
            finally
647
            {
648
                GC.Collect();
649
            }
650
        }
651
652
        #endregion
653
654
        #region 이벤트
655
656
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
657
        {
658
            ChangeSize(e.NewSize.Width, e.NewSize.Height);
659
        }
660
661
        private void CheckList_Loaded(object sender, RoutedEventArgs e)
662
        {
663 24a3178d djkim
            DataBind();
664
            this.tb.ItemsSource = null;
665
            this.tb.ItemsSource = Lists;
666
            History_Set();
667 787a4489 KangIngu
        }
668 90e7968d ljiyeon
        
669 787a4489 KangIngu
        private void RadGridView_Loaded(object sender, RoutedEventArgs e)
670
        {
671
            DataBind();
672
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = null;
673
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = Lists;
674
675
            ChangeSize(this.ActualWidth, this.ActualHeight);
676
            this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
677
        }
678
679
        private void AddEvent(object sender, RoutedEventArgs e)
680
        {
681 24a3178d djkim
            try
682
            {
683 77922798 송근호
                mainWindow.Focus();
684 24a3178d djkim
685 24678e06 humkyung
                Common.ViewerDataModel.Instance.CheckList_ID = Commons.shortGuid();
686 24a3178d djkim
                Common.ViewerDataModel.Instance.Capture_Opacity = 0.5;
687 77922798 송근호
                (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
688 24a3178d djkim
            }
689 90e7968d ljiyeon
            catch(Exception ex)
690 24a3178d djkim
            {
691
                Logger.sendResLog("Checklist Addevent", ex.Message, 0);
692
            }
693 90e7968d ljiyeon
            
694 787a4489 KangIngu
        }
695
696
        private void SaveEvent(object sender, RoutedEventArgs e)
697
        {
698 24a3178d djkim
            try
699 787a4489 KangIngu
            {
700 77922798 송근호
                if ((mainWindow as MainWindow).dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
701 0f065e57 ljiyeon
                {
702 24a3178d djkim
                    DialogMessage_Alert("Capture중 입니다.");
703
                    return;
704 0f065e57 ljiyeon
                }
705 24a3178d djkim
                CHECK_LIST Check_value = new CHECK_LIST();
706
                CHECK_LIST_HISTORY Check_History = new CHECK_LIST_HISTORY();
707 0f065e57 ljiyeon
708 24a3178d djkim
                foreach (var item in tb.Items)
709 787a4489 KangIngu
                {
710 24a3178d djkim
                    string Check_ID = (item as Customer).ID.ToString();
711
                    string state = "";
712
713
                    Logger.sendReqLog("GetCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
714
                    Check_value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckList(App.ViewInfo.ProjectNO, Check_ID);
715
                    if (Check_value != null)
716 6c781c0c djkim
                    {
717 24a3178d djkim
                        Logger.sendResLog("GetCheckList", "TRUE", 1);
718
                    }
719 6c781c0c djkim
                    else
720
                    {
721 24a3178d djkim
                        Logger.sendResLog("GetCheckList", "FALSE", 1);
722 6c781c0c djkim
                    }
723 787a4489 KangIngu
724 24a3178d djkim
                    if (Check_value != null)
725 787a4489 KangIngu
                    {
726 24a3178d djkim
                        if ((item as Customer).STATUS.ToUpper() == "TRUE")
727 0f065e57 ljiyeon
                        {
728 24a3178d djkim
                            state = "Closed";
729
                            Check_value.STATUS_DESC_CLOSE = (item as Customer).STATUS_DESC;
730 0f065e57 ljiyeon
                        }
731
                        else
732
                        {
733 24a3178d djkim
                            state = "Open";
734
                            Check_value.STATUS_DESC_OPEN = (item as Customer).STATUS_DESC;
735 0f065e57 ljiyeon
                        }
736 787a4489 KangIngu
737 24a3178d djkim
                        string Rev = state + "" + DateTime.Now.ToString("yyyy.MM.dd");
738
                        string description = "";
739 787a4489 KangIngu
740 24a3178d djkim
                        if (char.Parse(ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision) >= char.Parse(Check_value.REVISION))
741 6c781c0c djkim
                        {
742 24a3178d djkim
                            Check_value.REMARK = (item as Customer).REMARK;
743
                            Check_value.STATUS = (item as Customer).STATUS;
744
                            Check_value.TODOLIST = (item as Customer).TODOLIST;
745
                            Check_value.VENDOR = (item as Customer).VENDOR;
746
                            Check_value.REPLY = (item as Customer).REPLY;
747
748
                            if ((item as Customer).STATUS == "False")
749
                                description = Check_value.STATUS_DESC_OPEN;
750
                            else
751
                                description = Check_value.STATUS_DESC_CLOSE;
752 787a4489 KangIngu
753 24a3178d djkim
                            Logger.sendReqLog("GetCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
754
                            var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(App.ViewInfo.ProjectNO, Check_ID);
755
                            if (history.Count() > 0)
756 787a4489 KangIngu
                            {
757 24a3178d djkim
                                Logger.sendResLog("GetCheckList", "TRUE", 1);
758 787a4489 KangIngu
                            }
759 6c781c0c djkim
                            else
760 787a4489 KangIngu
                            {
761 24a3178d djkim
                                Logger.sendResLog("GetCheckList", "FALSE", 1);
762
                            }
763
                            Check_History = history.Where(info => info.REVISION == ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision).FirstOrDefault();
764
765
                            List<string> validation = new List<string>();
766
767
                            foreach (var his in history)
768
                            {
769
                                if (his.TODOLIST == Check_value.TODOLIST)
770
                                    validation.Add("TODOLIST");
771
                                if (his.STATUS_DESC == description)
772
                                    validation.Add("STATUS_DESC");
773
                                if (his.VENDOR == Check_value.VENDOR)
774
                                    validation.Add("VENDOR");
775
                                if (his.REMARK == Check_value.REMARK)
776
                                    validation.Add("REMARK");
777
                                if (his.REPLY == Check_value.REPLY)
778
                                    validation.Add("REPLY");
779
                            }
780
781
                            if (validation.Count < 5)
782
                            {
783
                                if (Check_History == null)
784 5de0c110 ljiyeon
                                {
785 24a3178d djkim
                                    Check_History = new CHECK_LIST_HISTORY()
786
                                    {
787 24678e06 humkyung
                                        ID = Commons.shortGuid(),
788 24a3178d djkim
                                        CHECKLIST_ID = Check_ID,
789
                                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
790
                                        STATUS = state,
791
                                        IMAGE_URL = Check_value.IMAGE_URL,
792
                                        STATUS_DESC = validation.Where(i => i.ToString() == "STATUS_DESC").FirstOrDefault() == null ? description : "",
793
                                        TODOLIST = validation.Where(i => i.ToString() == "TODOLIST").FirstOrDefault() == null ? Check_value.TODOLIST : "",
794
                                        VENDOR = validation.Where(i => i.ToString() == "VENDOR").FirstOrDefault() == null ? Check_value.VENDOR : "",
795
                                        REMARK = validation.Where(i => i.ToString() == "REMARK").FirstOrDefault() == null ? Check_value.REMARK : "",
796
                                        REPLY = validation.Where(i => i.ToString() == "REPLY").FirstOrDefault() == null ? Check_value.REPLY : "",
797
                                        CREATE_TIME = DateTime.Now,
798
                                        UPDATE_TIME = DateTime.Now
799
                                    };
800
801
                                    Logger.sendReqLog("AddCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_History, 1);
802
                                    Logger.sendResLog("AddCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History).ToString(), 1);
803
                                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History);
804
805
                                    Check_value.REVISION = Current_Revision;
806 5de0c110 ljiyeon
                                }
807
                                else
808
                                {
809 24a3178d djkim
                                    Check_History.IMAGE_URL = Check_value.IMAGE_URL;
810
                                    Check_History.STATUS = state;
811
                                    Check_History.TODOLIST = Check_value.TODOLIST;
812
                                    Check_History.VENDOR = Check_value.VENDOR;
813
                                    Check_History.REMARK = Check_value.REMARK;
814
                                    Check_History.REPLY = Check_value.REPLY;
815
                                    Check_History.UPDATE_TIME = DateTime.Now;
816
                                    if (state == "Open")
817
                                    {
818
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_OPEN;
819
                                    }
820
                                    else
821
                                    {
822
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_CLOSE;
823
                                    }
824
825
                                    Logger.sendReqLog("SaveCheckListHistory: ", App.ViewInfo.ProjectNO + "," + ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision + "," + Check_History, 1);
826
                                    Logger.sendResLog("SaveCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History).ToString(), 1);
827
828
                                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History);
829 5de0c110 ljiyeon
                                }
830 787a4489 KangIngu
                            }
831 24a3178d djkim
                            validation = new List<string>();
832 787a4489 KangIngu
                        }
833
                    }
834 24a3178d djkim
835
                    Logger.sendReqLog("SaveCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID + "," + Check_value, 1);
836
                    Logger.sendResLog("SaveCheckList", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value).ToString(), 1);
837
                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value);
838 787a4489 KangIngu
                }
839 0f065e57 ljiyeon
840 24a3178d djkim
                DataBind();
841
                tb.ItemsSource = null;
842
                tb.ItemsSource = Lists;
843
                History_Set();
844
845
                DialogMessage_Alert("Success");
846
            }
847
            catch (Exception ex)
848
            {
849
                Logger.sendResLog("Checklist SaveEvent", ex.Message, 0);
850 787a4489 KangIngu
            }
851 90e7968d ljiyeon
                       
852 787a4489 KangIngu
        }
853
854
        private void CheckListEvent(object sender, RoutedEventArgs e)
855
        {
856
            if (col1.Width == new GridLength(1200))
857
            {
858
                this.Width += 600;
859
                col1.Width = new GridLength(1800);
860
            }
861
            else
862
            {
863
                this.Width -= 600;
864
                col1.Width = new GridLength(1200);
865
            }
866
            History_Set();
867
        }
868
869
        private void CommentMoveEvent(object sender, MouseButtonEventArgs e)
870
        {
871
            SyncInit();
872
873
            Rect rect = new Rect();
874
            string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
875
            //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
876
877
            rect = new Rect(new Point(double.Parse(RectPoint[0]), double.Parse(RectPoint[1])), new Point(double.Parse(RectPoint[0]) + double.Parse(RectPoint[2]), double.Parse(RectPoint[1]) + double.Parse(RectPoint[3])));
878
879
            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
880
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
881
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
882 77922798 송근호
            mainWindow.Focus();
883 787a4489 KangIngu
        }
884
885
        private void CaptureEvent(object sender, MouseButtonEventArgs e)
886
        {
887
            SyncInit();
888
889
            //캡쳐 하기 전에 코멘트 저장
890 77922798 송근호
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (mainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
891 787a4489 KangIngu
            {
892 77922798 송근호
                var menu = (mainWindow as MainWindow).dzMainMenu;
893 077896be humkyung
                SelectionSet.Instance.UnSelect(menu);
894 787a4489 KangIngu
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
895
                {
896 77922798 송근호
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
897 787a4489 KangIngu
                }
898
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
899
                {
900
901
                }
902
                else
903
                {
904 77922798 송근호
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
905 787a4489 KangIngu
                }
906
            }
907
908
            //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
909
            Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
910 24a3178d djkim
            //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
911 77922798 송근호
            mainWindow.Focus();
912 787a4489 KangIngu
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
913 77922798 송근호
            (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
914 787a4489 KangIngu
        }
915
916
        public void KeyEventDownAction(object sender, KeyEventArgs e)
917
        {
918
            switch (e.Key)
919
            {
920
                case Key.Escape:
921
                    {
922 77922798 송근호
                        (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
923 787a4489 KangIngu
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0;
924
                    }
925
                    break;
926
            }
927
        }
928
929
        private void tb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
930
        {
931 24a3178d djkim
            try
932 787a4489 KangIngu
            {
933 24a3178d djkim
                if (ViewerDataModel.Instance.Capture_Opacity == 0)
934
                    return;
935
936
                DataBind();
937
                tb.ItemsSource = null;
938
                tb.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
939
                //tb1.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
940 787a4489 KangIngu
941 24a3178d djkim
                if (ViewerDataModel.Instance.Capture_Opacity == 0.5)
942 787a4489 KangIngu
                {
943 24a3178d djkim
                    tb.SortDescriptors.Clear();
944
                    tb.FilterDescriptors.Clear();
945 787a4489 KangIngu
946 24a3178d djkim
                    var scrollViewer = this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
947
                    if (scrollViewer != null)
948
                    {
949
                        //this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
950
                        //this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
951 787a4489 KangIngu
952 24a3178d djkim
                        tb.ScrollIndexIntoView(tb.Items.Count - 1);
953
                        tb.CurrentCellInfo = new GridViewCellInfo(tb.Items[tb.Items.Count - 1], tb.Columns["TODOLIST"]);
954
                        tb.Focus();
955
956
                    }
957 787a4489 KangIngu
                }
958
            }
959 90e7968d ljiyeon
            catch(Exception ex)
960 24a3178d djkim
            {
961
                Logger.sendResLog("tb_IsVisibleChanged", ex.Message, 0);
962
            }
963 90e7968d ljiyeon
            
964 787a4489 KangIngu
        }
965
966
        private void Radio_Open_Checked(object sender, RoutedEventArgs e)
967
        {
968 24a3178d djkim
            try
969 787a4489 KangIngu
            {
970 24a3178d djkim
                (e.Source as RadioButton).Foreground = Brushes.Red;
971
                (e.Source as RadioButton).FontWeight = FontWeights.Bold;
972 787a4489 KangIngu
973 24a3178d djkim
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
974 787a4489 KangIngu
                {
975 24a3178d djkim
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Open";
976
                }
977
978
                if (Isinit)
979
                {
980
                    Isinit = false;
981
                    if ((e.Source as RadioButton).DataContext != null)
982 787a4489 KangIngu
                    {
983 24a3178d djkim
                        if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 필요")
984
                        {
985
                            ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 필요";
986 787a4489 KangIngu
987 24a3178d djkim
                            tb.Rebind();
988
                        }
989 787a4489 KangIngu
                    }
990
                }
991
            }
992 90e7968d ljiyeon
            catch(Exception ex)
993 24a3178d djkim
            {
994
                Logger.sendResLog("Radio_Open_Checked", ex.Message, 0);
995
            }
996 90e7968d ljiyeon
            
997 787a4489 KangIngu
        }
998
999
        private void Radio_Close_Checked(object sender, RoutedEventArgs e)
1000
        {
1001 24a3178d djkim
            try
1002 69ef0800 KangIngu
            {
1003 24a3178d djkim
                if (Isinit)
1004 69ef0800 KangIngu
                {
1005 24a3178d djkim
                    if (!isCheck_Status)
1006
                    {
1007
                        Select_StatusID = ((e.Source as RadioButton).DataContext as Customer).ID;
1008 69ef0800 KangIngu
1009 24a3178d djkim
                        isCheck_Status = true;
1010 69ef0800 KangIngu
1011 24a3178d djkim
                        RadWindow CheckPop = new RadWindow();
1012 69ef0800 KangIngu
1013 24a3178d djkim
                        CheckList_Status check = new CheckList_Status();
1014 69ef0800 KangIngu
1015 24a3178d djkim
                        CheckPop = new RadWindow
1016
                        {
1017
                            MinWidth = 350,
1018
                            MinHeight = 150,
1019
                            Header = "Status Description을 입력하세요",
1020
                            Content = check,
1021
                            ResizeMode = System.Windows.ResizeMode.NoResize,
1022
                            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1023
                            IsTopmost = true,
1024
                        };
1025
                        StyleManager.SetTheme(CheckPop, new Office2013Theme());
1026
                        CheckPop.Closed += CheckPop_Closed;
1027
                        CheckPop.Show();
1028
1029
                        Isinit = false;
1030
                        tb.Rebind();
1031
                    }
1032 69ef0800 KangIngu
                }
1033 787a4489 KangIngu
1034
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
1035
1036 24a3178d djkim
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
1037
                {
1038
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Close";
1039
                }
1040
            }
1041 90e7968d ljiyeon
            catch(Exception ex)
1042 787a4489 KangIngu
            {
1043 24a3178d djkim
                Logger.sendResLog("Radio_Close_Checked", ex.Message, 0);
1044 787a4489 KangIngu
            }
1045 90e7968d ljiyeon
            
1046 69ef0800 KangIngu
        }
1047 787a4489 KangIngu
1048 69ef0800 KangIngu
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1049
        {
1050 24a3178d djkim
            try
1051 787a4489 KangIngu
            {
1052 24a3178d djkim
                isCheck_Status = false;
1053
1054
                foreach (var item in tb.Items)
1055 787a4489 KangIngu
                {
1056 24a3178d djkim
                    if (Select_StatusID == (item as Customer).ID.ToString())
1057 69ef0800 KangIngu
                    {
1058 24a3178d djkim
                        if (ViewerDataModel.Instance.CheckStatus != "" && ViewerDataModel.Instance.CheckStatus != null)
1059
                        {
1060
                            (item as Customer).STATUS_DESC = ViewerDataModel.Instance.CheckStatus;
1061
                        }
1062
                        else
1063
                        {
1064
                            (item as Customer).STATUS = "False";
1065
                            (item as Customer)._STATUS = "Open";
1066
                            (item as Customer).STATUS_ = "True";
1067
                        }
1068 69ef0800 KangIngu
1069 24a3178d djkim
                        ViewerDataModel.Instance.CheckStatus = "";
1070
                        Select_StatusID = "";
1071
                        tb.Rebind();
1072
                        return;
1073
                    }
1074 787a4489 KangIngu
                }
1075
            }
1076 90e7968d ljiyeon
            catch(Exception ex)
1077 24a3178d djkim
            {
1078
                Logger.sendResLog("CheckPop_Closed", ex.Message, 0);
1079
            }
1080 90e7968d ljiyeon
            
1081 69ef0800 KangIngu
1082 787a4489 KangIngu
        }
1083
1084
        private void Radio_Unchecked(object sender, RoutedEventArgs e)
1085
        {
1086 24a3178d djkim
            try
1087
            {
1088
                (e.Source as RadioButton).Foreground = Brushes.Black;
1089
                (e.Source as RadioButton).FontWeight = FontWeights.Normal;
1090
            }
1091 90e7968d ljiyeon
            catch(Exception ex)
1092 24a3178d djkim
            {
1093
                Logger.sendResLog("Radio_Unchecked", ex.Message, 0);
1094
            }
1095 90e7968d ljiyeon
            
1096 787a4489 KangIngu
        }
1097
1098
        private void mousedownOnImage(object sender, MouseButtonEventArgs args)
1099
        {
1100 24a3178d djkim
            try
1101 787a4489 KangIngu
            {
1102 24a3178d djkim
                if (args.OriginalSource as TextBlock != null && (args.OriginalSource as TextBlock).Parent != null)
1103 787a4489 KangIngu
                {
1104 24a3178d djkim
                    if ((args.OriginalSource as TextBlock).Parent.GetType().Name == "GridViewHeaderCell")
1105
                    {
1106
                        Isinit = false;
1107
                        return;
1108
                    }
1109 787a4489 KangIngu
                }
1110
1111 24a3178d djkim
                Isinit = true;
1112 787a4489 KangIngu
1113 24a3178d djkim
                RadWindow CheckPop = new RadWindow();
1114 787a4489 KangIngu
1115 24a3178d djkim
                if (args.OriginalSource is Image)
1116
                {
1117
                    Image img = (args.OriginalSource as Image);
1118
                    if (img.Height != 45)
1119
                        return;
1120 787a4489 KangIngu
1121 24a3178d djkim
                    CommantImage check = new CommantImage(img);
1122 787a4489 KangIngu
1123 24a3178d djkim
                    CheckPop = new RadWindow
1124
                    {
1125
                        MinWidth = 500,
1126
                        MinHeight = 500,
1127
                        Header = "Image",
1128
                        Content = check,
1129
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1130
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1131
                        IsTopmost = true,
1132
                    };
1133
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1134
                    CheckPop.Show();
1135
                }
1136
1137
                if (args.OriginalSource as TextBlock == null || (args.OriginalSource as TextBlock).Parent == null || ((args.OriginalSource as TextBlock).Parent) as GridViewCell == null)
1138 787a4489 KangIngu
                {
1139 24a3178d djkim
                    return;
1140
                }
1141 787a4489 KangIngu
1142 24a3178d djkim
                if ((((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.ColumnGroupName.ToString() == "History")
1143
                {
1144 787a4489 KangIngu
1145 24a3178d djkim
                    CheckList_Detail Detail = new CheckList_Detail((((args.OriginalSource as TextBlock).Parent as GridViewCell).ParentRow.Item as KCOM.Controls.Customer).ID, (((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.Header.ToString());
1146 787a4489 KangIngu
1147 24a3178d djkim
                    CheckPop = new RadWindow
1148
                    {
1149
                        MinWidth = 800,
1150
                        MinHeight = 400,
1151
                        Header = "Detail",
1152
                        Content = Detail,
1153
                        //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1154
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1155
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1156
                        IsTopmost = true,
1157
                    };
1158
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1159
                    //CheckPop.ShowDialog();
1160
                    CheckPop.Show();
1161
                }
1162
            }
1163 90e7968d ljiyeon
            catch(Exception ex)
1164 24a3178d djkim
            {
1165
                Logger.sendResLog("mousedownOnImage", ex.Message, 0);
1166 787a4489 KangIngu
            }
1167 90e7968d ljiyeon
            
1168 24a3178d djkim
1169 787a4489 KangIngu
        }
1170
1171
        private void SyncEvent(object sender, MouseButtonEventArgs e)
1172
        {
1173 24a3178d djkim
            try
1174 0f065e57 ljiyeon
            {
1175 24a3178d djkim
                old_DocID = ((e.Source as Image).DataContext as Customer).DOCUMENT_ID;
1176
                if (old_DocID.Equals(Current_Revision))
1177
                {
1178
                    DialogMessage_Alert("같은 Revision 은 비교할 수 없습니다.");
1179
                    return;
1180
                }
1181
                Logger.sendReqLog("GetVPRevisionFirstOrDefault: ", App.ViewInfo.ProjectNO + "," + old_DocID, 1);
1182
                var _vpList = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVPRevisionFirstOrDefault(App.ViewInfo.ProjectNO, old_DocID);
1183
                if (_vpList != null)
1184
                {
1185
                    Logger.sendResLog("GetVPRevisionFirstOrDefault", "TRUE", 1);
1186
                }
1187
                else
1188
                {
1189
                    Logger.sendResLog("GetVPRevisionFirstOrDefault", "FALSE", 1);
1190
                }
1191
1192 0f065e57 ljiyeon
1193 787a4489 KangIngu
1194 24a3178d djkim
                SyncInit();
1195
                Rect rect = new Rect();
1196
                string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
1197
                rect = new Rect(new Point(double.Parse(RectPoint[0]), double.Parse(RectPoint[1])), new Point(double.Parse(RectPoint[0]) + double.Parse(RectPoint[2]), double.Parse(RectPoint[1]) + double.Parse(RectPoint[3])));
1198
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
1199
                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.Sync_ZoomTo(rect);
1200 77922798 송근호
                (mainWindow as MainWindow).dzMainMenu.Sync_Event(_vpList);
1201 24a3178d djkim
1202
            }
1203
            catch (Exception ex)
1204 787a4489 KangIngu
            {
1205 24a3178d djkim
                Logger.sendResLog("SyncEvent", ex.Message, 0);
1206 787a4489 KangIngu
            }
1207 90e7968d ljiyeon
            
1208 787a4489 KangIngu
        }
1209
1210
        #endregion
1211
    }
1212
}
클립보드 이미지 추가 (최대 크기: 500 MB)