프로젝트

일반

사용자정보

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

markus / KCOM / Controls / CheckList.xaml.cs @ 9f473fb7

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

1
using KCOMDataModel.Common;
2
using KCOMDataModel.DataModel;
3
using System;
4
using System.Collections.Generic;
5
using System.Collections.ObjectModel;
6
using System.Linq;
7
using System.Text;
8
using System.Windows;
9
using System.Windows.Controls;
10
using System.Windows.Data;
11
using System.Windows.Documents;
12
using System.Windows.Input;
13
using System.Windows.Media;
14
using System.Windows.Media.Imaging;
15
using System.Windows.Navigation;
16
using System.Windows.Shapes;
17
using Telerik.Windows.Controls;
18
using KCOM.Common.Converter;
19
using System.ComponentModel;
20
using Telerik.Windows.Controls.GridView;
21
using KCOM.Controls;
22
using KCOM.Common;
23
using IKCOM;
24
using Excel = Microsoft.Office.Interop.Excel;
25

    
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
        #endregion
90

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

    
103
        public void DataBind()
104
        {
105
            Isinit = false;
106

    
107
            Lists = new List<Customer>();
108
            string doc_no = (Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
109
            using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
110
            {
111
                items = Entity.CHECK_LIST.Where(i => i.PROJECT_NO == App.ViewInfo.ProjectNO && i.DOCUMENT_NO == doc_no && i.USER_ID == App.ViewInfo.UserID).OrderBy(p => p.CREATE_TIME).ToList();
112

    
113
                if (Lists.Count == 0)
114
                {
115
                    foreach (var item in items)
116
                    {
117
                        Customer customer = new Customer();
118
                        customer.ID = item.ID;
119
                        customer.IMAGE_ANCHOR = item.IMAGE_ANCHOR;
120
                        if (item.IMAGE_URL != null && item.IMAGE_URL != "")
121
                            customer.IMAGE_PATH = Convert.FromBase64String(item.IMAGE_URL);
122
                        customer.PAGENUMBER = item.PAGENUMBER;
123
                        customer.PROJECT_NO = item.PROJECT_NO;
124
                        customer.REMARK = item.REMARK;
125
                        customer.REVISION = item.REVISION;
126

    
127
                        #region history
128
                        var history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == item.ID).ToList();
129
                        foreach (var rev in history)
130
                        {
131
                            if (rev.REVISION == "A")
132
                            { customer.REV_0 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); }
133
                            if (rev.REVISION == "B")
134
                            { customer.REV_1 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 2 ? 2 : rev_cnt; }
135
                            if (rev.REVISION == "C")
136
                            { customer.REV_2 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 3 ? 3 : rev_cnt; }
137
                            if (rev.REVISION == "D")
138
                            { customer.REV_3 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 4 ? 4 : rev_cnt; }
139
                            if (rev.REVISION == "E")
140
                            { customer.REV_4 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 5 ? 5 : rev_cnt; }
141
                            if (rev.REVISION == "F")
142
                            { customer.REV_5 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 6 ? 6 : rev_cnt; }
143
                            if (rev.REVISION == "G")
144
                            { customer.REV_6 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 7 ? 7 : rev_cnt; }
145
                            if (rev.REVISION == "H")
146
                            { customer.REV_7 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 8 ? 8 : rev_cnt; }
147
                            if (rev.REVISION == "I")
148
                            { customer.REV_8 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 9 ? 9 : rev_cnt; }
149
                            if (rev.REVISION == "J")
150
                            { customer.REV_9 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 10 ? 10 : rev_cnt; }
151
                            if (rev.REVISION == "K")
152
                            { customer.REV_10 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 11 ? 11 : rev_cnt; }
153
                            if (rev.REVISION == "L")
154
                            { customer.REV_11 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 12 ? 12 : rev_cnt; }
155
                            if (rev.REVISION == "M")
156
                            { customer.REV_12 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 13 ? 13 : rev_cnt; }
157
                            if (rev.REVISION == "N")
158
                            { customer.REV_13 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 14 ? 14 : rev_cnt; }
159
                            if (rev.REVISION == "O")
160
                            { customer.REV_14 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 15 ? 15 : rev_cnt; }
161
                            if (rev.REVISION == "P")
162
                            { customer.REV_15 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 16 ? 16 : rev_cnt; }
163
                            if (rev.REVISION == "Q")
164
                            { customer.REV_16 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 17 ? 17 : rev_cnt; }
165
                            if (rev.REVISION == "R")
166
                            { customer.REV_17 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 18 ? 18 : rev_cnt; }
167
                            if (rev.REVISION == "S")
168
                            { customer.REV_18 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 19 ? 19 : rev_cnt; }
169
                            if (rev.REVISION == "T")
170
                            { customer.REV_19 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 20 ? 20 : rev_cnt; }
171
                        }
172
                        #endregion
173

    
174
                        customer.STATUS = item.STATUS;
175
                        customer.REPLY = item.REPLY;
176
                        customer.TODOLIST = item.TODOLIST;
177
                        customer.USER_ID = item.USER_ID;
178
                        customer.VENDOR = item.VENDOR;
179
                        customer.DOCUMENT_ID = item.DOCUMENT_ID;
180
                        customer.CREATE_TIME = DateTime.Parse(item.CREATE_TIME.ToString());
181

    
182
                        if (item.STATUS == "True")
183
                        {
184
                            customer._STATUS = "Close";
185
                            customer.STATUS_ = "False";
186
                            customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
187
                        }
188
                        else
189
                        {
190
                            customer._STATUS = "Open";
191
                            customer.STATUS_ = "True";
192
                            customer.STATUS_DESC = item.STATUS_DESC_OPEN;
193
                        }
194
                        
195
                        Lists.Add(customer);
196
                    }
197
                }
198
            }
199
        }
200

    
201
        private void ChangeSize(double width, double height)
202
        {
203
            this.Width = width;
204
            this.Height = height;
205
        }
206

    
207
        private void SyncInit()
208
        {
209
            if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
210
            {
211
                ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
212
                ViewerDataModel.Instance.PageBalanceMode = false;
213
                ViewerDataModel.Instance.PageBalanceNumber = 0;
214
                ViewerDataModel.Instance.PageNumber = 0;
215
                ViewerDataModel.Instance.MarkupControls_Sync.Clear();
216
                ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
217
                ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
218
                ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
219
            }
220
        }
221

    
222
        private void DialogMessage_Alert(string Msg)
223
        {
224
            RadWindow CheckPop = new RadWindow();
225
            Alert check = new Alert(Msg);
226

    
227
            CheckPop = new RadWindow
228
            {
229
                MinWidth = 400,
230
                MinHeight = 100,
231
                Header = "Alert",
232
                Content = check,
233
                ResizeMode = System.Windows.ResizeMode.NoResize,
234
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
235
                IsTopmost = true,
236
            };
237
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
238
            CheckPop.ShowDialog();
239
        }
240

    
241
        private void History_Set()
242
        {
243
            if (col1.Width != new GridLength(1200))
244
            {
245
                Col_Remark.IsVisible = true;
246
                Col_Reply.IsVisible = true;
247
                Col_Vendor.IsVisible = true;
248

    
249
                if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
250
                    REV_1.IsVisible = true;
251

    
252
                #region history
253
                REV_0.IsVisible = true;
254
                if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
255
                    { REV_1.IsVisible = true; REV_0.Width = 70; }
256
                else
257
                { REV_0.Width = 140;}
258
                if (Lists.Where(info => info.REV_2 != null).FirstOrDefault() != null)
259
                    REV_2.IsVisible = true; REV_2.IsVisible = true;
260
                if (Lists.Where(info => info.REV_3 != null).FirstOrDefault() != null)
261
                    REV_3.IsVisible = true;
262
                if (Lists.Where(info => info.REV_4 != null).FirstOrDefault() != null)
263
                    REV_4.IsVisible = true;
264
                if (Lists.Where(info => info.REV_5 != null).FirstOrDefault() != null)
265
                    REV_5.IsVisible = true;
266
                if (Lists.Where(info => info.REV_6 != null).FirstOrDefault() != null)
267
                    REV_6.IsVisible = true;
268
                if (Lists.Where(info => info.REV_7 != null).FirstOrDefault() != null)
269
                    REV_7.IsVisible = true;
270
                if (Lists.Where(info => info.REV_8 != null).FirstOrDefault() != null)
271
                    REV_8.IsVisible = true;
272
                if (Lists.Where(info => info.REV_9 != null).FirstOrDefault() != null)
273
                    REV_9.IsVisible = true;
274
                if (Lists.Where(info => info.REV_10 != null).FirstOrDefault() != null)
275
                    REV_10.IsVisible = true;
276
                if (Lists.Where(info => info.REV_11 != null).FirstOrDefault() != null)
277
                    REV_11.IsVisible = true;
278
                if (Lists.Where(info => info.REV_12 != null).FirstOrDefault() != null)
279
                    REV_12.IsVisible = true;
280
                if (Lists.Where(info => info.REV_13 != null).FirstOrDefault() != null)
281
                    REV_13.IsVisible = true;
282
                if (Lists.Where(info => info.REV_14 != null).FirstOrDefault() != null)
283
                    REV_14.IsVisible = true;
284
                if (Lists.Where(info => info.REV_15 != null).FirstOrDefault() != null)
285
                    REV_15.IsVisible = true;
286
                if (Lists.Where(info => info.REV_16 != null).FirstOrDefault() != null)
287
                    REV_16.IsVisible = true;
288
                if (Lists.Where(info => info.REV_17 != null).FirstOrDefault() != null)
289
                    REV_17.IsVisible = true;
290
                if (Lists.Where(info => info.REV_18 != null).FirstOrDefault() != null)
291
                    REV_18.IsVisible = true;
292
                if (Lists.Where(info => info.REV_19 != null).FirstOrDefault() != null)
293
                    REV_19.IsVisible = true;
294
                #endregion
295

    
296
            }
297
            else
298
            {
299
                Col_Remark.IsVisible = false;
300
                Col_Reply.IsVisible = false;
301
                Col_Vendor.IsVisible = false;
302

    
303
                #region history
304
                REV_0.IsVisible = false;
305
                REV_1.IsVisible = false;
306
                REV_2.IsVisible = false;
307
                REV_3.IsVisible = false;
308
                REV_4.IsVisible = false;
309
                REV_5.IsVisible = false;
310
                REV_6.IsVisible = false;
311
                REV_7.IsVisible = false;
312
                REV_8.IsVisible = false;
313
                REV_9.IsVisible = false;
314
                REV_10.IsVisible = false;
315
                REV_11.IsVisible = false;
316
                REV_12.IsVisible = false;
317
                REV_13.IsVisible = false;
318
                REV_14.IsVisible = false;
319
                REV_15.IsVisible = false;
320
                REV_16.IsVisible = false;
321
                REV_17.IsVisible = false;
322
                REV_18.IsVisible = false;
323
                REV_19.IsVisible = false;
324
                #endregion
325
            }
326
        }
327

    
328
        #region Excel Export
329

    
330
        private void ExportEvent(object sender, RoutedEventArgs e)
331
        {
332
            this.ExportIndy.IsBusy = true;
333

    
334
            if (Lists.Count == 0)
335
            {
336
                DialogMessage_Alert("Data Not Found");
337
                this.ExportIndy.IsBusy = false;
338
                return;
339
            }
340

    
341
            string extension = "xlsx";
342
            //Uri url = new Uri("http://cloud.devdoftech.co.kr:5977/TileSource/Check_Test/CheckList.xlsx");
343
            Uri url = new Uri("http://cloud.devdoftech.co.kr:5977/TileSource/Check_Test/CheckList_T.xlsx");
344

    
345
            System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog()
346
            {
347
                DefaultExt = extension,
348
                Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
349
                FilterIndex = 1
350
            };
351

    
352
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
353
            {
354
                using (var client = new System.Net.WebClient())
355
                {
356
                    client.DownloadFile(url, dialog.FileName);
357

    
358
                    Excel.Application application = null;
359
                    Excel.Workbook workbook = null;
360
                    Excel.Worksheet worksheet = null;
361

    
362
                    try
363
                    {
364
                        // Excel 첫번째 워크시트 가져오기                
365
                        application = new Excel.Application();
366
                        workbook = application.Workbooks.Open(dialog.FileName);
367
                        worksheet = (Excel.Worksheet)workbook.Worksheets.get_Item("Sheet1");
368

    
369
                        // 데이타 넣기
370
                        int h = 9;
371
                        int w = 2;
372

    
373
                        worksheet.Cells[2, w + 8] = App.ViewInfo.ProjectNO;
374
                        using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
375
                        {
376
                            worksheet.Cells[3, w + 8] = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == App.ViewInfo.ProjectNO).FirstOrDefault().PROJECT_NAME.ToString();
377
                        }
378

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

    
383
                        Excel.Range Range_I = worksheet.Range["K9"];
384
                        Excel.Range Range_O = null;
385
                        Excel.Borders border_ = null;
386

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

    
392
                        for (int i = 0; i < rev_cnt - 1; i++)
393
                        {
394
                            worksheet.Cells[9, 12 + i] = Cell[i];
395
                            Range_O = worksheet.Range[Range[i]];
396
                            border_ = Range_O.Borders;
397
                            border_.LineStyle = Range_I.Borders.LineStyle;
398
                            border_.Weight = Range_I.Borders.Weight;
399
                            Range_O.Interior.Color = Range_I.Interior.Color;
400
                        }
401

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

    
404
                        if (rev_cnt != 1)
405
                        {
406
                            Ran = Range[rev_cnt - 2].Substring(0, Range[rev_cnt - 2].Length - 1);
407
                        }
408
                        Excel.Range iRange = worksheet.Range["B10:" + Ran + "10"];
409

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

    
414
                        Lists.ForEach(data =>
415
                        {
416
                            h++;
417

    
418
                            Excel.Range oRange = worksheet.Range["B" + h + ":" + Ran + h];
419
                            oRange.RowHeight = iRange.RowHeight;
420
                            Excel.Borders border = oRange.Borders;
421
                            border.LineStyle = Excel.XlLineStyle.xlContinuous;
422
                            border.Weight = 2d;
423

    
424
                            if (data.IMAGE_PATH != null)
425
                            {
426
                                Excel.Range ImageRange = worksheet.Cells[h, w + 2];
427

    
428
                                System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH);
429
                                System.Drawing.Image o_Image = Resize(I_Image, 80, 80);
430
                                System.Windows.Forms.Clipboard.SetDataObject(o_Image, true);
431

    
432
                                ImageRange.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenterAcrossSelection;
433
                                ImageRange.Cells.VerticalAlignment = Excel.XlHAlign.xlHAlignCenter;
434

    
435
                                worksheet.Paste(ImageRange.Cells, "TEST");
436

    
437
                                foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes)
438
                                {
439
                                    if (shp.TopLeftCell.Address != ImageRange.Address)
440
                                        continue;
441

    
442
                                    double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
443
                                    double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
444

    
445
                                    shp.Left = float.Parse(Left.ToString());
446
                                    shp.Top = float.Parse(Top.ToString());
447

    
448
                                    break;
449
                                }
450
                            }
451

    
452
                            #region Excel Bind
453
                            worksheet.Cells[h, w] = data.REVISION;
454
                            worksheet.Cells[h, w + 1] = data.PAGENUMBER;
455
                            worksheet.Cells[h, w + 3] = data.TODOLIST;
456
                            worksheet.Cells[h, w + 4] = data.STATUS;
457
                            worksheet.Cells[h, w + 5] = data.STATUS_DESC;
458
                            worksheet.Cells[h, w + 6] = data.VENDOR;
459
                            worksheet.Cells[h, w + 7] = data.REMARK;
460
                            worksheet.Cells[h, w + 8] = data.REPLY;
461
                            worksheet.Cells[h, w + 9] = data.REV_0 == null ? "" : data.REV_0.Replace("", " / ");
462
                            worksheet.Cells[h, w + 10] = data.REV_1 == null ? "" : data.REV_1.Replace("", " / ");
463
                            worksheet.Cells[h, w + 11] = data.REV_2 == null ? "" : data.REV_2.Replace("", " / ");
464
                            worksheet.Cells[h, w + 12] = data.REV_3 == null ? "" : data.REV_3.Replace("", " / ");
465
                            worksheet.Cells[h, w + 13] = data.REV_4 == null ? "" : data.REV_4.Replace("", " / ");
466
                            worksheet.Cells[h, w + 14] = data.REV_5 == null ? "" : data.REV_5.Replace("", " / ");
467
                            worksheet.Cells[h, w + 15] = data.REV_6 == null ? "" : data.REV_6.Replace("", " / ");
468
                            worksheet.Cells[h, w + 16] = data.REV_7 == null ? "" : data.REV_7.Replace("", " / ");
469
                            worksheet.Cells[h, w + 17] = data.REV_8 == null ? "" : data.REV_8.Replace("", " / ");
470
                            worksheet.Cells[h, w + 18] = data.REV_9 == null ? "" : data.REV_9.Replace("", " / ");
471
                            worksheet.Cells[h, w + 19] = data.REV_10 == null ? "" : data.REV_10.Replace("", " / ");
472
                            worksheet.Cells[h, w + 20] = data.REV_11 == null ? "" : data.REV_11.Replace("", " / ");
473
                            worksheet.Cells[h, w + 21] = data.REV_12 == null ? "" : data.REV_12.Replace("", " / ");
474
                            worksheet.Cells[h, w + 22] = data.REV_13 == null ? "" : data.REV_13.Replace("", " / ");
475
                            worksheet.Cells[h, w + 23] = data.REV_14 == null ? "" : data.REV_14.Replace("", " / ");
476
                            worksheet.Cells[h, w + 24] = data.REV_15 == null ? "" : data.REV_15.Replace("", " / ");
477
                            worksheet.Cells[h, w + 25] = data.REV_16 == null ? "" : data.REV_16.Replace("", " / ");
478
                            worksheet.Cells[h, w + 26] = data.REV_17 == null ? "" : data.REV_17.Replace("", " / ");
479
                            worksheet.Cells[h, w + 27] = data.REV_18 == null ? "" : data.REV_18.Replace("", " / ");
480
                            worksheet.Cells[h, w + 28] = data.REV_19 == null ? "" : data.REV_19.Replace("", " / ");
481
                            #endregion
482
                        });
483

    
484
                        worksheet.Columns.AutoFit();
485
                        // 엑셀파일 저장
486
                        workbook.Save();
487
                        workbook.Close(true);
488
                        application.Quit();
489
                    }
490
                    finally
491
                    {
492
                        System.Diagnostics.Process[] ExCel = System.Diagnostics.Process.GetProcessesByName("EXCEL");
493
                        if (ExCel.Count() != 0)
494
                        {
495
                            ExCel[0].Kill();
496
                        }
497

    
498
                        // Clean up
499
                        ReleaseExcelObject(worksheet);
500
                        ReleaseExcelObject(workbook);
501
                        ReleaseExcelObject(application);
502
                    }
503
                }
504
                DialogMessage_Alert("Success");
505
            }
506

    
507
            this.ExportIndy.IsBusy = false;
508
        }
509

    
510
        public System.Drawing.Image byteArrayToImage(byte[] byteArrayIn)
511
        {
512
            using (var ms = new System.IO.MemoryStream(byteArrayIn))
513
            {
514
                return System.Drawing.Image.FromStream(ms);
515
            }
516
        }
517

    
518
        public System.Drawing.Image Resize(System.Drawing.Image image, int newWidth, int maxHeight)
519
        {
520
            //if (onlyResizeIfWider && image.Width <= newWidth) newWidth = image.Width;
521

    
522
            var newHeight = image.Height * newWidth / image.Width;
523
            if (newHeight > maxHeight)
524
            {
525
                // Resize with height instead  
526
                newWidth = image.Width * maxHeight / image.Height;
527
                newHeight = maxHeight;
528
            }
529

    
530
            var res = new System.Drawing.Bitmap(newWidth, newHeight);
531

    
532
            using (var graphic = System.Drawing.Graphics.FromImage(res))
533
            {
534
                graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
535
                graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
536
                graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
537
                graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
538
                graphic.DrawImage(image, 0, 0, newWidth, newHeight);
539
            }
540

    
541
            return res;
542
        }
543

    
544
        private static void ReleaseExcelObject(object obj)
545
        {
546
            try
547
            {
548
                if (obj != null)
549
                {
550
                    obj = null;
551
                }
552
            }
553
            catch (Exception ex)
554
            {
555
                obj = null;
556
                throw ex;
557
            }
558
            finally
559
            {
560
                GC.Collect();
561
            }
562
        }
563

    
564
        #endregion
565

    
566
        #region 이벤트
567

    
568
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
569
        {
570
            ChangeSize(e.NewSize.Width, e.NewSize.Height);
571
        }
572

    
573
        private void CheckList_Loaded(object sender, RoutedEventArgs e)
574
        {
575
            Current_DocNo = (Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
576
            Current_Revision = (Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.REVISION;
577
            Current_Slip = int.Parse((Application.Current.MainWindow as MainWindow).dzMainMenu._DocItem.GROUP_NO);
578

    
579
            using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
580
            {
581
                var Gaby = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == App.ViewInfo.ProjectNO
582
                && i.DOCUMENT_NO == Current_DocNo
583
                && i.REVISION != Current_Revision).OrderByDescending(i => i.GROUP_NO);
584

    
585
                foreach (var I in Gaby)
586
                {
587
                    if (int.Parse(I.GROUP_NO) < Current_Slip)
588
                    {
589
                        old_Revision = I.REVISION;
590
                        old_DocID = I.DOCUMENT_ID;
591
                        return;
592
                    }
593
                }
594
            }
595
        }
596

    
597
        private void RadGridView_Loaded(object sender, RoutedEventArgs e)
598
        {
599
            DataBind();
600
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = null;
601
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = Lists;
602

    
603
            ChangeSize(this.ActualWidth, this.ActualHeight);
604
            this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
605
        }
606

    
607
        private void AddEvent(object sender, RoutedEventArgs e)
608
        {
609
            Application.Current.MainWindow.Focus();
610

    
611
            Common.ViewerDataModel.Instance.CheckList_ID = KCOM.Events.Save.shortGuid();
612
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.5;
613
            (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
614
        }
615

    
616
        private void SaveEvent(object sender, RoutedEventArgs e)
617
        {
618
            CHECK_LIST Check_value = new CHECK_LIST();
619
            CHECK_LIST_HISTORY Check_History = new CHECK_LIST_HISTORY();
620

    
621
            using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
622
            {
623
                foreach (var item in tb.Items)
624
                {
625
                    string Check_ID = (item as Customer).ID.ToString();
626
                    string state = "";
627

    
628
                    Check_value = Entity.CHECK_LIST.Where(info => info.ID == Check_ID).FirstOrDefault();
629

    
630
                    if (Check_value != null)
631
                    {
632
                        if ((item as Customer).STATUS.ToUpper() == "TRUE")
633
                        {
634
                            state = "Closed";
635
                            Check_value.STATUS_DESC_CLOSE = (item as Customer).STATUS_DESC;
636
                        }
637
                        else
638
                        {
639
                            state = "Open";
640
                            Check_value.STATUS_DESC_OPEN = (item as Customer).STATUS_DESC;
641
                        }
642

    
643
                        string Rev = state + "" + DateTime.Now.ToString("yyyy.MM.dd");
644
                        string description = "";
645

    
646
                        if (char.Parse(ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision) >= char.Parse(Check_value.REVISION))
647
                        {
648
                            Check_value.REMARK = (item as Customer).REMARK;
649
                            Check_value.STATUS = (item as Customer).STATUS;
650
                            Check_value.TODOLIST = (item as Customer).TODOLIST;
651
                            Check_value.VENDOR = (item as Customer).VENDOR;
652
                            Check_value.REPLY = (item as Customer).REPLY;
653

    
654
                            if (state == "Open")
655
                                description = Check_value.STATUS_DESC_OPEN;
656
                            else
657
                                description = Check_value.STATUS_DESC_CLOSE;
658

    
659
                            var history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == Check_ID).ToList();
660

    
661
                            Check_History = history.Where(info => info.REVISION == ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision).FirstOrDefault();
662

    
663
                            //Check_History = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == Check_ID && info.REVISION == ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision).FirstOrDefault();
664

    
665
                            //var history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == Check_ID).ToList();
666
                            List<string> validation = new List<string>();
667

    
668
                            foreach (var his in history)
669
                            {
670
                                if (his.TODOLIST == Check_value.TODOLIST)
671
                                    validation.Add("TODOLIST");
672
                                if ( his.STATUS_DESC == description)
673
                                    validation.Add("STATUS_DESC");
674
                                if (his.VENDOR == Check_value.VENDOR)
675
                                    validation.Add("VENDOR");
676
                                if (his.REMARK == Check_value.REMARK)
677
                                    validation.Add("REMARK");
678
                                if (his.REPLY == Check_value.REPLY)
679
                                    validation.Add("REPLY");
680
                            }
681

    
682
                            if (validation.Count < 5)
683
                            {
684
                                if (Check_History == null)
685
                                {
686
                                    Check_History = new CHECK_LIST_HISTORY()
687
                                    {
688
                                        ID = Events.Save.shortGuid(),
689
                                        CHECKLIST_ID = Check_ID,
690
                                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
691
                                        STATUS = state,
692
                                        IMAGE_URL = Check_value.IMAGE_URL,
693
                                        STATUS_DESC = validation.Where(i => i.ToString() == "STATUS_DESC").FirstOrDefault() == null ? description : "",
694
                                        TODOLIST = validation.Where(i => i.ToString() == "TODOLIST").FirstOrDefault() == null ? Check_value.TODOLIST : "",
695
                                        VENDOR = validation.Where(i => i.ToString() == "VENDOR").FirstOrDefault() == null ? Check_value.VENDOR : "",
696
                                        REMARK = validation.Where(i => i.ToString() == "REMARK").FirstOrDefault() == null ?  Check_value.REMARK : "",
697
                                        REPLY = validation.Where(i => i.ToString() == "REPLY").FirstOrDefault() == null ?  Check_value.REPLY : "",
698
                                        CREATE_TIME = DateTime.Now,
699
                                        UPDATE_TIME = DateTime.Now
700
                                    };
701
                                    Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
702
                                    Check_value.REVISION = Current_Revision;
703
                                }
704
                                else
705
                                {
706
                                    Check_History.IMAGE_URL = Check_value.IMAGE_URL;
707
                                    Check_History.STATUS = Check_value.STATUS;
708
                                    Check_History.TODOLIST = Check_value.TODOLIST;
709
                                    Check_History.VENDOR = Check_value.VENDOR;
710
                                    Check_History.REMARK = Check_value.REMARK;
711
                                    Check_History.REPLY = Check_value.REPLY;
712
                                    Check_History.UPDATE_TIME = DateTime.Now;
713
                                }
714
                            }
715
                            validation = new List<string>();
716
                        }
717
                    }
718
                    Entity.SaveChanges();
719
                }
720

    
721
                DataBind();
722
                tb.ItemsSource = null;
723
                tb.ItemsSource = Lists;
724
                History_Set();
725

    
726
                //MessageBox.Show("Success");
727
                DialogMessage_Alert("Success");
728
            }
729
        }
730

    
731
        private void CheckListEvent(object sender, RoutedEventArgs e)
732
        {
733
            if (col1.Width == new GridLength(1200))
734
            {
735
                this.Width += 600;
736
                col1.Width = new GridLength(1800);
737
            }
738
            else
739
            {
740
                this.Width -= 600;
741
                col1.Width = new GridLength(1200);
742
            }
743
            History_Set();
744
        }
745

    
746
        private void CommentMoveEvent(object sender, MouseButtonEventArgs e)
747
        {
748
            SyncInit();
749

    
750
            Rect rect = new Rect();
751
            string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
752
            //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
753

    
754
            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])));
755

    
756
            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
757
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
758
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
759
            Application.Current.MainWindow.Focus();
760
        }
761

    
762
        private void CaptureEvent(object sender, MouseButtonEventArgs e)
763
        {
764
            SyncInit();
765

    
766
            //캡쳐 하기 전에 코멘트 저장
767
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
768
            {
769
                var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
770
                menu.ReleaseAdorner();
771
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
772
                {
773
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
774
                }
775
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
776
                {
777

    
778
                }
779
                else
780
                {
781
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
782
                }
783
            }
784

    
785
            //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
786
            Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
787
            Application.Current.MainWindow.Focus();
788
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
789
            (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
790
        }
791

    
792
        public void KeyEventDownAction(object sender, KeyEventArgs e)
793
        {
794
            switch (e.Key)
795
            {
796
                case Key.Escape:
797
                    {
798
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
799
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0;
800
                    }
801
                    break;
802
            }
803
        }
804

    
805
        private void tb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
806
        {
807
            if(ViewerDataModel.Instance.Capture_Opacity == 0)
808
                return;
809
            
810
            DataBind();
811
            tb.ItemsSource = null;
812
            tb.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
813
            //tb1.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
814

    
815
            if (ViewerDataModel.Instance.Capture_Opacity == 0.5)
816
            {
817
                tb.SortDescriptors.Clear();
818
                tb.FilterDescriptors.Clear();
819

    
820
                var scrollViewer = this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
821
                if (scrollViewer != null)
822
                {
823
                    //this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
824
                    //this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
825

    
826
                    tb.ScrollIndexIntoView(tb.Items.Count - 1);
827
                    tb.CurrentCellInfo = new GridViewCellInfo(tb.Items[tb.Items.Count - 1], tb.Columns["TODOLIST"]);
828
                    tb.Focus();
829

    
830
                }
831
            }
832
        }
833

    
834
        private void Radio_Open_Checked(object sender, RoutedEventArgs e)
835
        {
836
            (e.Source as RadioButton).Foreground = Brushes.Red;
837
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
838

    
839
            if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
840
            {
841
                ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Open";
842
            }
843

    
844
            if (Isinit)
845
            {
846
                Isinit = false;
847
                if ((e.Source as RadioButton).DataContext != null)
848
                {
849
                    if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 필요")
850
                    {
851
                        ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 필요";
852

    
853
                        tb.Rebind();
854
                    }
855
                }
856
            }
857
        }
858

    
859
        private void Radio_Close_Checked(object sender, RoutedEventArgs e)
860
        {
861
            //if (tb.FilterDescriptors.Count > 0)
862
            //{
863
            //    Filter_Set();
864
            //}
865

    
866
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
867

    
868
            if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
869
            {
870
                ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Close";
871
            }
872

    
873
            if (Isinit)
874
            {
875
                Isinit = false;
876
                if ((e.Source as RadioButton).DataContext != null)
877
                {
878
                    if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 확인")
879
                    {
880
                        ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 확인";
881
                        //tb.ItemsSource = null;
882
                        //tb.ItemsSource = Lists;
883
                        tb.Rebind();
884
                    }
885
                }
886
            }
887
            this.Focus();
888
        }
889

    
890
        private void Radio_Unchecked(object sender, RoutedEventArgs e)
891
        {
892
            (e.Source as RadioButton).Foreground = Brushes.Black;
893
            (e.Source as RadioButton).FontWeight = FontWeights.Normal;
894
        }
895

    
896
        private void mousedownOnImage(object sender, MouseButtonEventArgs args)
897
        {
898
            if(args.OriginalSource as TextBlock != null && (args.OriginalSource as TextBlock).Parent != null)
899
            {
900
                if((args.OriginalSource as TextBlock).Parent.GetType().Name == "GridViewHeaderCell")
901
                {
902
                    Isinit = false;
903
                    return;
904
                }
905
            }
906

    
907
            Isinit = true;
908

    
909
            RadWindow CheckPop = new RadWindow();
910

    
911
            if (args.OriginalSource is Image)
912
            {
913
                Image img = (args.OriginalSource as Image);
914
                if (img.Height != 45)
915
                    return;
916

    
917
                CommantImage check = new CommantImage(img);
918

    
919
                CheckPop = new RadWindow
920
                {
921
                    MinWidth = 500,
922
                    MinHeight = 500,
923
                    Header = "Image",
924
                    Content = check,
925
                    ResizeMode = System.Windows.ResizeMode.NoResize,
926
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
927
                    IsTopmost = true,
928
                };
929
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
930
                CheckPop.Show();
931
            }
932
            
933
            if (args.OriginalSource as TextBlock == null || (args.OriginalSource as TextBlock).Parent == null || ((args.OriginalSource as TextBlock).Parent) as GridViewCell == null)
934
            {
935
                return;
936
            }
937

    
938
            if ((((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.ColumnGroupName.ToString() == "History")
939
            {
940

    
941
                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());
942

    
943
                CheckPop = new RadWindow
944
                {
945
                    MinWidth = 800,
946
                    MinHeight = 400,
947
                    Header = "Detail",
948
                    Content = Detail,
949
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
950
                    ResizeMode = System.Windows.ResizeMode.NoResize,
951
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
952
                    IsTopmost = true,
953
                };
954
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
955
                //CheckPop.ShowDialog();
956
                CheckPop.Show();
957
            }
958

    
959
        }
960

    
961
        private void SyncEvent(object sender, MouseButtonEventArgs e)
962
        {
963

    
964
            using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
965
            {
966
                var _vpList = (from docitem in entity.DOCUMENT_ITEM
967
                               where docitem.DOCUMENT_ID == old_DocID
968
                               select new VPRevision
969
                               {
970
                                   RevNo = docitem.REVISION,
971
                                   GroupNo = docitem.GROUP_NO,
972
                                   FROM_VENDOR = docitem.ORIGINAL_FILE,
973
                                   DOCUMENT_ID = docitem.DOCUMENT_ID,
974
                                   TO_VENDOR = docitem.RESULT_FILE,
975
                                   RESULT = docitem.RESULT,
976
                                   //IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : true
977
                               }).FirstOrDefault();
978

    
979

    
980
                if (old_DocID == "")
981
                {
982
                    //DialogMessage_Alert("상위 리비전이 없습니다.", "Alert");
983
                    //MessageBox.Show("상위 리비전이 없습니다.");
984
                    DialogMessage_Alert("상위 리비전이 없습니다.");
985
                    return;
986
                }
987

    
988
                SyncInit();
989
                Rect rect = new Rect();
990
                //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
991
                string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
992
                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])));
993
                //ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
994
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
995
                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.Sync_ZoomTo(rect);
996
                (Application.Current.MainWindow as MainWindow).dzMainMenu.Sync_Event(_vpList);
997
            }
998
        }
999

    
1000
        #endregion
1001

    
1002
        #region 불필요 해짐
1003

    
1004
        //private void RadGridView1_Loaded(object sender, RoutedEventArgs e)
1005
        //{
1006
        //    (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = Lists;
1007
        //}
1008

    
1009
        //private void Tb1_ScrollEvent(object sender, ScrollChangedEventArgs e)
1010
        //{
1011
        //    if ((e.Source as GridViewScrollViewer) == null)
1012
        //        return;
1013

    
1014
        //    if (this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault() != null)
1015
        //    {
1016
        //        this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset((e.Source as GridViewScrollViewer).VerticalOffset);
1017
        //    }
1018
        //}
1019

    
1020
        //private void Tb2_ScrollEvent(object sender, ScrollChangedEventArgs e)
1021
        //{
1022
        //    if ((e.Source as GridViewScrollViewer) == null)
1023
        //        return;
1024

    
1025
        //    this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset((e.Source as GridViewScrollViewer).VerticalOffset);
1026
        //}
1027

    
1028
        //private void tb_Sorted(object sender, GridViewSortedEventArgs e)
1029
        //{
1030
        //    Sort_Set();
1031
        //}
1032

    
1033
        //private void tb_Filtered(object sender, GridViewFilteredEventArgs e)
1034
        //{
1035

    
1036
        //}
1037

    
1038
        //private void Filter_Set()
1039
        //{
1040
        //    if (tb.FilterDescriptors.ToString().ToLower().Contains("open") || tb.FilterDescriptors.ToString().ToLower().Contains("close"))
1041
        //    {
1042
        //        if (tb.FilterDescriptors.ToString().ToLower().Contains("open") && tb.FilterDescriptors.ToString().ToLower().Contains("close"))
1043
        //        {
1044
        //            Lists = tb.ItemsSource as List<Customer>;
1045
        //        }
1046
        //        else if (tb.FilterDescriptors.ToString().ToLower().Contains("open"))
1047
        //        {
1048
        //            Lists = Lists.Where(data => data._STATUS.ToLower() == "open").ToList();
1049
        //        }
1050
        //        else
1051
        //        {
1052
        //            Lists = Lists.Where(data => data._STATUS.ToLower() == "close").ToList();
1053
        //        }
1054
        //    }
1055
        //    else
1056
        //    {
1057
        //        Lists = tb.ItemsSource as List<Customer>;
1058
        //    }
1059

    
1060
        //    tb1.ItemsSource = null;
1061
        //    tb1.ItemsSource = Lists;
1062
        //}
1063

    
1064
        //private void Sort_Set()
1065
        //{
1066
        //    if (tb.SortDescriptors.Count > 0)
1067
        //    {
1068
        //        string Orderby = tb.SortDescriptors.FirstOrDefault().SortDirection.ToString();
1069

    
1070
        //        if (Orderby.ToLower() == "ascending")
1071
        //        {
1072
        //            switch ((tb.SortDescriptors.FirstOrDefault() as ColumnSortDescriptor).Column.UniqueName)
1073
        //            {
1074
        //                case ("PAGENUMBER"):
1075
        //                    {
1076
        //                        Lists = Lists.OrderBy(info => info.PAGENUMBER).ToList();
1077
        //                    }
1078
        //                    break;
1079
        //                case ("REVISION"):
1080
        //                    {
1081
        //                        Lists = Lists.OrderBy(info => info.REVISION).ToList();
1082
        //                    }
1083
        //                    break;
1084
        //                case ("TODOLIST"):
1085
        //                    {
1086
        //                        Lists = Lists.OrderBy(info => info.TODOLIST).ToList();
1087
        //                    }
1088
        //                    break;
1089
        //                case ("STATUS_DESC"):
1090
        //                    {
1091
        //                        Lists = Lists.OrderBy(info => info.STATUS_DESC).ToList();
1092
        //                    }
1093
        //                    break;
1094
        //                case ("_STATUS"):
1095
        //                    {
1096
        //                        Lists = Lists.OrderBy(info => info._STATUS).ToList();
1097
        //                    }
1098
        //                    break;
1099
        //            }
1100
        //        }
1101
        //        else
1102
        //        {
1103
        //            switch ((tb.SortDescriptors.FirstOrDefault() as ColumnSortDescriptor).Column.UniqueName)
1104
        //            {
1105
        //                case ("PAGENUMBER"):
1106
        //                    {
1107
        //                        Lists = Lists.OrderByDescending(info => info.PAGENUMBER).ToList();
1108
        //                    }
1109
        //                    break;
1110
        //                case ("REVISION"):
1111
        //                    {
1112
        //                        Lists = Lists.OrderByDescending(info => info.REVISION).ToList();
1113
        //                    }
1114
        //                    break;
1115
        //                case ("TODOLIST"):
1116
        //                    {
1117
        //                        Lists = Lists.OrderByDescending(info => info.TODOLIST).ToList();
1118
        //                    }
1119
        //                    break;
1120
        //                case ("STATUS_DESC"):
1121
        //                    {
1122
        //                        Lists = Lists.OrderByDescending(info => info.STATUS_DESC).ToList();
1123
        //                    }
1124
        //                    break;
1125
        //                case ("_STATUS"):
1126
        //                    {
1127
        //                        Lists = Lists.OrderByDescending(info => info._STATUS).ToList();
1128
        //                    }
1129
        //                    break;
1130
        //            }
1131
        //        }
1132
        //    }
1133
        //    else
1134
        //    {
1135
        //        Lists = Lists.OrderBy(p => p.CREATE_TIME).ToList();
1136
        //    }
1137

    
1138
        //    tb1.ItemsSource = null;
1139
        //    tb1.ItemsSource = Lists;
1140
        //    //tb1.Rebind();
1141
        //}
1142

    
1143
        //private void tb_RowValidating(object sender, GridViewRowValidatingEventArgs e)
1144
        //{
1145
        //    if (tb.SortDescriptors.Count > 0)
1146
        //    {
1147
        //        Sort_Set();
1148
        //    }
1149
        //}
1150

    
1151
        #endregion
1152
    }
1153
}
클립보드 이미지 추가 (최대 크기: 500 MB)