프로젝트

일반

사용자정보

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

markus / KCOM / Controls / CheckList.xaml.cs @ aa73d664

이력 | 보기 | 이력해설 | 다운로드 (56.5 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 System.Text.RegularExpressions;
25
using GemBox.Spreadsheet;
26
using System.IO;
27

    
28
namespace KCOM.Controls
29
{
30

    
31
    #region Customer
32
    public class Customer
33
    {
34
        public string ID { get; set; }
35
        public string DOCUMENT_ID { get; set; }
36
        public string USER_ID { get; set; }
37
        public string REVISION { get; set; }
38
        public int PAGENUMBER { get; set; }
39
        public string TODOLIST { get; set; }
40
        public string IMAGE_URL { get; set; }
41
        public string STATUS { get; set; }
42
        public string STATUS_ { get; set; }
43
        public string _STATUS { get; set; }
44
        public string VENDOR { get; set; }
45
        public string REMARK { get; set; }
46
        public string PROJECT_NO { get; set; }
47
        public string REV_19 { get; set; }
48
        public string REV_18 { get; set; }
49
        public string REV_17 { get; set; }
50
        public string REV_16 { get; set; }
51
        public string REV_15 { get; set; }
52
        public string REV_14 { get; set; }
53
        public string REV_13 { get; set; }
54
        public string REV_12 { get; set; }
55
        public string REV_11 { get; set; }
56
        public string REV_10 { get; set; }
57
        public string REV_9 { get; set; }
58
        public string REV_8 { get; set; }
59
        public string REV_7 { get; set; }
60
        public string REV_6 { get; set; }
61
        public string REV_5 { get; set; }
62
        public string REV_4 { get; set; }
63
        public string REV_3 { get; set; }
64
        public string REV_2 { get; set; }
65
        public string REV_1 { get; set; }
66
        public string REV_0 { get; set; }
67
        public string IMAGE_ANCHOR { get; set; }
68
        public byte[] IMAGE_PATH { get; set; }
69
        public string STATUS_DESC { get; set; }
70
        public string REPLY { get; set; }
71
        public DateTime CREATE_TIME { get; set; }
72
    } 
73
    #endregion
74

    
75
    /// <summary>
76
    /// Interaction logic for CheckList.xaml
77
    /// </summary>
78
    public partial class CheckList : UserControl
79
    {
80
        #region 프로퍼티
81
        List<CHECK_LIST> items = new List<CHECK_LIST>();
82
        List<Customer> Lists = new List<Customer>();
83
        MainWindow mainWindow;
84
        //string old_Revision = "";
85
        string old_DocID = "";
86
        string Current_Revision = "";
87
        //string Current_DocNo = "";
88
        //string Current_Slip = "";
89
        bool Isinit = false;
90
        int rev_cnt = 1;
91
        bool isCheck_Status = false;
92
        string Select_StatusID = "";
93
        #endregion
94

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

    
106
        }
107
        #endregion
108

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

    
115
                Lists = new List<Customer>();
116
                string doc_no = mainWindow.dzMainMenu._DocItem.DOCUMENT_NO;
117
                string project_no = App.ViewInfo.ProjectNO;
118
                string user_id = App.ViewInfo.UserID;
119

    
120
                //Logger.sendReqLog("GetUserCheckList: ", project_no + "," + user_id + "," + doc_no, 1);
121

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

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

    
144
                    #region history
145
                    //Logger.sendReqLog("GetCheckListHistory: ", project_no + "," + item.ID, 1);
146
                    var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(project_no, item.ID);
147

    
148
                    if (history.Count() > 0)
149
                    {
150
                        //Logger.sendResLog("GetCheckListHistory", "TRUE", 1);
151
                    }
152
                    else
153
                    {
154
                        //Logger.sendResLog("GetCheckListHistory", "FALSE", 1);
155
                    }
156

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

    
202
                    customer.STATUS = item.STATUS;
203
                    customer.REPLY = item.REPLY;
204
                    customer.TODOLIST = item.TODOLIST;
205
                    customer.USER_ID = item.USER_ID;
206
                    customer.VENDOR = item.VENDOR;
207
                    customer.DOCUMENT_ID = item.DOCUMENT_ID;
208
                    customer.CREATE_TIME = DateTime.Parse(item.CREATE_TIME.ToString());
209

    
210
                    if (item.STATUS == "True")
211
                    {
212
                        customer._STATUS = "Close";
213
                        customer.STATUS_ = "False";
214
                        customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
215
                    }
216
                    else
217
                    {
218
                        customer._STATUS = "Open";
219
                        customer.STATUS_ = "True";
220
                        customer.STATUS_DESC = item.STATUS_DESC_OPEN;
221
                    }
222

    
223
                    Lists.Add(customer);
224
                }
225
            }
226
            catch (Exception ex)
227
            {
228
                Logger.sendResLog("Checklist DataBind", ex.Message, 0);
229
            }
230

    
231

    
232
        }
233

    
234
        private void ChangeSize(double width, double height)
235
        {
236
            this.Width = width;
237
            this.Height = height;
238
        }
239

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

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

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

    
289
        }
290

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

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

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

    
348
                }
349
                else
350
                {
351
                    Col_Remark.IsVisible = false;
352
                    Col_Reply.IsVisible = false;
353
                    Col_Vendor.IsVisible = false;
354

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

    
384
        }
385

    
386
        #region Excel Export
387

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

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

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

    
411
                System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog()
412
                {
413
                    DefaultExt = extension,
414
                    Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
415
                    FilterIndex = 1
416
                };
417

    
418
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
419
                {
420
                    using (var client = new System.Net.WebClient())
421
                    {
422
                        client.DownloadFile(url, dialog.FileName);
423
                        SpreadsheetInfo.SetLicense(Properties.Settings.Default.GemBoxLicense);// "EXK0-W4HZ-N518-IMEW");                    
424
                        ExcelFile workbook = null;
425
                        ExcelWorksheet worksheet = null;
426
                        try
427
                        {
428
                            // Excel 첫번째 워크시트 가져오기             
429
                            workbook = ExcelFile.Load(dialog.FileName);
430
                            worksheet = workbook.Worksheets[0];
431

    
432
                            // 데이타 넣기
433
                            int h = 8;
434
                            int w = 1;
435
                            string project_no = App.ViewInfo.ProjectNO;
436
                            worksheet.Cells[1, w + 8].Value = project_no;
437

    
438
                            string project_name = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetProjectName(project_no);
439
                            if (project_name != null || project_name != "")
440
                            {
441
                                //Logger.sendResLog("GetProjectName", "TRUE", 1);
442
                            }
443
                            else
444
                            {
445
                                //Logger.sendResLog("GetProjectName", "FALSE", 1);
446
                            }
447
                            worksheet.Cells[2, w + 8].Value = project_name;
448
                            worksheet.Cells[3, w + 8].Value = (mainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
449
                            worksheet.Cells[4, w + 8].Value = (mainWindow as MainWindow).dzMainMenu.userData.NAME + " (" + App.ViewInfo.UserID + ")";
450
                            worksheet.Cells[5, w + 8].Value = DateTime.Now.ToString("yyyy.MM.dd");
451

    
452
                            ExcelCell Range_I = worksheet.Cells["K9"];                           
453

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

    
459
                            worksheet.Cells.GetSubrangeAbsolute(8, 11, 8, 11 + rev_cnt - 1).Merged = true;                       
460

    
461
                            if (rev_cnt != 1)
462
                            {
463
                                Ran = Range[rev_cnt - 2].Substring(0, Range[rev_cnt - 2].Length - 1);
464
                            }
465
                            CellRange iRange = worksheet.Cells.GetSubrange("B10:" + Ran + "10");
466
                            
467
                            //필터 기능 추가
468
                            CellRange Filter_Range = worksheet.Cells.GetSubrange("B9:" + Ran + "9");
469
                            Filter_Range.Filter(true);
470
                            ExcelCell Range_b = worksheet.Cells["B10"];
471
                            Lists.ForEach(data =>
472
                            {
473
                                h++;
474
                                // Get the range.
475
                                CellRange oRange = worksheet.Cells.GetSubrange("B" + (h + 1) + ":" + Ran + (h + 1));
476
                                foreach (var cell in oRange)
477
                                {
478
                                    cell.Style.Borders.SetBorders(MultipleBorders.Outside, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin);
479
                                }
480

    
481
                                if (data.IMAGE_PATH != null)
482
                                {
483
                                    ExcelCell ImageRange = worksheet.Cells[h, w + 2];        
484
                                    ImageRange.Row.Height = Range_b.Row.Height;
485
                                    //ImageRange.Style.Font.Size = 10;
486
                                    System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH);
487
                                    System.Drawing.Image o_Image = Resize(I_Image, 80, 80);
488
                                    System.Windows.Forms.Clipboard.SetDataObject(o_Image, true);
489
                                    ImageRange.Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;
490
                                    ImageRange.Style.VerticalAlignment = VerticalAlignmentStyle.Top;                                      
491
                                    byte[] imageData = data.IMAGE_PATH;
492
                                    MemoryStream memoryStream = new MemoryStream();
493
                                    o_Image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);                                    
494
                                    int column = 2; // 이미지를 삽입할 열
495
                                    int row = h;    // 이미지를 삽입할 행
496
                                    // 이미지를 워크시트에 추가
497
                                    ExcelPicture picture = worksheet.Pictures.Add(memoryStream, PositioningMode.FreeFloating, new AnchorCell(ImageRange.Column, ImageRange.Row, 0, 0), ExcelPictureFormat.Jpeg);
498

    
499
                                    //foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes)
500
                                    //{
501
                                    //    if (shp.TopLeftCell.Address != ImageRange.Address)
502
                                    //        continue;
503

    
504
                                    //    double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
505
                                    //    double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
506

    
507
                                    //    shp.Left = float.Parse(Left.ToString());
508
                                    //    shp.Top = float.Parse(Top.ToString());
509

    
510
                                    //    break;
511
                                    //}
512
                                }
513

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

    
551
                            worksheet.Columns["G"].Width = Convert.ToInt32(worksheet.Columns["G"].Width * 1.1);
552
                            // 엑셀파일 저장
553
                            workbook.Save(dialog.FileName);
554
                           
555
                        }
556
                        finally
557
                        {                        
558
                            // Clean up
559
                            ReleaseExcelObject(worksheet);
560
                            ReleaseExcelObject(workbook);
561
                        }
562
                    }
563
                    DialogMessage_Alert("Success");
564
                }
565

    
566
                this.ExportIndy.IsBusy = false;
567
            }
568
            catch (Exception ex)
569
            {
570
                //Logger.sendResLog("CheckList ExportEvent", ex.Message, 0);
571
            }
572

    
573
        }
574

    
575
        private static void SetWidth(ExcelColumn column, double width)
576
        {
577
            column.SetWidth(
578
                Math.Truncate((width * 7 + 5) / 7 * 256) / 256,
579
                LengthUnit.ZeroCharacterWidth);
580
        }
581

    
582

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

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

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

    
605
                var res = new System.Drawing.Bitmap(newWidth, newHeight);
606

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

    
624
            
625
        }
626

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

    
647
        #endregion
648

    
649
        #region 이벤트
650

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

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

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

    
674
        private void AddEvent(object sender, RoutedEventArgs e)
675
        {
676
            try
677
            {
678
                mainWindow.Focus();
679

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

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

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

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

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

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

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

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

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

    
760
                            List<string> validation = new List<string>();
761

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

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

    
796
                                    var result = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History).ToString();
797

    
798
                                    Logger.sendReqLog("AddCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_History, 1);
799
                                    Logger.sendResLog("AddCheckListHistory", result, 1);
800

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
899
                }
900
                else
901
                {
902
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
903
                }
904
            }
905

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1007
                        isCheck_Status = true;
1008

    
1009
                        RadWindow CheckPop = new RadWindow();
1010

    
1011
                        CheckList_Status check = new CheckList_Status();
1012

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

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

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

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

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

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

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

    
1080
        }
1081

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

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

    
1109
                Isinit = true;
1110

    
1111
                RadWindow CheckPop = new RadWindow();
1112

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

    
1119
                    CommantImage check = new CommantImage(img);
1120

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

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

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

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

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

    
1167
        }
1168

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

    
1190

    
1191

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

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

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