프로젝트

일반

사용자정보

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

markus / KCOM / Controls / CheckList.xaml.cs @ 274cde11

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

1
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
using System.Text.RegularExpressions;
26

    
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
    } 
72
    #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
        MainWindow mainWindow;
83
        //string old_Revision = "";
84
        string old_DocID = "";
85
        string Current_Revision = "";
86
        //string Current_DocNo = "";
87
        //string Current_Slip = "";
88
        bool Isinit = false;
89
        int rev_cnt = 1;
90
        bool isCheck_Status = false;
91
        string Select_StatusID = "";
92
        #endregion
93

    
94
        #region 생성자
95
        public CheckList(MainWindow main)
96
        {
97
            Common.ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
98
            InitializeComponent();
99
            mainWindow = main;
100
            this.Loaded += CheckList_Loaded;
101
            this.KeyDown += new KeyEventHandler(KeyEventDownAction);
102
            this.AddHandler(Image.MouseLeftButtonDownEvent, new MouseButtonEventHandler(mousedownOnImage), true);
103
            
104

    
105
        }
106
        #endregion
107

    
108
        public void DataBind()
109
        {
110
            try
111
            {
112
                Isinit = false;
113

    
114
                Lists = new List<Customer>();
115
                string doc_no = mainWindow.dzMainMenu._DocItem.DOCUMENT_NO;
116
                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

    
131
                foreach (var item in items)
132
                {
133
                    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
                    //Logger.sendReqLog("GetCheckListHistory: ", project_no + "," + item.ID, 1);
145
                    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
                    foreach (var rev in history)
157
                    {
158
                        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

    
201
                    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

    
209
                    if (item.STATUS == "True")
210
                    {
211
                        customer._STATUS = "Close";
212
                        customer.STATUS_ = "False";
213
                        customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
214
                    }
215
                    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
                }
224
            }
225
            catch (Exception ex)
226
            {
227
                Logger.sendResLog("Checklist DataBind", ex.Message, 0);
228
            }
229

    
230

    
231
        }
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
            try
242
            {
243
                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
            }
255
            catch(Exception ex)
256
            {
257
                //Logger.sendResLog("SyncInit", ex.Message, 0);
258
            }
259
            
260
        }
261

    
262
        private void DialogMessage_Alert(string Msg)
263
        {
264
            try
265
            {
266
                RadWindow CheckPop = new RadWindow();
267
                Alert check = new Alert(Msg);
268

    
269
                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
            {
285
                //Logger.sendResLog("DialogMessage_Alert", ex.Message, 0);
286
            }
287

    
288
        }
289

    
290
        private void History_Set()
291
        {
292
            try
293
            {
294
                if (col1.Width != new GridLength(1200))
295
                {
296
                    Col_Remark.IsVisible = true;
297
                    Col_Reply.IsVisible = true;
298
                    Col_Vendor.IsVisible = true;
299

    
300
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
301
                        REV_1.IsVisible = true;
302

    
303
                    #region history
304
                    REV_0.IsVisible = true;
305
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
306
                    { REV_1.IsVisible = true; REV_0.Width = 70; }
307
                    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
                else
349
                {
350
                    Col_Remark.IsVisible = false;
351
                    Col_Reply.IsVisible = false;
352
                    Col_Vendor.IsVisible = false;
353

    
354
                    #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
            }
378
            catch (Exception ex)
379
            {
380
                //Logger.sendResLog("History_Set", ex.Message, 0);
381
            }
382

    
383
        }
384

    
385
        #region Excel Export
386

    
387
        private void ExportEvent(object sender, RoutedEventArgs e)
388
        {
389
            try
390
            {
391
                if (mainWindow.dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
392
                {
393
                    DialogMessage_Alert("Capture중 입니다.");
394
                    return;
395
                }
396
                this.ExportIndy.IsBusy = true;
397

    
398
                if (Lists.Count == 0)
399
                {
400
                    DialogMessage_Alert("Data Not Found");
401
                    this.ExportIndy.IsBusy = false;
402
                    return;
403
                }
404

    
405
                string extension = "xlsx";
406
                string excelpath = CommonLib.Common.GetConfigString("excelFilePath", "URL", "", App.isExternal);
407
                Uri url = new Uri(excelpath);
408

    
409
                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

    
416
                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

    
422
                        Excel.Application application = null;
423
                        Excel.Workbook workbook = null;
424
                        Excel.Worksheet worksheet = null;
425

    
426
                        try
427
                        {
428
                            // 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

    
451
                            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
                            worksheet.Cells[6, w + 8] = DateTime.Now.ToString("yyyy.MM.dd");
454

    
455
                            Excel.Range Range_I = worksheet.Range["K9"];
456
                            Excel.Range Range_O = null;
457
                            Excel.Borders border_ = null;
458

    
459
                            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

    
464
                            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

    
474
                            worksheet.Range[worksheet.Cells[8, 11], worksheet.Cells[8, 11 + rev_cnt - 1]].Merge();
475

    
476
                            if (rev_cnt != 1)
477
                            {
478
                                Ran = Range[rev_cnt - 2].Substring(0, Range[rev_cnt - 2].Length - 1);
479
                            }
480
                            Excel.Range iRange = worksheet.Range["B10:" + Ran + "10"];
481

    
482
                            //필터 기능 추가
483
                            Excel.Range Filter_Range = worksheet.Range["B9:" + Ran + "9"];
484
                            Filter_Range.AutoFilter(1, Type.Missing, Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
485

    
486
                            Lists.ForEach(data =>
487
                            {
488
                                h++;
489

    
490
                                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

    
496
                                if (data.IMAGE_PATH != null)
497
                                {
498
                                    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

    
509
                                    foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes)
510
                                    {
511
                                        if (shp.TopLeftCell.Address != ImageRange.Address)
512
                                            continue;
513

    
514
                                        double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
515
                                        double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
516

    
517
                                        shp.Left = float.Parse(Left.ToString());
518
                                        shp.Top = float.Parse(Top.ToString());
519

    
520
                                        break;
521
                                    }
522
                                }
523

    
524
                                #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
                        }
562
                        finally
563
                        {
564
                            System.Diagnostics.Process[] ExCel = System.Diagnostics.Process.GetProcessesByName("EXCEL");
565
                            if (ExCel.Count() != 0)
566
                            {
567
                                ExCel[0].Kill();
568
                            }
569

    
570
                            // Clean up
571
                            ReleaseExcelObject(worksheet);
572
                            ReleaseExcelObject(workbook);
573
                            ReleaseExcelObject(application);
574
                        }
575
                    }
576
                    DialogMessage_Alert("Success");
577
                }
578

    
579
                this.ExportIndy.IsBusy = false;
580
            }
581
            catch (Exception ex)
582
            {
583
                //Logger.sendResLog("CheckList ExportEvent", ex.Message, 0);
584
            }
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
            try
601
            {
602
                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

    
610
                var res = new System.Drawing.Bitmap(newWidth, newHeight);
611

    
612
                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
            {
624
                //Logger.sendResLog("Resize", ex.Message, 0);
625
                return null;
626
            }
627
            
628

    
629
            
630
        }
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
            DataBind();
664
            this.tb.ItemsSource = null;
665
            this.tb.ItemsSource = Lists;
666
            History_Set();
667
        }
668
        
669
        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
            try
682
            {
683
                mainWindow.Focus();
684

    
685
                Common.ViewerDataModel.Instance.CheckList_ID = Commons.shortGuid();
686
                Common.ViewerDataModel.Instance.Capture_Opacity = 0.5;
687
                (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
688
            }
689
            catch(Exception ex)
690
            {
691
                //Logger.sendResLog("Checklist Addevent", ex.Message, 0);
692
            }
693
            
694
        }
695

    
696
        private void SaveEvent(object sender, RoutedEventArgs e)
697
        {
698
            try
699
            {
700
                if ((mainWindow as MainWindow).dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
701
                {
702
                    DialogMessage_Alert("Capture중 입니다.");
703
                    return;
704
                }
705
                CHECK_LIST Check_value = new CHECK_LIST();
706
                CHECK_LIST_HISTORY Check_History = new CHECK_LIST_HISTORY();
707

    
708
                foreach (var item in tb.Items)
709
                {
710
                    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
                    {
717
                        //Logger.sendResLog("GetCheckList", "TRUE", 1);
718
                    }
719
                    else
720
                    {
721
                        //Logger.sendResLog("GetCheckList", "FALSE", 1);
722
                    }
723

    
724
                    if (Check_value != null)
725
                    {
726
                        if ((item as Customer).STATUS.ToUpper() == "TRUE")
727
                        {
728
                            state = "Closed";
729
                            Check_value.STATUS_DESC_CLOSE = (item as Customer).STATUS_DESC;
730
                        }
731
                        else
732
                        {
733
                            state = "Open";
734
                            Check_value.STATUS_DESC_OPEN = (item as Customer).STATUS_DESC;
735
                        }
736

    
737
                        string Rev = state + "" + DateTime.Now.ToString("yyyy.MM.dd");
738
                        string description = "";
739

    
740
                        if (char.Parse(ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision) >= char.Parse(Check_value.REVISION))
741
                        {
742
                            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

    
753
                            //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
                            {
757
                                //Logger.sendResLog("GetCheckList", "TRUE", 1);
758
                            }
759
                            else
760
                            {
761
                                //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
                                {
785
                                    Check_History = new CHECK_LIST_HISTORY()
786
                                    {
787
                                        ID = Commons.shortGuid(),
788
                                        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
                                    var result = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History).ToString();
802

    
803
                                    Logger.sendReqLog("AddCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_History, 1);
804
                                    Logger.sendResLog("AddCheckListHistory", result, 1);
805

    
806
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History);
807

    
808
                                    Check_value.REVISION = Current_Revision;
809
                                }
810
                                else
811
                                {
812
                                    Check_History.IMAGE_URL = Check_value.IMAGE_URL;
813
                                    Check_History.STATUS = state;
814
                                    Check_History.TODOLIST = Check_value.TODOLIST;
815
                                    Check_History.VENDOR = Check_value.VENDOR;
816
                                    Check_History.REMARK = Check_value.REMARK;
817
                                    Check_History.REPLY = Check_value.REPLY;
818
                                    Check_History.UPDATE_TIME = DateTime.Now;
819
                                    if (state == "Open")
820
                                    {
821
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_OPEN;
822
                                    }
823
                                    else
824
                                    {
825
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_CLOSE;
826
                                    }
827

    
828
                                    Logger.sendReqLog("SaveCheckListHistory: ", App.ViewInfo.ProjectNO + "," + ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision + "," + Check_History, 1);
829
                                    //Logger.sendResLog("SaveCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History).ToString(), 1);
830

    
831
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History);
832
                                }
833
                            }
834
                            validation = new List<string>();
835
                        }
836
                    }
837

    
838
                    Logger.sendReqLog("SaveCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID + "," + Check_value, 1);
839
                    //Logger.sendResLog("SaveCheckList", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value).ToString(), 1);
840
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value);
841
                }
842

    
843
                DataBind();
844
                tb.ItemsSource = null;
845
                tb.ItemsSource = Lists;
846
                History_Set();
847

    
848
                DialogMessage_Alert("Success");
849
            }
850
            catch (Exception ex)
851
            {
852
                //Logger.sendResLog("Checklist SaveEvent", ex.Message, 0);
853
            }
854
                       
855
        }
856

    
857
        private void CheckListEvent(object sender, RoutedEventArgs e)
858
        {
859
            if (col1.Width == new GridLength(1200))
860
            {
861
                this.Width += 600;
862
                col1.Width = new GridLength(1800);
863
            }
864
            else
865
            {
866
                this.Width -= 600;
867
                col1.Width = new GridLength(1200);
868
            }
869
            History_Set();
870
        }
871

    
872
        private void CommentMoveEvent(object sender, MouseButtonEventArgs e)
873
        {
874
            SyncInit();
875

    
876
            Rect rect = new Rect();
877
            string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
878
            //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
879

    
880
            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])));
881

    
882
            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
883
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
884
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
885
            mainWindow.Focus();
886
        }
887

    
888
        private void CaptureEvent(object sender, MouseButtonEventArgs e)
889
        {
890
            SyncInit();
891

    
892
            //캡쳐 하기 전에 코멘트 저장
893
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (mainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
894
            {
895
                var menu = (mainWindow as MainWindow).dzMainMenu;
896
                SelectionSet.Instance.UnSelect(menu);
897
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
898
                {
899
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
900
                }
901
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
902
                {
903

    
904
                }
905
                else
906
                {
907
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
908
                }
909
            }
910

    
911
            //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
912
            Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
913
            //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
914
            mainWindow.Focus();
915
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
916
            (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
917
        }
918

    
919
        public void KeyEventDownAction(object sender, KeyEventArgs e)
920
        {
921
            switch (e.Key)
922
            {
923
                case Key.Escape:
924
                    {
925
                        (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
926
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0;
927
                    }
928
                    break;
929
            }
930
        }
931

    
932
        private void tb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
933
        {
934
            try
935
            {
936
                if (ViewerDataModel.Instance.Capture_Opacity == 0)
937
                    return;
938

    
939
                DataBind();
940
                tb.ItemsSource = null;
941
                tb.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
942
                //tb1.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
943

    
944
                if (ViewerDataModel.Instance.Capture_Opacity == 0.5)
945
                {
946
                    tb.SortDescriptors.Clear();
947
                    tb.FilterDescriptors.Clear();
948

    
949
                    var scrollViewer = this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
950
                    if (scrollViewer != null)
951
                    {
952
                        //this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
953
                        //this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
954

    
955
                        tb.ScrollIndexIntoView(tb.Items.Count - 1);
956
                        tb.CurrentCellInfo = new GridViewCellInfo(tb.Items[tb.Items.Count - 1], tb.Columns["TODOLIST"]);
957
                        tb.Focus();
958

    
959
                    }
960
                }
961
            }
962
            catch(Exception ex)
963
            {
964
                //Logger.sendResLog("tb_IsVisibleChanged", ex.Message, 0);
965
            }
966
            
967
        }
968

    
969
        private void Radio_Open_Checked(object sender, RoutedEventArgs e)
970
        {
971
            try
972
            {
973
                (e.Source as RadioButton).Foreground = Brushes.Red;
974
                (e.Source as RadioButton).FontWeight = FontWeights.Bold;
975

    
976
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
977
                {
978
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Open";
979
                }
980

    
981
                if (Isinit)
982
                {
983
                    Isinit = false;
984
                    if ((e.Source as RadioButton).DataContext != null)
985
                    {
986
                        if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 필요")
987
                        {
988
                            ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 필요";
989

    
990
                            tb.Rebind();
991
                        }
992
                    }
993
                }
994
            }
995
            catch(Exception ex)
996
            {
997
                //Logger.sendResLog("Radio_Open_Checked", ex.Message, 0);
998
            }
999
            
1000
        }
1001

    
1002
        private void Radio_Close_Checked(object sender, RoutedEventArgs e)
1003
        {
1004
            try
1005
            {
1006
                if (Isinit)
1007
                {
1008
                    if (!isCheck_Status)
1009
                    {
1010
                        Select_StatusID = ((e.Source as RadioButton).DataContext as Customer).ID;
1011

    
1012
                        isCheck_Status = true;
1013

    
1014
                        RadWindow CheckPop = new RadWindow();
1015

    
1016
                        CheckList_Status check = new CheckList_Status();
1017

    
1018
                        CheckPop = new RadWindow
1019
                        {
1020
                            MinWidth = 350,
1021
                            MinHeight = 150,
1022
                            Header = "Status Description을 입력하세요",
1023
                            Content = check,
1024
                            ResizeMode = System.Windows.ResizeMode.NoResize,
1025
                            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1026
                            IsTopmost = true,
1027
                        };
1028
                        StyleManager.SetTheme(CheckPop, new Office2013Theme());
1029
                        CheckPop.Closed += CheckPop_Closed;
1030
                        CheckPop.Show();
1031

    
1032
                        Isinit = false;
1033
                        tb.Rebind();
1034
                    }
1035
                }
1036

    
1037
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
1038

    
1039
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
1040
                {
1041
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Close";
1042
                }
1043
            }
1044
            catch(Exception ex)
1045
            {
1046
                //Logger.sendResLog("Radio_Close_Checked", ex.Message, 0);
1047
            }
1048
            
1049
        }
1050

    
1051
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1052
        {
1053
            try
1054
            {
1055
                isCheck_Status = false;
1056

    
1057
                foreach (var item in tb.Items)
1058
                {
1059
                    if (Select_StatusID == (item as Customer).ID.ToString())
1060
                    {
1061
                        if (ViewerDataModel.Instance.CheckStatus != "" && ViewerDataModel.Instance.CheckStatus != null)
1062
                        {
1063
                            (item as Customer).STATUS_DESC = ViewerDataModel.Instance.CheckStatus;
1064
                        }
1065
                        else
1066
                        {
1067
                            (item as Customer).STATUS = "False";
1068
                            (item as Customer)._STATUS = "Open";
1069
                            (item as Customer).STATUS_ = "True";
1070
                        }
1071

    
1072
                        ViewerDataModel.Instance.CheckStatus = "";
1073
                        Select_StatusID = "";
1074
                        tb.Rebind();
1075
                        return;
1076
                    }
1077
                }
1078
            }
1079
            catch(Exception ex)
1080
            {
1081
                //Logger.sendResLog("CheckPop_Closed", ex.Message, 0);
1082
            }
1083
            
1084

    
1085
        }
1086

    
1087
        private void Radio_Unchecked(object sender, RoutedEventArgs e)
1088
        {
1089
            try
1090
            {
1091
                (e.Source as RadioButton).Foreground = Brushes.Black;
1092
                (e.Source as RadioButton).FontWeight = FontWeights.Normal;
1093
            }
1094
            catch(Exception ex)
1095
            {
1096
                //Logger.sendResLog("Radio_Unchecked", ex.Message, 0);
1097
            }
1098
            
1099
        }
1100

    
1101
        private void mousedownOnImage(object sender, MouseButtonEventArgs args)
1102
        {
1103
            try
1104
            {
1105
                if (args.OriginalSource as TextBlock != null && (args.OriginalSource as TextBlock).Parent != null)
1106
                {
1107
                    if ((args.OriginalSource as TextBlock).Parent.GetType().Name == "GridViewHeaderCell")
1108
                    {
1109
                        Isinit = false;
1110
                        return;
1111
                    }
1112
                }
1113

    
1114
                Isinit = true;
1115

    
1116
                RadWindow CheckPop = new RadWindow();
1117

    
1118
                if (args.OriginalSource is Image)
1119
                {
1120
                    Image img = (args.OriginalSource as Image);
1121
                    if (img.Height != 45)
1122
                        return;
1123

    
1124
                    CommantImage check = new CommantImage(img);
1125

    
1126
                    CheckPop = new RadWindow
1127
                    {
1128
                        MinWidth = 500,
1129
                        MinHeight = 500,
1130
                        Header = "Image",
1131
                        Content = check,
1132
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1133
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1134
                        IsTopmost = true,
1135
                    };
1136
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1137
                    CheckPop.Show();
1138
                }
1139

    
1140
                if (args.OriginalSource as TextBlock == null || (args.OriginalSource as TextBlock).Parent == null || ((args.OriginalSource as TextBlock).Parent) as GridViewCell == null)
1141
                {
1142
                    return;
1143
                }
1144

    
1145
                if ((((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.ColumnGroupName.ToString() == "History")
1146
                {
1147

    
1148
                    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());
1149

    
1150
                    CheckPop = new RadWindow
1151
                    {
1152
                        MinWidth = 800,
1153
                        MinHeight = 400,
1154
                        Header = "Detail",
1155
                        Content = Detail,
1156
                        //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1157
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1158
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1159
                        IsTopmost = true,
1160
                    };
1161
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1162
                    //CheckPop.ShowDialog();
1163
                    CheckPop.Show();
1164
                }
1165
            }
1166
            catch(Exception ex)
1167
            {
1168
                //Logger.sendResLog("mousedownOnImage", ex.Message, 0);
1169
            }
1170
            
1171

    
1172
        }
1173

    
1174
        private void SyncEvent(object sender, MouseButtonEventArgs e)
1175
        {
1176
            try
1177
            {
1178
                old_DocID = ((e.Source as Image).DataContext as Customer).DOCUMENT_ID;
1179
                if (old_DocID.Equals(Current_Revision))
1180
                {
1181
                    DialogMessage_Alert("같은 Revision 은 비교할 수 없습니다.");
1182
                    return;
1183
                }
1184
                //Logger.sendReqLog("GetVPRevisionFirstOrDefault: ", App.ViewInfo.ProjectNO + "," + old_DocID, 1);
1185
                var _vpList = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVPRevisionFirstOrDefault(App.ViewInfo.ProjectNO, old_DocID);
1186
                if (_vpList != null)
1187
                {
1188
                    //Logger.sendResLog("GetVPRevisionFirstOrDefault", "TRUE", 1);
1189
                }
1190
                else
1191
                {
1192
                    //Logger.sendResLog("GetVPRevisionFirstOrDefault", "FALSE", 1);
1193
                }
1194

    
1195

    
1196

    
1197
                SyncInit();
1198
                Rect rect = new Rect();
1199
                string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
1200
                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])));
1201
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
1202
                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.Sync_ZoomTo(rect);
1203
                (mainWindow as MainWindow).dzMainMenu.Sync_Event(_vpList);
1204

    
1205
            }
1206
            catch (Exception ex)
1207
            {
1208
                //Logger.sendResLog("SyncEvent", ex.Message, 0);
1209
            }
1210
            
1211
        }
1212

    
1213
        #endregion
1214
    }
1215
}
클립보드 이미지 추가 (최대 크기: 500 MB)