프로젝트

일반

사용자정보

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

markus / KCOM / Controls / CheckList.xaml.cs @ 24678e06

이력 | 보기 | 이력해설 | 다운로드 (55.9 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
        //string old_Revision = "";
83
        string old_DocID = "";
84
        string Current_Revision = "";
85
        //string Current_DocNo = "";
86
        //string Current_Slip = "";
87
        bool Isinit = false;
88
        int rev_cnt = 1;
89
        bool isCheck_Status = false;
90
        string Select_StatusID = "";
91
        #endregion
92

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

    
105
        public void DataBind()
106
        {
107
            try
108
            {
109
                Isinit = false;
110

    
111
                Lists = new List<Customer>();
112
                string doc_no = (Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
113
                string project_no = App.ViewInfo.ProjectNO;
114
                string user_id = App.ViewInfo.UserID;
115

    
116
                Logger.sendReqLog("GetUserCheckList: ", project_no + "," + user_id + "," + doc_no, 1);
117

    
118
                items = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetUserCheckList(project_no, user_id, doc_no);
119
                if (items.Count() > 0)
120
                {
121
                    Logger.sendResLog("GetUserCheckList", "TRUE", 1);
122
                }
123
                else
124
                {
125
                    Logger.sendResLog("GetUserCheckList", "FALSE", 1);
126
                }
127

    
128
                foreach (var item in items)
129
                {
130
                    Customer customer = new Customer();
131
                    customer.ID = item.ID;
132
                    customer.IMAGE_ANCHOR = item.IMAGE_ANCHOR;
133
                    if (item.IMAGE_URL != null && item.IMAGE_URL != "")
134
                        customer.IMAGE_PATH = Convert.FromBase64String(item.IMAGE_URL);
135
                    customer.PAGENUMBER = item.PAGENUMBER;
136
                    customer.PROJECT_NO = item.PROJECT_NO;
137
                    customer.REMARK = item.REMARK;
138
                    customer.REVISION = item.REVISION;
139

    
140
                    #region history
141
                    Logger.sendReqLog("GetCheckListHistory: ", project_no + "," + item.ID, 1);
142
                    var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(project_no, item.ID);
143

    
144
                    if (history.Count() > 0)
145
                    {
146
                        Logger.sendResLog("GetCheckListHistory", "TRUE", 1);
147
                    }
148
                    else
149
                    {
150
                        Logger.sendResLog("GetCheckListHistory", "FALSE", 1);
151
                    }
152

    
153
                    foreach (var rev in history)
154
                    {
155
                        if (rev.REVISION == "A")
156
                        { customer.REV_0 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); }
157
                        if (rev.REVISION == "B")
158
                        { customer.REV_1 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 2 ? 2 : rev_cnt; }
159
                        if (rev.REVISION == "C")
160
                        { customer.REV_2 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 3 ? 3 : rev_cnt; }
161
                        if (rev.REVISION == "D")
162
                        { customer.REV_3 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 4 ? 4 : rev_cnt; }
163
                        if (rev.REVISION == "E")
164
                        { customer.REV_4 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 5 ? 5 : rev_cnt; }
165
                        if (rev.REVISION == "F")
166
                        { customer.REV_5 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 6 ? 6 : rev_cnt; }
167
                        if (rev.REVISION == "G")
168
                        { customer.REV_6 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 7 ? 7 : rev_cnt; }
169
                        if (rev.REVISION == "H")
170
                        { customer.REV_7 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 8 ? 8 : rev_cnt; }
171
                        if (rev.REVISION == "I")
172
                        { customer.REV_8 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 9 ? 9 : rev_cnt; }
173
                        if (rev.REVISION == "J")
174
                        { customer.REV_9 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 10 ? 10 : rev_cnt; }
175
                        if (rev.REVISION == "K")
176
                        { customer.REV_10 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 11 ? 11 : rev_cnt; }
177
                        if (rev.REVISION == "L")
178
                        { customer.REV_11 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 12 ? 12 : rev_cnt; }
179
                        if (rev.REVISION == "M")
180
                        { customer.REV_12 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 13 ? 13 : rev_cnt; }
181
                        if (rev.REVISION == "N")
182
                        { customer.REV_13 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 14 ? 14 : rev_cnt; }
183
                        if (rev.REVISION == "O")
184
                        { customer.REV_14 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 15 ? 15 : rev_cnt; }
185
                        if (rev.REVISION == "P")
186
                        { customer.REV_15 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 16 ? 16 : rev_cnt; }
187
                        if (rev.REVISION == "Q")
188
                        { customer.REV_16 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 17 ? 17 : rev_cnt; }
189
                        if (rev.REVISION == "R")
190
                        { customer.REV_17 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 18 ? 18 : rev_cnt; }
191
                        if (rev.REVISION == "S")
192
                        { customer.REV_18 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 19 ? 19 : rev_cnt; }
193
                        if (rev.REVISION == "T")
194
                        { customer.REV_19 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 20 ? 20 : rev_cnt; }
195
                    }
196
                    #endregion
197

    
198
                    customer.STATUS = item.STATUS;
199
                    customer.REPLY = item.REPLY;
200
                    customer.TODOLIST = item.TODOLIST;
201
                    customer.USER_ID = item.USER_ID;
202
                    customer.VENDOR = item.VENDOR;
203
                    customer.DOCUMENT_ID = item.DOCUMENT_ID;
204
                    customer.CREATE_TIME = DateTime.Parse(item.CREATE_TIME.ToString());
205

    
206
                    if (item.STATUS == "True")
207
                    {
208
                        customer._STATUS = "Close";
209
                        customer.STATUS_ = "False";
210
                        customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
211
                    }
212
                    else
213
                    {
214
                        customer._STATUS = "Open";
215
                        customer.STATUS_ = "True";
216
                        customer.STATUS_DESC = item.STATUS_DESC_OPEN;
217
                    }
218

    
219
                    Lists.Add(customer);
220
                }
221
            }
222
            catch (Exception ex)
223
            {
224
                Logger.sendResLog("Checklist DataBind", ex.Message, 0);
225
            }
226

    
227

    
228
        }
229

    
230
        private void ChangeSize(double width, double height)
231
        {
232
            this.Width = width;
233
            this.Height = height;
234
        }
235

    
236
        private void SyncInit()
237
        {
238
            try
239
            {
240
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
241
                {
242
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
243
                    ViewerDataModel.Instance.PageBalanceMode = false;
244
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
245
                    ViewerDataModel.Instance.PageNumber = 0;
246
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
247
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
248
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
249
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
250
                }
251
            }
252
            catch(Exception ex)
253
            {
254
                Logger.sendResLog("SyncInit", ex.Message, 0);
255
            }
256
            
257
        }
258

    
259
        private void DialogMessage_Alert(string Msg)
260
        {
261
            try
262
            {
263
                RadWindow CheckPop = new RadWindow();
264
                Alert check = new Alert(Msg);
265

    
266
                CheckPop = new RadWindow
267
                {
268
                    MinWidth = 400,
269
                    MinHeight = 100,
270
                    //Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
271
                    Header = "Alert",
272
                    Content = check,
273
                    ResizeMode = System.Windows.ResizeMode.NoResize,
274
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
275
                    IsTopmost = true,
276
                };
277
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
278
                CheckPop.ShowDialog();
279
            }
280
            catch (Exception ex)
281
            {
282
                Logger.sendResLog("DialogMessage_Alert", ex.Message, 0);
283
            }
284

    
285
        }
286

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

    
297
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
298
                        REV_1.IsVisible = true;
299

    
300
                    #region history
301
                    REV_0.IsVisible = true;
302
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
303
                    { REV_1.IsVisible = true; REV_0.Width = 70; }
304
                    else
305
                    { REV_0.Width = 140; }
306
                    if (Lists.Where(info => info.REV_2 != null).FirstOrDefault() != null)
307
                        REV_2.IsVisible = true; REV_2.IsVisible = true;
308
                    if (Lists.Where(info => info.REV_3 != null).FirstOrDefault() != null)
309
                        REV_3.IsVisible = true;
310
                    if (Lists.Where(info => info.REV_4 != null).FirstOrDefault() != null)
311
                        REV_4.IsVisible = true;
312
                    if (Lists.Where(info => info.REV_5 != null).FirstOrDefault() != null)
313
                        REV_5.IsVisible = true;
314
                    if (Lists.Where(info => info.REV_6 != null).FirstOrDefault() != null)
315
                        REV_6.IsVisible = true;
316
                    if (Lists.Where(info => info.REV_7 != null).FirstOrDefault() != null)
317
                        REV_7.IsVisible = true;
318
                    if (Lists.Where(info => info.REV_8 != null).FirstOrDefault() != null)
319
                        REV_8.IsVisible = true;
320
                    if (Lists.Where(info => info.REV_9 != null).FirstOrDefault() != null)
321
                        REV_9.IsVisible = true;
322
                    if (Lists.Where(info => info.REV_10 != null).FirstOrDefault() != null)
323
                        REV_10.IsVisible = true;
324
                    if (Lists.Where(info => info.REV_11 != null).FirstOrDefault() != null)
325
                        REV_11.IsVisible = true;
326
                    if (Lists.Where(info => info.REV_12 != null).FirstOrDefault() != null)
327
                        REV_12.IsVisible = true;
328
                    if (Lists.Where(info => info.REV_13 != null).FirstOrDefault() != null)
329
                        REV_13.IsVisible = true;
330
                    if (Lists.Where(info => info.REV_14 != null).FirstOrDefault() != null)
331
                        REV_14.IsVisible = true;
332
                    if (Lists.Where(info => info.REV_15 != null).FirstOrDefault() != null)
333
                        REV_15.IsVisible = true;
334
                    if (Lists.Where(info => info.REV_16 != null).FirstOrDefault() != null)
335
                        REV_16.IsVisible = true;
336
                    if (Lists.Where(info => info.REV_17 != null).FirstOrDefault() != null)
337
                        REV_17.IsVisible = true;
338
                    if (Lists.Where(info => info.REV_18 != null).FirstOrDefault() != null)
339
                        REV_18.IsVisible = true;
340
                    if (Lists.Where(info => info.REV_19 != null).FirstOrDefault() != null)
341
                        REV_19.IsVisible = true;
342
                    #endregion
343

    
344
                }
345
                else
346
                {
347
                    Col_Remark.IsVisible = false;
348
                    Col_Reply.IsVisible = false;
349
                    Col_Vendor.IsVisible = false;
350

    
351
                    #region history
352
                    REV_0.IsVisible = false;
353
                    REV_1.IsVisible = false;
354
                    REV_2.IsVisible = false;
355
                    REV_3.IsVisible = false;
356
                    REV_4.IsVisible = false;
357
                    REV_5.IsVisible = false;
358
                    REV_6.IsVisible = false;
359
                    REV_7.IsVisible = false;
360
                    REV_8.IsVisible = false;
361
                    REV_9.IsVisible = false;
362
                    REV_10.IsVisible = false;
363
                    REV_11.IsVisible = false;
364
                    REV_12.IsVisible = false;
365
                    REV_13.IsVisible = false;
366
                    REV_14.IsVisible = false;
367
                    REV_15.IsVisible = false;
368
                    REV_16.IsVisible = false;
369
                    REV_17.IsVisible = false;
370
                    REV_18.IsVisible = false;
371
                    REV_19.IsVisible = false;
372
                    #endregion
373
                }
374
            }
375
            catch (Exception ex)
376
            {
377
                Logger.sendResLog("History_Set", ex.Message, 0);
378
            }
379

    
380
        }
381

    
382
        #region Excel Export
383

    
384
        private void ExportEvent(object sender, RoutedEventArgs e)
385
        {
386
            try
387
            {
388
                if ((Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
389
                {
390
                    DialogMessage_Alert("Capture중 입니다.");
391
                    return;
392
                }
393
                this.ExportIndy.IsBusy = true;
394

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

    
402
                string extension = "xlsx";
403
                string excelpath = global::KCOM.Properties.Settings.Default.excelFilePath;
404
                Uri url = new Uri(excelpath);
405

    
406
                System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog()
407
                {
408
                    DefaultExt = extension,
409
                    Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
410
                    FilterIndex = 1
411
                };
412

    
413
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
414
                {
415
                    using (var client = new System.Net.WebClient())
416
                    {
417
                        client.DownloadFile(url, dialog.FileName);
418

    
419
                        Excel.Application application = null;
420
                        Excel.Workbook workbook = null;
421
                        Excel.Worksheet worksheet = null;
422

    
423
                        try
424
                        {
425
                            // Excel 첫번째 워크시트 가져오기                
426
                            application = new Excel.Application();
427
                            workbook = application.Workbooks.Open(dialog.FileName);
428
                            worksheet = (Excel.Worksheet)workbook.Worksheets.get_Item("Sheet1");
429

    
430
                            // 데이타 넣기
431
                            int h = 9;
432
                            int w = 2;
433
                            string project_no = App.ViewInfo.ProjectNO;
434
                            worksheet.Cells[2, w + 8] = project_no;
435
                            Logger.sendReqLog("GetProjectName: ", project_no, 1);
436

    
437
                            string project_name = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetProjectName(project_no);
438
                            if (project_name != null || project_name != "")
439
                            {
440
                                Logger.sendResLog("GetProjectName", "TRUE", 1);
441
                            }
442
                            else
443
                            {
444
                                Logger.sendResLog("GetProjectName", "FALSE", 1);
445
                            }
446
                            worksheet.Cells[3, w + 8] = project_name;
447

    
448
                            worksheet.Cells[4, w + 8] = (Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
449
                            worksheet.Cells[5, w + 8] = (Application.Current.MainWindow as MainWindow).dzMainMenu.userData.NAME + " (" + App.ViewInfo.UserID + ")";
450
                            worksheet.Cells[6, w + 8] = DateTime.Now.ToString("yyyy.MM.dd");
451

    
452
                            Excel.Range Range_I = worksheet.Range["K9"];
453
                            Excel.Range Range_O = null;
454
                            Excel.Borders border_ = null;
455

    
456
                            var Rev = Lists.Select(info => info.REVISION).Distinct();
457
                            string[] Cell = { "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T" };
458
                            string[] Range = { "L9", "M9", "N9", "O9", "P9", "Q9", "R9", "S9", "T9", "U9", "V9", "W9", "X9", "Y9", "Z9", "AA9", "AB9", "AC9", "AD9" };
459
                            string Ran = "K";
460

    
461
                            for (int i = 0; i < rev_cnt - 1; i++)
462
                            {
463
                                worksheet.Cells[9, 12 + i] = Cell[i];
464
                                Range_O = worksheet.Range[Range[i]];
465
                                border_ = Range_O.Borders;
466
                                border_.LineStyle = Range_I.Borders.LineStyle;
467
                                border_.Weight = Range_I.Borders.Weight;
468
                                Range_O.Interior.Color = Range_I.Interior.Color;
469
                            }
470

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

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

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

    
483
                            Lists.ForEach(data =>
484
                            {
485
                                h++;
486

    
487
                                Excel.Range oRange = worksheet.Range["B" + h + ":" + Ran + h];
488
                                oRange.RowHeight = iRange.RowHeight;
489
                                Excel.Borders border = oRange.Borders;
490
                                border.LineStyle = Excel.XlLineStyle.xlContinuous;
491
                                border.Weight = 2d;
492

    
493
                                if (data.IMAGE_PATH != null)
494
                                {
495
                                    Excel.Range ImageRange = worksheet.Cells[h, w + 2];
496

    
497
                                    System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH);
498
                                    System.Drawing.Image o_Image = Resize(I_Image, 80, 80);
499
                                    System.Windows.Forms.Clipboard.SetDataObject(o_Image, true);
500

    
501
                                    ImageRange.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenterAcrossSelection;
502
                                    ImageRange.Cells.VerticalAlignment = Excel.XlHAlign.xlHAlignCenter;
503

    
504
                                    worksheet.Paste(ImageRange.Cells, "TEST");
505

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

    
511
                                        double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
512
                                        double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
513

    
514
                                        shp.Left = float.Parse(Left.ToString());
515
                                        shp.Top = float.Parse(Top.ToString());
516

    
517
                                        break;
518
                                    }
519
                                }
520

    
521
                                #region Excel Bind
522
                                worksheet.Cells[h, w] = data.REVISION;
523
                                worksheet.Cells[h, w + 1] = data.PAGENUMBER;
524
                                worksheet.Cells[h, w + 3] = data.TODOLIST;
525
                                worksheet.Cells[h, w + 4] = data.STATUS.ToUpper() == "TRUE" ? "closed" : "open";
526
                                worksheet.Cells[h, w + 5] = data.STATUS_DESC;
527
                                worksheet.Cells[h, w + 6] = data.VENDOR;
528
                                worksheet.Cells[h, w + 7] = data.REMARK;
529
                                worksheet.Cells[h, w + 8] = data.REPLY;
530
                                worksheet.Cells[h, w + 9] = data.REV_0 == null ? "" : data.REV_0.Replace("", " / ");
531
                                worksheet.Cells[h, w + 10] = data.REV_1 == null ? "" : data.REV_1.Replace("", " / ");
532
                                worksheet.Cells[h, w + 11] = data.REV_2 == null ? "" : data.REV_2.Replace("", " / ");
533
                                worksheet.Cells[h, w + 12] = data.REV_3 == null ? "" : data.REV_3.Replace("", " / ");
534
                                worksheet.Cells[h, w + 13] = data.REV_4 == null ? "" : data.REV_4.Replace("", " / ");
535
                                worksheet.Cells[h, w + 14] = data.REV_5 == null ? "" : data.REV_5.Replace("", " / ");
536
                                worksheet.Cells[h, w + 15] = data.REV_6 == null ? "" : data.REV_6.Replace("", " / ");
537
                                worksheet.Cells[h, w + 16] = data.REV_7 == null ? "" : data.REV_7.Replace("", " / ");
538
                                worksheet.Cells[h, w + 17] = data.REV_8 == null ? "" : data.REV_8.Replace("", " / ");
539
                                worksheet.Cells[h, w + 18] = data.REV_9 == null ? "" : data.REV_9.Replace("", " / ");
540
                                worksheet.Cells[h, w + 19] = data.REV_10 == null ? "" : data.REV_10.Replace("", " / ");
541
                                worksheet.Cells[h, w + 20] = data.REV_11 == null ? "" : data.REV_11.Replace("", " / ");
542
                                worksheet.Cells[h, w + 21] = data.REV_12 == null ? "" : data.REV_12.Replace("", " / ");
543
                                worksheet.Cells[h, w + 22] = data.REV_13 == null ? "" : data.REV_13.Replace("", " / ");
544
                                worksheet.Cells[h, w + 23] = data.REV_14 == null ? "" : data.REV_14.Replace("", " / ");
545
                                worksheet.Cells[h, w + 24] = data.REV_15 == null ? "" : data.REV_15.Replace("", " / ");
546
                                worksheet.Cells[h, w + 25] = data.REV_16 == null ? "" : data.REV_16.Replace("", " / ");
547
                                worksheet.Cells[h, w + 26] = data.REV_17 == null ? "" : data.REV_17.Replace("", " / ");
548
                                worksheet.Cells[h, w + 27] = data.REV_18 == null ? "" : data.REV_18.Replace("", " / ");
549
                                worksheet.Cells[h, w + 28] = data.REV_19 == null ? "" : data.REV_19.Replace("", " / ");
550
                                #endregion
551
                            });
552

    
553
                            worksheet.Columns.AutoFit();
554
                            // 엑셀파일 저장
555
                            workbook.Save();
556
                            workbook.Close(true);
557
                            application.Quit();
558
                        }
559
                        finally
560
                        {
561
                            System.Diagnostics.Process[] ExCel = System.Diagnostics.Process.GetProcessesByName("EXCEL");
562
                            if (ExCel.Count() != 0)
563
                            {
564
                                ExCel[0].Kill();
565
                            }
566

    
567
                            // Clean up
568
                            ReleaseExcelObject(worksheet);
569
                            ReleaseExcelObject(workbook);
570
                            ReleaseExcelObject(application);
571
                        }
572
                    }
573
                    DialogMessage_Alert("Success");
574
                }
575

    
576
                this.ExportIndy.IsBusy = false;
577
            }
578
            catch (Exception ex)
579
            {
580
                Logger.sendResLog("CheckList ExportEvent", ex.Message, 0);
581
            }
582

    
583
        }
584

    
585
        public System.Drawing.Image byteArrayToImage(byte[] byteArrayIn)
586
        {
587
            using (var ms = new System.IO.MemoryStream(byteArrayIn))
588
            {
589
                return System.Drawing.Image.FromStream(ms);
590
            }
591
        }
592

    
593
        public System.Drawing.Image Resize(System.Drawing.Image image, int newWidth, int maxHeight)
594
        {
595
            //if (onlyResizeIfWider && image.Width <= newWidth) newWidth = image.Width;
596

    
597
            try
598
            {
599
                var newHeight = image.Height * newWidth / image.Width;
600
                if (newHeight > maxHeight)
601
                {
602
                    // Resize with height instead  
603
                    newWidth = image.Width * maxHeight / image.Height;
604
                    newHeight = maxHeight;
605
                }
606

    
607
                var res = new System.Drawing.Bitmap(newWidth, newHeight);
608

    
609
                using (var graphic = System.Drawing.Graphics.FromImage(res))
610
                {
611
                    graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
612
                    graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
613
                    graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
614
                    graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
615
                    graphic.DrawImage(image, 0, 0, newWidth, newHeight);
616
                }
617
                return res;
618
            }
619
            catch (Exception ex)
620
            {
621
                Logger.sendResLog("Resize", ex.Message, 0);
622
                return null;
623
            }
624
            
625

    
626
            
627
        }
628

    
629
        private static void ReleaseExcelObject(object obj)
630
        {
631
            try
632
            {
633
                if (obj != null)
634
                {
635
                    obj = null;
636
                }
637
            }
638
            catch (Exception ex)
639
            {
640
                obj = null;
641
                throw ex;
642
            }
643
            finally
644
            {
645
                GC.Collect();
646
            }
647
        }
648

    
649
        #endregion
650

    
651
        #region 이벤트
652

    
653
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
654
        {
655
            ChangeSize(e.NewSize.Width, e.NewSize.Height);
656
        }
657

    
658
        private void CheckList_Loaded(object sender, RoutedEventArgs e)
659
        {
660
            DataBind();
661
            this.tb.ItemsSource = null;
662
            this.tb.ItemsSource = Lists;
663
            History_Set();
664
        }
665
        
666
        private void RadGridView_Loaded(object sender, RoutedEventArgs e)
667
        {
668
            DataBind();
669
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = null;
670
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = Lists;
671

    
672
            ChangeSize(this.ActualWidth, this.ActualHeight);
673
            this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
674
        }
675

    
676
        private void AddEvent(object sender, RoutedEventArgs e)
677
        {
678
            try
679
            {
680
                Application.Current.MainWindow.Focus();
681

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

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

    
705
                foreach (var item in tb.Items)
706
                {
707
                    string Check_ID = (item as Customer).ID.ToString();
708
                    string state = "";
709

    
710
                    Logger.sendReqLog("GetCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
711
                    Check_value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckList(App.ViewInfo.ProjectNO, Check_ID);
712
                    if (Check_value != null)
713
                    {
714
                        Logger.sendResLog("GetCheckList", "TRUE", 1);
715
                    }
716
                    else
717
                    {
718
                        Logger.sendResLog("GetCheckList", "FALSE", 1);
719
                    }
720

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

    
734
                        string Rev = state + "" + DateTime.Now.ToString("yyyy.MM.dd");
735
                        string description = "";
736

    
737
                        if (char.Parse(ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision) >= char.Parse(Check_value.REVISION))
738
                        {
739
                            Check_value.REMARK = (item as Customer).REMARK;
740
                            Check_value.STATUS = (item as Customer).STATUS;
741
                            Check_value.TODOLIST = (item as Customer).TODOLIST;
742
                            Check_value.VENDOR = (item as Customer).VENDOR;
743
                            Check_value.REPLY = (item as Customer).REPLY;
744

    
745
                            if ((item as Customer).STATUS == "False")
746
                                description = Check_value.STATUS_DESC_OPEN;
747
                            else
748
                                description = Check_value.STATUS_DESC_CLOSE;
749

    
750
                            Logger.sendReqLog("GetCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
751
                            var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(App.ViewInfo.ProjectNO, Check_ID);
752
                            if (history.Count() > 0)
753
                            {
754
                                Logger.sendResLog("GetCheckList", "TRUE", 1);
755
                            }
756
                            else
757
                            {
758
                                Logger.sendResLog("GetCheckList", "FALSE", 1);
759
                            }
760
                            Check_History = history.Where(info => info.REVISION == ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision).FirstOrDefault();
761

    
762
                            List<string> validation = new List<string>();
763

    
764
                            foreach (var his in history)
765
                            {
766
                                if (his.TODOLIST == Check_value.TODOLIST)
767
                                    validation.Add("TODOLIST");
768
                                if (his.STATUS_DESC == description)
769
                                    validation.Add("STATUS_DESC");
770
                                if (his.VENDOR == Check_value.VENDOR)
771
                                    validation.Add("VENDOR");
772
                                if (his.REMARK == Check_value.REMARK)
773
                                    validation.Add("REMARK");
774
                                if (his.REPLY == Check_value.REPLY)
775
                                    validation.Add("REPLY");
776
                            }
777

    
778
                            if (validation.Count < 5)
779
                            {
780
                                if (Check_History == null)
781
                                {
782
                                    Check_History = new CHECK_LIST_HISTORY()
783
                                    {
784
                                        ID = Commons.shortGuid(),
785
                                        CHECKLIST_ID = Check_ID,
786
                                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
787
                                        STATUS = state,
788
                                        IMAGE_URL = Check_value.IMAGE_URL,
789
                                        STATUS_DESC = validation.Where(i => i.ToString() == "STATUS_DESC").FirstOrDefault() == null ? description : "",
790
                                        TODOLIST = validation.Where(i => i.ToString() == "TODOLIST").FirstOrDefault() == null ? Check_value.TODOLIST : "",
791
                                        VENDOR = validation.Where(i => i.ToString() == "VENDOR").FirstOrDefault() == null ? Check_value.VENDOR : "",
792
                                        REMARK = validation.Where(i => i.ToString() == "REMARK").FirstOrDefault() == null ? Check_value.REMARK : "",
793
                                        REPLY = validation.Where(i => i.ToString() == "REPLY").FirstOrDefault() == null ? Check_value.REPLY : "",
794
                                        CREATE_TIME = DateTime.Now,
795
                                        UPDATE_TIME = DateTime.Now
796
                                    };
797

    
798
                                    Logger.sendReqLog("AddCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_History, 1);
799
                                    Logger.sendResLog("AddCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History).ToString(), 1);
800
                                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History);
801

    
802
                                    Check_value.REVISION = Current_Revision;
803
                                }
804
                                else
805
                                {
806
                                    Check_History.IMAGE_URL = Check_value.IMAGE_URL;
807
                                    Check_History.STATUS = state;
808
                                    Check_History.TODOLIST = Check_value.TODOLIST;
809
                                    Check_History.VENDOR = Check_value.VENDOR;
810
                                    Check_History.REMARK = Check_value.REMARK;
811
                                    Check_History.REPLY = Check_value.REPLY;
812
                                    Check_History.UPDATE_TIME = DateTime.Now;
813
                                    if (state == "Open")
814
                                    {
815
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_OPEN;
816
                                    }
817
                                    else
818
                                    {
819
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_CLOSE;
820
                                    }
821

    
822
                                    Logger.sendReqLog("SaveCheckListHistory: ", App.ViewInfo.ProjectNO + "," + ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision + "," + Check_History, 1);
823
                                    Logger.sendResLog("SaveCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History).ToString(), 1);
824

    
825
                                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History);
826
                                }
827
                            }
828
                            validation = new List<string>();
829
                        }
830
                    }
831

    
832
                    Logger.sendReqLog("SaveCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID + "," + Check_value, 1);
833
                    Logger.sendResLog("SaveCheckList", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value).ToString(), 1);
834
                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value);
835
                }
836

    
837
                DataBind();
838
                tb.ItemsSource = null;
839
                tb.ItemsSource = Lists;
840
                History_Set();
841

    
842
                DialogMessage_Alert("Success");
843
            }
844
            catch (Exception ex)
845
            {
846
                Logger.sendResLog("Checklist SaveEvent", ex.Message, 0);
847
            }
848
                       
849
        }
850

    
851
        private void CheckListEvent(object sender, RoutedEventArgs e)
852
        {
853
            if (col1.Width == new GridLength(1200))
854
            {
855
                this.Width += 600;
856
                col1.Width = new GridLength(1800);
857
            }
858
            else
859
            {
860
                this.Width -= 600;
861
                col1.Width = new GridLength(1200);
862
            }
863
            History_Set();
864
        }
865

    
866
        private void CommentMoveEvent(object sender, MouseButtonEventArgs e)
867
        {
868
            SyncInit();
869

    
870
            Rect rect = new Rect();
871
            string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
872
            //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
873

    
874
            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])));
875

    
876
            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
877
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
878
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
879
            Application.Current.MainWindow.Focus();
880
        }
881

    
882
        private void CaptureEvent(object sender, MouseButtonEventArgs e)
883
        {
884
            SyncInit();
885

    
886
            //캡쳐 하기 전에 코멘트 저장
887
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
888
            {
889
                var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
890
                menu.ReleaseAdorner();
891
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
892
                {
893
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
894
                }
895
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
896
                {
897

    
898
                }
899
                else
900
                {
901
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
902
                }
903
            }
904

    
905
            //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
906
            Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
907
            //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
908
            Application.Current.MainWindow.Focus();
909
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
910
            (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
911
        }
912

    
913
        public void KeyEventDownAction(object sender, KeyEventArgs e)
914
        {
915
            switch (e.Key)
916
            {
917
                case Key.Escape:
918
                    {
919
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
920
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0;
921
                    }
922
                    break;
923
            }
924
        }
925

    
926
        private void tb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
927
        {
928
            try
929
            {
930
                if (ViewerDataModel.Instance.Capture_Opacity == 0)
931
                    return;
932

    
933
                DataBind();
934
                tb.ItemsSource = null;
935
                tb.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
936
                //tb1.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
937

    
938
                if (ViewerDataModel.Instance.Capture_Opacity == 0.5)
939
                {
940
                    tb.SortDescriptors.Clear();
941
                    tb.FilterDescriptors.Clear();
942

    
943
                    var scrollViewer = this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
944
                    if (scrollViewer != null)
945
                    {
946
                        //this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
947
                        //this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
948

    
949
                        tb.ScrollIndexIntoView(tb.Items.Count - 1);
950
                        tb.CurrentCellInfo = new GridViewCellInfo(tb.Items[tb.Items.Count - 1], tb.Columns["TODOLIST"]);
951
                        tb.Focus();
952

    
953
                    }
954
                }
955
            }
956
            catch(Exception ex)
957
            {
958
                Logger.sendResLog("tb_IsVisibleChanged", ex.Message, 0);
959
            }
960
            
961
        }
962

    
963
        private void Radio_Open_Checked(object sender, RoutedEventArgs e)
964
        {
965
            try
966
            {
967
                (e.Source as RadioButton).Foreground = Brushes.Red;
968
                (e.Source as RadioButton).FontWeight = FontWeights.Bold;
969

    
970
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
971
                {
972
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Open";
973
                }
974

    
975
                if (Isinit)
976
                {
977
                    Isinit = false;
978
                    if ((e.Source as RadioButton).DataContext != null)
979
                    {
980
                        if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 필요")
981
                        {
982
                            ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 필요";
983

    
984
                            tb.Rebind();
985
                        }
986
                    }
987
                }
988
            }
989
            catch(Exception ex)
990
            {
991
                Logger.sendResLog("Radio_Open_Checked", ex.Message, 0);
992
            }
993
            
994
        }
995

    
996
        private void Radio_Close_Checked(object sender, RoutedEventArgs e)
997
        {
998
            try
999
            {
1000
                if (Isinit)
1001
                {
1002
                    if (!isCheck_Status)
1003
                    {
1004
                        Select_StatusID = ((e.Source as RadioButton).DataContext as Customer).ID;
1005

    
1006
                        isCheck_Status = true;
1007

    
1008
                        RadWindow CheckPop = new RadWindow();
1009

    
1010
                        CheckList_Status check = new CheckList_Status();
1011

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

    
1026
                        Isinit = false;
1027
                        tb.Rebind();
1028
                    }
1029
                }
1030

    
1031
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
1032

    
1033
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
1034
                {
1035
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Close";
1036
                }
1037
            }
1038
            catch(Exception ex)
1039
            {
1040
                Logger.sendResLog("Radio_Close_Checked", ex.Message, 0);
1041
            }
1042
            
1043
        }
1044

    
1045
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1046
        {
1047
            try
1048
            {
1049
                isCheck_Status = false;
1050

    
1051
                foreach (var item in tb.Items)
1052
                {
1053
                    if (Select_StatusID == (item as Customer).ID.ToString())
1054
                    {
1055
                        if (ViewerDataModel.Instance.CheckStatus != "" && ViewerDataModel.Instance.CheckStatus != null)
1056
                        {
1057
                            (item as Customer).STATUS_DESC = ViewerDataModel.Instance.CheckStatus;
1058
                        }
1059
                        else
1060
                        {
1061
                            (item as Customer).STATUS = "False";
1062
                            (item as Customer)._STATUS = "Open";
1063
                            (item as Customer).STATUS_ = "True";
1064
                        }
1065

    
1066
                        ViewerDataModel.Instance.CheckStatus = "";
1067
                        Select_StatusID = "";
1068
                        tb.Rebind();
1069
                        return;
1070
                    }
1071
                }
1072
            }
1073
            catch(Exception ex)
1074
            {
1075
                Logger.sendResLog("CheckPop_Closed", ex.Message, 0);
1076
            }
1077
            
1078

    
1079
        }
1080

    
1081
        private void Radio_Unchecked(object sender, RoutedEventArgs e)
1082
        {
1083
            try
1084
            {
1085
                (e.Source as RadioButton).Foreground = Brushes.Black;
1086
                (e.Source as RadioButton).FontWeight = FontWeights.Normal;
1087
            }
1088
            catch(Exception ex)
1089
            {
1090
                Logger.sendResLog("Radio_Unchecked", ex.Message, 0);
1091
            }
1092
            
1093
        }
1094

    
1095
        private void mousedownOnImage(object sender, MouseButtonEventArgs args)
1096
        {
1097
            try
1098
            {
1099
                if (args.OriginalSource as TextBlock != null && (args.OriginalSource as TextBlock).Parent != null)
1100
                {
1101
                    if ((args.OriginalSource as TextBlock).Parent.GetType().Name == "GridViewHeaderCell")
1102
                    {
1103
                        Isinit = false;
1104
                        return;
1105
                    }
1106
                }
1107

    
1108
                Isinit = true;
1109

    
1110
                RadWindow CheckPop = new RadWindow();
1111

    
1112
                if (args.OriginalSource is Image)
1113
                {
1114
                    Image img = (args.OriginalSource as Image);
1115
                    if (img.Height != 45)
1116
                        return;
1117

    
1118
                    CommantImage check = new CommantImage(img);
1119

    
1120
                    CheckPop = new RadWindow
1121
                    {
1122
                        MinWidth = 500,
1123
                        MinHeight = 500,
1124
                        Header = "Image",
1125
                        Content = check,
1126
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1127
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1128
                        IsTopmost = true,
1129
                    };
1130
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1131
                    CheckPop.Show();
1132
                }
1133

    
1134
                if (args.OriginalSource as TextBlock == null || (args.OriginalSource as TextBlock).Parent == null || ((args.OriginalSource as TextBlock).Parent) as GridViewCell == null)
1135
                {
1136
                    return;
1137
                }
1138

    
1139
                if ((((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.ColumnGroupName.ToString() == "History")
1140
                {
1141

    
1142
                    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());
1143

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

    
1166
        }
1167

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

    
1189

    
1190

    
1191
                SyncInit();
1192
                Rect rect = new Rect();
1193
                string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
1194
                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])));
1195
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
1196
                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.Sync_ZoomTo(rect);
1197
                (Application.Current.MainWindow as MainWindow).dzMainMenu.Sync_Event(_vpList);
1198

    
1199
            }
1200
            catch (Exception ex)
1201
            {
1202
                Logger.sendResLog("SyncEvent", ex.Message, 0);
1203
            }
1204
            
1205
        }
1206

    
1207
        #endregion
1208
    }
1209
}
클립보드 이미지 추가 (최대 크기: 500 MB)