프로젝트

일반

사용자정보

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

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

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

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