프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (56.5 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 24a3178d djkim
using System.Text.RegularExpressions;
25 aa73d664 이지연
using GemBox.Spreadsheet;
26
using System.IO;
27 787a4489 KangIngu
28
namespace KCOM.Controls
29
{
30
31
    #region Customer
32
    public class Customer
33
    {
34
        public string ID { get; set; }
35
        public string DOCUMENT_ID { get; set; }
36
        public string USER_ID { get; set; }
37
        public string REVISION { get; set; }
38
        public int PAGENUMBER { get; set; }
39
        public string TODOLIST { get; set; }
40
        public string IMAGE_URL { get; set; }
41
        public string STATUS { get; set; }
42
        public string STATUS_ { get; set; }
43
        public string _STATUS { get; set; }
44
        public string VENDOR { get; set; }
45
        public string REMARK { get; set; }
46
        public string PROJECT_NO { get; set; }
47
        public string REV_19 { get; set; }
48
        public string REV_18 { get; set; }
49
        public string REV_17 { get; set; }
50
        public string REV_16 { get; set; }
51
        public string REV_15 { get; set; }
52
        public string REV_14 { get; set; }
53
        public string REV_13 { get; set; }
54
        public string REV_12 { get; set; }
55
        public string REV_11 { get; set; }
56
        public string REV_10 { get; set; }
57
        public string REV_9 { get; set; }
58
        public string REV_8 { get; set; }
59
        public string REV_7 { get; set; }
60
        public string REV_6 { get; set; }
61
        public string REV_5 { get; set; }
62
        public string REV_4 { get; set; }
63
        public string REV_3 { get; set; }
64
        public string REV_2 { get; set; }
65
        public string REV_1 { get; set; }
66
        public string REV_0 { get; set; }
67
        public string IMAGE_ANCHOR { get; set; }
68
        public byte[] IMAGE_PATH { get; set; }
69
        public string STATUS_DESC { get; set; }
70
        public string REPLY { get; set; }
71
        public DateTime CREATE_TIME { get; set; }
72 90e7968d ljiyeon
    } 
73 787a4489 KangIngu
    #endregion
74
75
    /// <summary>
76
    /// Interaction logic for CheckList.xaml
77
    /// </summary>
78
    public partial class CheckList : UserControl
79
    {
80
        #region 프로퍼티
81
        List<CHECK_LIST> items = new List<CHECK_LIST>();
82
        List<Customer> Lists = new List<Customer>();
83 77922798 송근호
        MainWindow mainWindow;
84 53880c83 ljiyeon
        //string old_Revision = "";
85 787a4489 KangIngu
        string old_DocID = "";
86
        string Current_Revision = "";
87 53880c83 ljiyeon
        //string Current_DocNo = "";
88
        //string Current_Slip = "";
89 787a4489 KangIngu
        bool Isinit = false;
90
        int rev_cnt = 1;
91 69ef0800 KangIngu
        bool isCheck_Status = false;
92
        string Select_StatusID = "";
93 787a4489 KangIngu
        #endregion
94
95
        #region 생성자
96 77922798 송근호
        public CheckList(MainWindow main)
97 787a4489 KangIngu
        {
98
            Common.ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
99
            InitializeComponent();
100 77922798 송근호
            mainWindow = main;
101 787a4489 KangIngu
            this.Loaded += CheckList_Loaded;
102
            this.KeyDown += new KeyEventHandler(KeyEventDownAction);
103
            this.AddHandler(Image.MouseLeftButtonDownEvent, new MouseButtonEventHandler(mousedownOnImage), true);
104 90e7968d ljiyeon
            
105 77922798 송근호
106 787a4489 KangIngu
        }
107
        #endregion
108
109
        public void DataBind()
110
        {
111 24a3178d djkim
            try
112
            {
113
                Isinit = false;
114 0f065e57 ljiyeon
115 24a3178d djkim
                Lists = new List<Customer>();
116 77922798 송근호
                string doc_no = mainWindow.dzMainMenu._DocItem.DOCUMENT_NO;
117 24a3178d djkim
                string project_no = App.ViewInfo.ProjectNO;
118
                string user_id = App.ViewInfo.UserID;
119
120 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetUserCheckList: ", project_no + "," + user_id + "," + doc_no, 1);
121 24a3178d djkim
122
                items = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetUserCheckList(project_no, user_id, doc_no);
123
                if (items.Count() > 0)
124
                {
125 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetUserCheckList", "TRUE", 1);
126 24a3178d djkim
                }
127
                else
128
                {
129 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetUserCheckList", "FALSE", 1);
130 24a3178d djkim
                }
131 0f065e57 ljiyeon
132 6c781c0c djkim
                foreach (var item in items)
133 787a4489 KangIngu
                {
134 6c781c0c djkim
                    Customer customer = new Customer();
135
                    customer.ID = item.ID;
136
                    customer.IMAGE_ANCHOR = item.IMAGE_ANCHOR;
137
                    if (item.IMAGE_URL != null && item.IMAGE_URL != "")
138
                        customer.IMAGE_PATH = Convert.FromBase64String(item.IMAGE_URL);
139
                    customer.PAGENUMBER = item.PAGENUMBER;
140
                    customer.PROJECT_NO = item.PROJECT_NO;
141
                    customer.REMARK = item.REMARK;
142
                    customer.REVISION = item.REVISION;
143
144
                    #region history
145 664ea2e1 taeseongkim
                    //Logger.sendReqLog("GetCheckListHistory: ", project_no + "," + item.ID, 1);
146 0f065e57 ljiyeon
                    var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(project_no, item.ID);
147
148
                    if (history.Count() > 0)
149
                    {
150 664ea2e1 taeseongkim
                        //Logger.sendResLog("GetCheckListHistory", "TRUE", 1);
151 0f065e57 ljiyeon
                    }
152
                    else
153
                    {
154 664ea2e1 taeseongkim
                        //Logger.sendResLog("GetCheckListHistory", "FALSE", 1);
155 0f065e57 ljiyeon
                    }
156
157 6c781c0c djkim
                    foreach (var rev in history)
158 787a4489 KangIngu
                    {
159 6c781c0c djkim
                        if (rev.REVISION == "A")
160
                        { customer.REV_0 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); }
161
                        if (rev.REVISION == "B")
162
                        { customer.REV_1 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 2 ? 2 : rev_cnt; }
163
                        if (rev.REVISION == "C")
164
                        { customer.REV_2 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 3 ? 3 : rev_cnt; }
165
                        if (rev.REVISION == "D")
166
                        { customer.REV_3 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 4 ? 4 : rev_cnt; }
167
                        if (rev.REVISION == "E")
168
                        { customer.REV_4 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 5 ? 5 : rev_cnt; }
169
                        if (rev.REVISION == "F")
170
                        { customer.REV_5 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 6 ? 6 : rev_cnt; }
171
                        if (rev.REVISION == "G")
172
                        { customer.REV_6 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 7 ? 7 : rev_cnt; }
173
                        if (rev.REVISION == "H")
174
                        { customer.REV_7 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 8 ? 8 : rev_cnt; }
175
                        if (rev.REVISION == "I")
176
                        { customer.REV_8 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 9 ? 9 : rev_cnt; }
177
                        if (rev.REVISION == "J")
178
                        { customer.REV_9 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 10 ? 10 : rev_cnt; }
179
                        if (rev.REVISION == "K")
180
                        { customer.REV_10 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 11 ? 11 : rev_cnt; }
181
                        if (rev.REVISION == "L")
182
                        { customer.REV_11 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 12 ? 12 : rev_cnt; }
183
                        if (rev.REVISION == "M")
184
                        { customer.REV_12 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 13 ? 13 : rev_cnt; }
185
                        if (rev.REVISION == "N")
186
                        { customer.REV_13 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 14 ? 14 : rev_cnt; }
187
                        if (rev.REVISION == "O")
188
                        { customer.REV_14 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 15 ? 15 : rev_cnt; }
189
                        if (rev.REVISION == "P")
190
                        { customer.REV_15 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 16 ? 16 : rev_cnt; }
191
                        if (rev.REVISION == "Q")
192
                        { customer.REV_16 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 17 ? 17 : rev_cnt; }
193
                        if (rev.REVISION == "R")
194
                        { customer.REV_17 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 18 ? 18 : rev_cnt; }
195
                        if (rev.REVISION == "S")
196
                        { customer.REV_18 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 19 ? 19 : rev_cnt; }
197
                        if (rev.REVISION == "T")
198
                        { customer.REV_19 = rev.STATUS + "" + rev.CREATE_TIME.ToString("yyyy.MM.dd"); rev_cnt = rev_cnt < 20 ? 20 : rev_cnt; }
199
                    }
200
                    #endregion
201 787a4489 KangIngu
202 6c781c0c djkim
                    customer.STATUS = item.STATUS;
203
                    customer.REPLY = item.REPLY;
204
                    customer.TODOLIST = item.TODOLIST;
205
                    customer.USER_ID = item.USER_ID;
206
                    customer.VENDOR = item.VENDOR;
207
                    customer.DOCUMENT_ID = item.DOCUMENT_ID;
208
                    customer.CREATE_TIME = DateTime.Parse(item.CREATE_TIME.ToString());
209 787a4489 KangIngu
210 6c781c0c djkim
                    if (item.STATUS == "True")
211
                    {
212
                        customer._STATUS = "Close";
213
                        customer.STATUS_ = "False";
214
                        customer.STATUS_DESC = item.STATUS_DESC_CLOSE;
215 787a4489 KangIngu
                    }
216 6c781c0c djkim
                    else
217
                    {
218
                        customer._STATUS = "Open";
219
                        customer.STATUS_ = "True";
220
                        customer.STATUS_DESC = item.STATUS_DESC_OPEN;
221
                    }
222
223
                    Lists.Add(customer);
224 787a4489 KangIngu
                }
225 24a3178d djkim
            }
226
            catch (Exception ex)
227
            {
228 274cde11 taeseongkim
                Logger.sendResLog("Checklist DataBind", ex.Message, 0);
229 24a3178d djkim
            }
230
231
232 787a4489 KangIngu
        }
233
234
        private void ChangeSize(double width, double height)
235
        {
236
            this.Width = width;
237
            this.Height = height;
238
        }
239
240
        private void SyncInit()
241
        {
242 24a3178d djkim
            try
243 787a4489 KangIngu
            {
244 24a3178d djkim
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
245
                {
246
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
247
                    ViewerDataModel.Instance.PageBalanceMode = false;
248
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
249 752b18ef taeseongkim
                    ViewerDataModel.Instance.SyncPageNumber = 0;
250 24a3178d djkim
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
251
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
252
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
253
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
254
                }
255 787a4489 KangIngu
            }
256 90e7968d ljiyeon
            catch(Exception ex)
257 24a3178d djkim
            {
258 664ea2e1 taeseongkim
                //Logger.sendResLog("SyncInit", ex.Message, 0);
259 24a3178d djkim
            }
260 90e7968d ljiyeon
            
261 787a4489 KangIngu
        }
262
263
        private void DialogMessage_Alert(string Msg)
264
        {
265 24a3178d djkim
            try
266
            {
267
                RadWindow CheckPop = new RadWindow();
268
                Alert check = new Alert(Msg);
269 787a4489 KangIngu
270 24a3178d djkim
                CheckPop = new RadWindow
271
                {
272
                    MinWidth = 400,
273
                    MinHeight = 100,
274
                    //Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
275
                    Header = "Alert",
276
                    Content = check,
277
                    ResizeMode = System.Windows.ResizeMode.NoResize,
278
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
279
                    IsTopmost = true,
280
                };
281
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
282
                CheckPop.ShowDialog();
283
            }
284
            catch (Exception ex)
285 787a4489 KangIngu
            {
286 664ea2e1 taeseongkim
                //Logger.sendResLog("DialogMessage_Alert", ex.Message, 0);
287 24a3178d djkim
            }
288
289 787a4489 KangIngu
        }
290
291
        private void History_Set()
292
        {
293 24a3178d djkim
            try
294 787a4489 KangIngu
            {
295 24a3178d djkim
                if (col1.Width != new GridLength(1200))
296
                {
297
                    Col_Remark.IsVisible = true;
298
                    Col_Reply.IsVisible = true;
299
                    Col_Vendor.IsVisible = true;
300 787a4489 KangIngu
301 24a3178d djkim
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
302
                        REV_1.IsVisible = true;
303 787a4489 KangIngu
304 24a3178d djkim
                    #region history
305
                    REV_0.IsVisible = true;
306
                    if (Lists.Where(info => info.REV_1 != null).FirstOrDefault() != null)
307 787a4489 KangIngu
                    { REV_1.IsVisible = true; REV_0.Width = 70; }
308 24a3178d djkim
                    else
309
                    { REV_0.Width = 140; }
310
                    if (Lists.Where(info => info.REV_2 != null).FirstOrDefault() != null)
311
                        REV_2.IsVisible = true; REV_2.IsVisible = true;
312
                    if (Lists.Where(info => info.REV_3 != null).FirstOrDefault() != null)
313
                        REV_3.IsVisible = true;
314
                    if (Lists.Where(info => info.REV_4 != null).FirstOrDefault() != null)
315
                        REV_4.IsVisible = true;
316
                    if (Lists.Where(info => info.REV_5 != null).FirstOrDefault() != null)
317
                        REV_5.IsVisible = true;
318
                    if (Lists.Where(info => info.REV_6 != null).FirstOrDefault() != null)
319
                        REV_6.IsVisible = true;
320
                    if (Lists.Where(info => info.REV_7 != null).FirstOrDefault() != null)
321
                        REV_7.IsVisible = true;
322
                    if (Lists.Where(info => info.REV_8 != null).FirstOrDefault() != null)
323
                        REV_8.IsVisible = true;
324
                    if (Lists.Where(info => info.REV_9 != null).FirstOrDefault() != null)
325
                        REV_9.IsVisible = true;
326
                    if (Lists.Where(info => info.REV_10 != null).FirstOrDefault() != null)
327
                        REV_10.IsVisible = true;
328
                    if (Lists.Where(info => info.REV_11 != null).FirstOrDefault() != null)
329
                        REV_11.IsVisible = true;
330
                    if (Lists.Where(info => info.REV_12 != null).FirstOrDefault() != null)
331
                        REV_12.IsVisible = true;
332
                    if (Lists.Where(info => info.REV_13 != null).FirstOrDefault() != null)
333
                        REV_13.IsVisible = true;
334
                    if (Lists.Where(info => info.REV_14 != null).FirstOrDefault() != null)
335
                        REV_14.IsVisible = true;
336
                    if (Lists.Where(info => info.REV_15 != null).FirstOrDefault() != null)
337
                        REV_15.IsVisible = true;
338
                    if (Lists.Where(info => info.REV_16 != null).FirstOrDefault() != null)
339
                        REV_16.IsVisible = true;
340
                    if (Lists.Where(info => info.REV_17 != null).FirstOrDefault() != null)
341
                        REV_17.IsVisible = true;
342
                    if (Lists.Where(info => info.REV_18 != null).FirstOrDefault() != null)
343
                        REV_18.IsVisible = true;
344
                    if (Lists.Where(info => info.REV_19 != null).FirstOrDefault() != null)
345
                        REV_19.IsVisible = true;
346
                    #endregion
347
348
                }
349 787a4489 KangIngu
                else
350 24a3178d djkim
                {
351
                    Col_Remark.IsVisible = false;
352
                    Col_Reply.IsVisible = false;
353
                    Col_Vendor.IsVisible = false;
354 787a4489 KangIngu
355 24a3178d djkim
                    #region history
356
                    REV_0.IsVisible = false;
357
                    REV_1.IsVisible = false;
358
                    REV_2.IsVisible = false;
359
                    REV_3.IsVisible = false;
360
                    REV_4.IsVisible = false;
361
                    REV_5.IsVisible = false;
362
                    REV_6.IsVisible = false;
363
                    REV_7.IsVisible = false;
364
                    REV_8.IsVisible = false;
365
                    REV_9.IsVisible = false;
366
                    REV_10.IsVisible = false;
367
                    REV_11.IsVisible = false;
368
                    REV_12.IsVisible = false;
369
                    REV_13.IsVisible = false;
370
                    REV_14.IsVisible = false;
371
                    REV_15.IsVisible = false;
372
                    REV_16.IsVisible = false;
373
                    REV_17.IsVisible = false;
374
                    REV_18.IsVisible = false;
375
                    REV_19.IsVisible = false;
376
                    #endregion
377
                }
378 787a4489 KangIngu
            }
379 24a3178d djkim
            catch (Exception ex)
380 787a4489 KangIngu
            {
381 664ea2e1 taeseongkim
                //Logger.sendResLog("History_Set", ex.Message, 0);
382 787a4489 KangIngu
            }
383 24a3178d djkim
384 787a4489 KangIngu
        }
385
386
        #region Excel Export
387
388 aa73d664 이지연
        [Obsolete]
389 787a4489 KangIngu
        private void ExportEvent(object sender, RoutedEventArgs e)
390
        {
391 24a3178d djkim
            try
392 787a4489 KangIngu
            {
393 77922798 송근호
                if (mainWindow.dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
394 24a3178d djkim
                {
395
                    DialogMessage_Alert("Capture중 입니다.");
396
                    return;
397
                }
398
                this.ExportIndy.IsBusy = true;
399 787a4489 KangIngu
400 24a3178d djkim
                if (Lists.Count == 0)
401 787a4489 KangIngu
                {
402 24a3178d djkim
                    DialogMessage_Alert("Data Not Found");
403
                    this.ExportIndy.IsBusy = false;
404
                    return;
405
                }
406 787a4489 KangIngu
407 24a3178d djkim
                string extension = "xlsx";
408 84c48033 djkim
                string excelpath = CommonLib.Common.GetConfigString("excelFilePath", "URL", "", App.isExternal);
409 b7637656 djkim
                Uri url = new Uri(excelpath);
410 787a4489 KangIngu
411 24a3178d djkim
                System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog()
412
                {
413
                    DefaultExt = extension,
414
                    Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
415
                    FilterIndex = 1
416
                };
417 787a4489 KangIngu
418 24a3178d djkim
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
419
                {
420
                    using (var client = new System.Net.WebClient())
421
                    {
422
                        client.DownloadFile(url, dialog.FileName);
423 aa73d664 이지연
                        SpreadsheetInfo.SetLicense(Properties.Settings.Default.GemBoxLicense);// "EXK0-W4HZ-N518-IMEW");                    
424
                        ExcelFile workbook = null;
425
                        ExcelWorksheet worksheet = null;
426 24a3178d djkim
                        try
427 787a4489 KangIngu
                        {
428 aa73d664 이지연
                            // Excel 첫번째 워크시트 가져오기             
429
                            workbook = ExcelFile.Load(dialog.FileName);
430
                            worksheet = workbook.Worksheets[0];
431 24a3178d djkim
432
                            // 데이타 넣기
433 aa73d664 이지연
                            int h = 8;
434
                            int w = 1;
435 24a3178d djkim
                            string project_no = App.ViewInfo.ProjectNO;
436 aa73d664 이지연
                            worksheet.Cells[1, w + 8].Value = project_no;
437 24a3178d djkim
438
                            string project_name = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetProjectName(project_no);
439
                            if (project_name != null || project_name != "")
440
                            {
441 664ea2e1 taeseongkim
                                //Logger.sendResLog("GetProjectName", "TRUE", 1);
442 24a3178d djkim
                            }
443
                            else
444
                            {
445 664ea2e1 taeseongkim
                                //Logger.sendResLog("GetProjectName", "FALSE", 1);
446 24a3178d djkim
                            }
447 aa73d664 이지연
                            worksheet.Cells[2, w + 8].Value = project_name;
448
                            worksheet.Cells[3, w + 8].Value = (mainWindow as MainWindow).dzMainMenu._DocItem.DOCUMENT_NO;
449
                            worksheet.Cells[4, w + 8].Value = (mainWindow as MainWindow).dzMainMenu.userData.NAME + " (" + App.ViewInfo.UserID + ")";
450
                            worksheet.Cells[5, w + 8].Value = DateTime.Now.ToString("yyyy.MM.dd");
451 787a4489 KangIngu
452 aa73d664 이지연
                            ExcelCell Range_I = worksheet.Cells["K9"];                           
453 787a4489 KangIngu
454 24a3178d djkim
                            var Rev = Lists.Select(info => info.REVISION).Distinct();
455
                            string[] Cell = { "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T" };
456
                            string[] Range = { "L9", "M9", "N9", "O9", "P9", "Q9", "R9", "S9", "T9", "U9", "V9", "W9", "X9", "Y9", "Z9", "AA9", "AB9", "AC9", "AD9" };
457
                            string Ran = "K";
458 787a4489 KangIngu
459 aa73d664 이지연
                            worksheet.Cells.GetSubrangeAbsolute(8, 11, 8, 11 + rev_cnt - 1).Merged = true;                       
460 787a4489 KangIngu
461 24a3178d djkim
                            if (rev_cnt != 1)
462 787a4489 KangIngu
                            {
463 24a3178d djkim
                                Ran = Range[rev_cnt - 2].Substring(0, Range[rev_cnt - 2].Length - 1);
464
                            }
465 aa73d664 이지연
                            CellRange iRange = worksheet.Cells.GetSubrange("B10:" + Ran + "10");
466
                            
467 24a3178d djkim
                            //필터 기능 추가
468 aa73d664 이지연
                            CellRange Filter_Range = worksheet.Cells.GetSubrange("B9:" + Ran + "9");
469
                            Filter_Range.Filter(true);
470
                            ExcelCell Range_b = worksheet.Cells["B10"];
471 24a3178d djkim
                            Lists.ForEach(data =>
472
                            {
473
                                h++;
474 aa73d664 이지연
                                // Get the range.
475
                                CellRange oRange = worksheet.Cells.GetSubrange("B" + (h + 1) + ":" + Ran + (h + 1));
476
                                foreach (var cell in oRange)
477
                                {
478
                                    cell.Style.Borders.SetBorders(MultipleBorders.Outside, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin);
479
                                }
480 787a4489 KangIngu
481 24a3178d djkim
                                if (data.IMAGE_PATH != null)
482 787a4489 KangIngu
                                {
483 aa73d664 이지연
                                    ExcelCell ImageRange = worksheet.Cells[h, w + 2];        
484
                                    ImageRange.Row.Height = Range_b.Row.Height;
485
                                    //ImageRange.Style.Font.Size = 10;
486 24a3178d djkim
                                    System.Drawing.Image I_Image = byteArrayToImage(data.IMAGE_PATH);
487
                                    System.Drawing.Image o_Image = Resize(I_Image, 80, 80);
488
                                    System.Windows.Forms.Clipboard.SetDataObject(o_Image, true);
489 aa73d664 이지연
                                    ImageRange.Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;
490
                                    ImageRange.Style.VerticalAlignment = VerticalAlignmentStyle.Top;                                      
491
                                    byte[] imageData = data.IMAGE_PATH;
492
                                    MemoryStream memoryStream = new MemoryStream();
493
                                    o_Image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);                                    
494
                                    int column = 2; // 이미지를 삽입할 열
495
                                    int row = h;    // 이미지를 삽입할 행
496
                                    // 이미지를 워크시트에 추가
497
                                    ExcelPicture picture = worksheet.Pictures.Add(memoryStream, PositioningMode.FreeFloating, new AnchorCell(ImageRange.Column, ImageRange.Row, 0, 0), ExcelPictureFormat.Jpeg);
498
499
                                    //foreach (Microsoft.Office.Interop.Excel.Shape shp in worksheet.Shapes)
500
                                    //{
501
                                    //    if (shp.TopLeftCell.Address != ImageRange.Address)
502
                                    //        continue;
503
504
                                    //    double Left = shp.TopLeftCell.Left + (shp.TopLeftCell.Width - shp.Width) / 2;
505
                                    //    double Top = shp.TopLeftCell.Top + (shp.TopLeftCell.Height - shp.Height) / 2;
506
507
                                    //    shp.Left = float.Parse(Left.ToString());
508
                                    //    shp.Top = float.Parse(Top.ToString());
509
510
                                    //    break;
511
                                    //}
512 787a4489 KangIngu
                                }
513
514 24a3178d djkim
                                #region Excel Bind
515 aa73d664 이지연
                                worksheet.Cells[h, w].Value = data.REVISION;
516
                                worksheet.Cells[h, w + 1].Value = data.PAGENUMBER;
517
                                worksheet.Cells[h, w + 3].Value = data.TODOLIST;
518
                                worksheet.Cells[h, w + 4].Value = data.STATUS.ToUpper() == "TRUE" ? "closed" : "open";
519
                                worksheet.Cells[h, w + 5].Value = data.STATUS_DESC;
520
                                worksheet.Cells[h, w + 6].Value = data.VENDOR;
521
                                worksheet.Cells[h, w + 7].Value = data.REMARK;
522
                                worksheet.Cells[h, w + 8].Value = data.REPLY;
523
                                worksheet.Cells[h, w + 9].Value = data.REV_0 == null ? "" : data.REV_0.Replace("", " / ");
524
                                worksheet.Cells[h, w + 10].Value = data.REV_1 == null ? "" : data.REV_1.Replace("", " / ");
525
                                worksheet.Cells[h, w + 11].Value = data.REV_2 == null ? "" : data.REV_2.Replace("", " / ");
526
                                worksheet.Cells[h, w + 12].Value = data.REV_3 == null ? "" : data.REV_3.Replace("", " / ");
527
                                worksheet.Cells[h, w + 13].Value = data.REV_4 == null ? "" : data.REV_4.Replace("", " / ");
528
                                worksheet.Cells[h, w + 14].Value = data.REV_5 == null ? "" : data.REV_5.Replace("", " / ");
529
                                worksheet.Cells[h, w + 15].Value = data.REV_6 == null ? "" : data.REV_6.Replace("", " / ");
530
                                worksheet.Cells[h, w + 16].Value = data.REV_7 == null ? "" : data.REV_7.Replace("", " / ");
531
                                worksheet.Cells[h, w + 17].Value = data.REV_8 == null ? "" : data.REV_8.Replace("", " / ");
532
                                worksheet.Cells[h, w + 18].Value = data.REV_9 == null ? "" : data.REV_9.Replace("", " / ");
533
                                worksheet.Cells[h, w + 19].Value = data.REV_10 == null ? "" : data.REV_10.Replace("", " / ");
534
                                worksheet.Cells[h, w + 20].Value = data.REV_11 == null ? "" : data.REV_11.Replace("", " / ");
535
                                worksheet.Cells[h, w + 21].Value = data.REV_12 == null ? "" : data.REV_12.Replace("", " / ");
536
                                worksheet.Cells[h, w + 22].Value = data.REV_13 == null ? "" : data.REV_13.Replace("", " / ");
537
                                worksheet.Cells[h, w + 23].Value = data.REV_14 == null ? "" : data.REV_14.Replace("", " / ");
538
                                worksheet.Cells[h, w + 24].Value = data.REV_15 == null ? "" : data.REV_15.Replace("", " / ");
539
                                worksheet.Cells[h, w + 25].Value = data.REV_16 == null ? "" : data.REV_16.Replace("", " / ");
540
                                worksheet.Cells[h, w + 26].Value = data.REV_17 == null ? "" : data.REV_17.Replace("", " / ");
541
                                worksheet.Cells[h, w + 27].Value = data.REV_18 == null ? "" : data.REV_18.Replace("", " / ");
542
                                worksheet.Cells[h, w + 28].Value = data.REV_19 == null ? "" : data.REV_19.Replace("", " / ");
543 24a3178d djkim
                                #endregion
544
                            });
545 aa73d664 이지연
                                                     
546
                            for (int columnIndex = 1; columnIndex < 11; ++columnIndex)
547
                            {    
548
                                worksheet.Columns[columnIndex].AutoFit();
549
                            }
550 24a3178d djkim
551 aa73d664 이지연
                            worksheet.Columns["G"].Width = Convert.ToInt32(worksheet.Columns["G"].Width * 1.1);
552 24a3178d djkim
                            // 엑셀파일 저장
553 aa73d664 이지연
                            workbook.Save(dialog.FileName);
554
                           
555 787a4489 KangIngu
                        }
556 24a3178d djkim
                        finally
557 aa73d664 이지연
                        {                        
558 24a3178d djkim
                            // Clean up
559
                            ReleaseExcelObject(worksheet);
560
                            ReleaseExcelObject(workbook);
561
                        }
562 787a4489 KangIngu
                    }
563 24a3178d djkim
                    DialogMessage_Alert("Success");
564 787a4489 KangIngu
                }
565 24a3178d djkim
566
                this.ExportIndy.IsBusy = false;
567
            }
568
            catch (Exception ex)
569
            {
570 664ea2e1 taeseongkim
                //Logger.sendResLog("CheckList ExportEvent", ex.Message, 0);
571 787a4489 KangIngu
            }
572
573
        }
574
575 aa73d664 이지연
        private static void SetWidth(ExcelColumn column, double width)
576
        {
577
            column.SetWidth(
578
                Math.Truncate((width * 7 + 5) / 7 * 256) / 256,
579
                LengthUnit.ZeroCharacterWidth);
580
        }
581
582
583 787a4489 KangIngu
        public System.Drawing.Image byteArrayToImage(byte[] byteArrayIn)
584
        {
585
            using (var ms = new System.IO.MemoryStream(byteArrayIn))
586
            {
587
                return System.Drawing.Image.FromStream(ms);
588
            }
589
        }
590
591
        public System.Drawing.Image Resize(System.Drawing.Image image, int newWidth, int maxHeight)
592
        {
593
            //if (onlyResizeIfWider && image.Width <= newWidth) newWidth = image.Width;
594
595 24a3178d djkim
            try
596 787a4489 KangIngu
            {
597 24a3178d djkim
                var newHeight = image.Height * newWidth / image.Width;
598
                if (newHeight > maxHeight)
599
                {
600
                    // Resize with height instead  
601
                    newWidth = image.Width * maxHeight / image.Height;
602
                    newHeight = maxHeight;
603
                }
604 787a4489 KangIngu
605 24a3178d djkim
                var res = new System.Drawing.Bitmap(newWidth, newHeight);
606 787a4489 KangIngu
607 24a3178d djkim
                using (var graphic = System.Drawing.Graphics.FromImage(res))
608
                {
609
                    graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
610
                    graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
611
                    graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
612
                    graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
613
                    graphic.DrawImage(image, 0, 0, newWidth, newHeight);
614
                }
615
                return res;
616
            }
617
            catch (Exception ex)
618 787a4489 KangIngu
            {
619 664ea2e1 taeseongkim
                //Logger.sendResLog("Resize", ex.Message, 0);
620 24a3178d djkim
                return null;
621 787a4489 KangIngu
            }
622 90e7968d ljiyeon
            
623 787a4489 KangIngu
624 90e7968d ljiyeon
            
625 787a4489 KangIngu
        }
626
627
        private static void ReleaseExcelObject(object obj)
628
        {
629
            try
630
            {
631
                if (obj != null)
632
                {
633
                    obj = null;
634
                }
635
            }
636
            catch (Exception ex)
637
            {
638
                obj = null;
639
                throw ex;
640
            }
641
            finally
642
            {
643
                GC.Collect();
644
            }
645
        }
646
647
        #endregion
648
649
        #region 이벤트
650
651
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
652
        {
653
            ChangeSize(e.NewSize.Width, e.NewSize.Height);
654
        }
655
656
        private void CheckList_Loaded(object sender, RoutedEventArgs e)
657
        {
658 24a3178d djkim
            DataBind();
659
            this.tb.ItemsSource = null;
660
            this.tb.ItemsSource = Lists;
661
            History_Set();
662 787a4489 KangIngu
        }
663 90e7968d ljiyeon
        
664 787a4489 KangIngu
        private void RadGridView_Loaded(object sender, RoutedEventArgs e)
665
        {
666
            DataBind();
667
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = null;
668
            (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = Lists;
669
670
            ChangeSize(this.ActualWidth, this.ActualHeight);
671
            this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
672
        }
673
674
        private void AddEvent(object sender, RoutedEventArgs e)
675
        {
676 24a3178d djkim
            try
677
            {
678 77922798 송근호
                mainWindow.Focus();
679 24a3178d djkim
680 24678e06 humkyung
                Common.ViewerDataModel.Instance.CheckList_ID = Commons.shortGuid();
681 24a3178d djkim
                Common.ViewerDataModel.Instance.Capture_Opacity = 0.5;
682 77922798 송근호
                (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
683 24a3178d djkim
            }
684 90e7968d ljiyeon
            catch(Exception ex)
685 24a3178d djkim
            {
686 664ea2e1 taeseongkim
                //Logger.sendResLog("Checklist Addevent", ex.Message, 0);
687 24a3178d djkim
            }
688 90e7968d ljiyeon
            
689 787a4489 KangIngu
        }
690
691
        private void SaveEvent(object sender, RoutedEventArgs e)
692
        {
693 24a3178d djkim
            try
694 787a4489 KangIngu
            {
695 77922798 송근호
                if ((mainWindow as MainWindow).dzMainMenu.mouseHandlingMode == MouseHandlingMode.Capture)
696 0f065e57 ljiyeon
                {
697 24a3178d djkim
                    DialogMessage_Alert("Capture중 입니다.");
698
                    return;
699 0f065e57 ljiyeon
                }
700 24a3178d djkim
                CHECK_LIST Check_value = new CHECK_LIST();
701
                CHECK_LIST_HISTORY Check_History = new CHECK_LIST_HISTORY();
702 0f065e57 ljiyeon
703 24a3178d djkim
                foreach (var item in tb.Items)
704 787a4489 KangIngu
                {
705 24a3178d djkim
                    string Check_ID = (item as Customer).ID.ToString();
706
                    string state = "";
707
708 664ea2e1 taeseongkim
                    //Logger.sendReqLog("GetCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
709 24a3178d djkim
                    Check_value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckList(App.ViewInfo.ProjectNO, Check_ID);
710
                    if (Check_value != null)
711 6c781c0c djkim
                    {
712 664ea2e1 taeseongkim
                        //Logger.sendResLog("GetCheckList", "TRUE", 1);
713 24a3178d djkim
                    }
714 6c781c0c djkim
                    else
715
                    {
716 664ea2e1 taeseongkim
                        //Logger.sendResLog("GetCheckList", "FALSE", 1);
717 6c781c0c djkim
                    }
718 787a4489 KangIngu
719 24a3178d djkim
                    if (Check_value != null)
720 787a4489 KangIngu
                    {
721 24a3178d djkim
                        if ((item as Customer).STATUS.ToUpper() == "TRUE")
722 0f065e57 ljiyeon
                        {
723 24a3178d djkim
                            state = "Closed";
724
                            Check_value.STATUS_DESC_CLOSE = (item as Customer).STATUS_DESC;
725 0f065e57 ljiyeon
                        }
726
                        else
727
                        {
728 24a3178d djkim
                            state = "Open";
729
                            Check_value.STATUS_DESC_OPEN = (item as Customer).STATUS_DESC;
730 0f065e57 ljiyeon
                        }
731 787a4489 KangIngu
732 24a3178d djkim
                        string Rev = state + "" + DateTime.Now.ToString("yyyy.MM.dd");
733
                        string description = "";
734 787a4489 KangIngu
735 24a3178d djkim
                        if (char.Parse(ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision) >= char.Parse(Check_value.REVISION))
736 6c781c0c djkim
                        {
737 24a3178d djkim
                            Check_value.REMARK = (item as Customer).REMARK;
738
                            Check_value.STATUS = (item as Customer).STATUS;
739
                            Check_value.TODOLIST = (item as Customer).TODOLIST;
740
                            Check_value.VENDOR = (item as Customer).VENDOR;
741
                            Check_value.REPLY = (item as Customer).REPLY;
742
743
                            if ((item as Customer).STATUS == "False")
744
                                description = Check_value.STATUS_DESC_OPEN;
745
                            else
746
                                description = Check_value.STATUS_DESC_CLOSE;
747 787a4489 KangIngu
748 664ea2e1 taeseongkim
                            //Logger.sendReqLog("GetCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_ID, 1);
749 24a3178d djkim
                            var history = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetCheckListHistory(App.ViewInfo.ProjectNO, Check_ID);
750
                            if (history.Count() > 0)
751 787a4489 KangIngu
                            {
752 664ea2e1 taeseongkim
                                //Logger.sendResLog("GetCheckList", "TRUE", 1);
753 787a4489 KangIngu
                            }
754 6c781c0c djkim
                            else
755 787a4489 KangIngu
                            {
756 664ea2e1 taeseongkim
                                //Logger.sendResLog("GetCheckList", "FALSE", 1);
757 24a3178d djkim
                            }
758
                            Check_History = history.Where(info => info.REVISION == ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision).FirstOrDefault();
759
760
                            List<string> validation = new List<string>();
761
762
                            foreach (var his in history)
763
                            {
764
                                if (his.TODOLIST == Check_value.TODOLIST)
765
                                    validation.Add("TODOLIST");
766
                                if (his.STATUS_DESC == description)
767
                                    validation.Add("STATUS_DESC");
768
                                if (his.VENDOR == Check_value.VENDOR)
769
                                    validation.Add("VENDOR");
770
                                if (his.REMARK == Check_value.REMARK)
771
                                    validation.Add("REMARK");
772
                                if (his.REPLY == Check_value.REPLY)
773
                                    validation.Add("REPLY");
774
                            }
775
776
                            if (validation.Count < 5)
777
                            {
778
                                if (Check_History == null)
779 5de0c110 ljiyeon
                                {
780 24a3178d djkim
                                    Check_History = new CHECK_LIST_HISTORY()
781
                                    {
782 24678e06 humkyung
                                        ID = Commons.shortGuid(),
783 24a3178d djkim
                                        CHECKLIST_ID = Check_ID,
784
                                        REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
785
                                        STATUS = state,
786
                                        IMAGE_URL = Check_value.IMAGE_URL,
787
                                        STATUS_DESC = validation.Where(i => i.ToString() == "STATUS_DESC").FirstOrDefault() == null ? description : "",
788
                                        TODOLIST = validation.Where(i => i.ToString() == "TODOLIST").FirstOrDefault() == null ? Check_value.TODOLIST : "",
789
                                        VENDOR = validation.Where(i => i.ToString() == "VENDOR").FirstOrDefault() == null ? Check_value.VENDOR : "",
790
                                        REMARK = validation.Where(i => i.ToString() == "REMARK").FirstOrDefault() == null ? Check_value.REMARK : "",
791
                                        REPLY = validation.Where(i => i.ToString() == "REPLY").FirstOrDefault() == null ? Check_value.REPLY : "",
792
                                        CREATE_TIME = DateTime.Now,
793
                                        UPDATE_TIME = DateTime.Now
794
                                    };
795
796 274cde11 taeseongkim
                                    var result = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History).ToString();
797
798
                                    Logger.sendReqLog("AddCheckListHistory: ", App.ViewInfo.ProjectNO + "," + Check_History, 1);
799
                                    Logger.sendResLog("AddCheckListHistory", result, 1);
800
801
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddCheckListHistory(App.ViewInfo.ProjectNO, Check_History);
802 24a3178d djkim
803
                                    Check_value.REVISION = Current_Revision;
804 5de0c110 ljiyeon
                                }
805
                                else
806
                                {
807 24a3178d djkim
                                    Check_History.IMAGE_URL = Check_value.IMAGE_URL;
808
                                    Check_History.STATUS = state;
809
                                    Check_History.TODOLIST = Check_value.TODOLIST;
810
                                    Check_History.VENDOR = Check_value.VENDOR;
811
                                    Check_History.REMARK = Check_value.REMARK;
812
                                    Check_History.REPLY = Check_value.REPLY;
813
                                    Check_History.UPDATE_TIME = DateTime.Now;
814
                                    if (state == "Open")
815
                                    {
816
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_OPEN;
817
                                    }
818
                                    else
819
                                    {
820
                                        Check_History.STATUS_DESC = Check_value.STATUS_DESC_CLOSE;
821
                                    }
822
823 274cde11 taeseongkim
                                    Logger.sendReqLog("SaveCheckListHistory: ", App.ViewInfo.ProjectNO + "," + ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision + "," + Check_History, 1);
824 664ea2e1 taeseongkim
                                    //Logger.sendResLog("SaveCheckListHistory", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History).ToString(), 1);
825 24a3178d djkim
826 274cde11 taeseongkim
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckListHistory(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, Check_History);
827 5de0c110 ljiyeon
                                }
828 787a4489 KangIngu
                            }
829 24a3178d djkim
                            validation = new List<string>();
830 787a4489 KangIngu
                        }
831
                    }
832 24a3178d djkim
833 274cde11 taeseongkim
                    Logger.sendReqLog("SaveCheckList: ", App.ViewInfo.ProjectNO + "," + Check_ID + "," + Check_value, 1);
834 664ea2e1 taeseongkim
                    //Logger.sendResLog("SaveCheckList", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value).ToString(), 1);
835 274cde11 taeseongkim
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveCheckList(App.ViewInfo.ProjectNO, Check_ID, Check_value);
836 787a4489 KangIngu
                }
837 0f065e57 ljiyeon
838 24a3178d djkim
                DataBind();
839
                tb.ItemsSource = null;
840
                tb.ItemsSource = Lists;
841
                History_Set();
842
843
                DialogMessage_Alert("Success");
844
            }
845
            catch (Exception ex)
846
            {
847 664ea2e1 taeseongkim
                //Logger.sendResLog("Checklist SaveEvent", ex.Message, 0);
848 787a4489 KangIngu
            }
849 90e7968d ljiyeon
                       
850 787a4489 KangIngu
        }
851
852
        private void CheckListEvent(object sender, RoutedEventArgs e)
853
        {
854
            if (col1.Width == new GridLength(1200))
855
            {
856
                this.Width += 600;
857
                col1.Width = new GridLength(1800);
858
            }
859
            else
860
            {
861
                this.Width -= 600;
862
                col1.Width = new GridLength(1200);
863
            }
864
            History_Set();
865
        }
866
867
        private void CommentMoveEvent(object sender, MouseButtonEventArgs e)
868
        {
869
            SyncInit();
870
871
            Rect rect = new Rect();
872
            string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
873
            //string[] RectPoint = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).IMAGE_ANCHOR.Split(',');
874
875
            rect = new Rect(new Point(double.Parse(RectPoint[0]), double.Parse(RectPoint[1])), new Point(double.Parse(RectPoint[0]) + double.Parse(RectPoint[2]), double.Parse(RectPoint[1]) + double.Parse(RectPoint[3])));
876
877
            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).PAGENUMBER);
878
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
879
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
880 77922798 송근호
            mainWindow.Focus();
881 787a4489 KangIngu
        }
882
883
        private void CaptureEvent(object sender, MouseButtonEventArgs e)
884
        {
885
            SyncInit();
886
887
            //캡쳐 하기 전에 코멘트 저장
888 77922798 송근호
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (mainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
889 787a4489 KangIngu
            {
890 77922798 송근호
                var menu = (mainWindow as MainWindow).dzMainMenu;
891 077896be humkyung
                SelectionSet.Instance.UnSelect(menu);
892 787a4489 KangIngu
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
893
                {
894 77922798 송근호
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
895 787a4489 KangIngu
                }
896
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
897
                {
898
899
                }
900
                else
901
                {
902 77922798 송근호
                    (mainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
903 787a4489 KangIngu
                }
904
            }
905
906
            //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
907
            Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
908 24a3178d djkim
            //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
909 77922798 송근호
            mainWindow.Focus();
910 787a4489 KangIngu
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
911 77922798 송근호
            (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
912 787a4489 KangIngu
        }
913
914
        public void KeyEventDownAction(object sender, KeyEventArgs e)
915
        {
916
            switch (e.Key)
917
            {
918
                case Key.Escape:
919
                    {
920 77922798 송근호
                        (mainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
921 787a4489 KangIngu
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0;
922
                    }
923
                    break;
924
            }
925
        }
926
927
        private void tb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
928
        {
929 24a3178d djkim
            try
930 787a4489 KangIngu
            {
931 24a3178d djkim
                if (ViewerDataModel.Instance.Capture_Opacity == 0)
932
                    return;
933
934
                DataBind();
935
                tb.ItemsSource = null;
936
                tb.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
937
                //tb1.ItemsSource = Lists.OrderBy(info => info.CREATE_TIME);
938 787a4489 KangIngu
939 24a3178d djkim
                if (ViewerDataModel.Instance.Capture_Opacity == 0.5)
940 787a4489 KangIngu
                {
941 24a3178d djkim
                    tb.SortDescriptors.Clear();
942
                    tb.FilterDescriptors.Clear();
943 787a4489 KangIngu
944 24a3178d djkim
                    var scrollViewer = this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
945
                    if (scrollViewer != null)
946
                    {
947
                        //this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
948
                        //this.tb1.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ScrollToVerticalOffset(this.tb.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault().ExtentHeight);
949 787a4489 KangIngu
950 24a3178d djkim
                        tb.ScrollIndexIntoView(tb.Items.Count - 1);
951
                        tb.CurrentCellInfo = new GridViewCellInfo(tb.Items[tb.Items.Count - 1], tb.Columns["TODOLIST"]);
952
                        tb.Focus();
953
954
                    }
955 787a4489 KangIngu
                }
956
            }
957 90e7968d ljiyeon
            catch(Exception ex)
958 24a3178d djkim
            {
959 664ea2e1 taeseongkim
                //Logger.sendResLog("tb_IsVisibleChanged", ex.Message, 0);
960 24a3178d djkim
            }
961 90e7968d ljiyeon
            
962 787a4489 KangIngu
        }
963
964
        private void Radio_Open_Checked(object sender, RoutedEventArgs e)
965
        {
966 24a3178d djkim
            try
967 787a4489 KangIngu
            {
968 24a3178d djkim
                (e.Source as RadioButton).Foreground = Brushes.Red;
969
                (e.Source as RadioButton).FontWeight = FontWeights.Bold;
970 787a4489 KangIngu
971 24a3178d djkim
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
972 787a4489 KangIngu
                {
973 24a3178d djkim
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Open";
974
                }
975
976
                if (Isinit)
977
                {
978
                    Isinit = false;
979
                    if ((e.Source as RadioButton).DataContext != null)
980 787a4489 KangIngu
                    {
981 24a3178d djkim
                        if (((e.Source as RadioButton).DataContext as Customer).STATUS_DESC != "Vendor 반영 필요")
982
                        {
983
                            ((e.Source as RadioButton).DataContext as Customer).STATUS_DESC = "Vendor 반영 필요";
984 787a4489 KangIngu
985 24a3178d djkim
                            tb.Rebind();
986
                        }
987 787a4489 KangIngu
                    }
988
                }
989
            }
990 90e7968d ljiyeon
            catch(Exception ex)
991 24a3178d djkim
            {
992 664ea2e1 taeseongkim
                //Logger.sendResLog("Radio_Open_Checked", ex.Message, 0);
993 24a3178d djkim
            }
994 90e7968d ljiyeon
            
995 787a4489 KangIngu
        }
996
997
        private void Radio_Close_Checked(object sender, RoutedEventArgs e)
998
        {
999 24a3178d djkim
            try
1000 69ef0800 KangIngu
            {
1001 24a3178d djkim
                if (Isinit)
1002 69ef0800 KangIngu
                {
1003 24a3178d djkim
                    if (!isCheck_Status)
1004
                    {
1005
                        Select_StatusID = ((e.Source as RadioButton).DataContext as Customer).ID;
1006 69ef0800 KangIngu
1007 24a3178d djkim
                        isCheck_Status = true;
1008 69ef0800 KangIngu
1009 24a3178d djkim
                        RadWindow CheckPop = new RadWindow();
1010 69ef0800 KangIngu
1011 24a3178d djkim
                        CheckList_Status check = new CheckList_Status();
1012 69ef0800 KangIngu
1013 24a3178d djkim
                        CheckPop = new RadWindow
1014
                        {
1015
                            MinWidth = 350,
1016
                            MinHeight = 150,
1017
                            Header = "Status Description을 입력하세요",
1018
                            Content = check,
1019
                            ResizeMode = System.Windows.ResizeMode.NoResize,
1020
                            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1021
                            IsTopmost = true,
1022
                        };
1023
                        StyleManager.SetTheme(CheckPop, new Office2013Theme());
1024
                        CheckPop.Closed += CheckPop_Closed;
1025
                        CheckPop.Show();
1026
1027
                        Isinit = false;
1028
                        tb.Rebind();
1029
                    }
1030 69ef0800 KangIngu
                }
1031 787a4489 KangIngu
1032
            (e.Source as RadioButton).FontWeight = FontWeights.Bold;
1033
1034 24a3178d djkim
                if ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item != null)
1035
                {
1036
                    ((((e.OriginalSource as RadioButton).Parent as StackPanel).Parent as GridViewCell).ParentRow.Item as Customer)._STATUS = "Close";
1037
                }
1038
            }
1039 90e7968d ljiyeon
            catch(Exception ex)
1040 787a4489 KangIngu
            {
1041 664ea2e1 taeseongkim
                //Logger.sendResLog("Radio_Close_Checked", ex.Message, 0);
1042 787a4489 KangIngu
            }
1043 90e7968d ljiyeon
            
1044 69ef0800 KangIngu
        }
1045 787a4489 KangIngu
1046 69ef0800 KangIngu
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1047
        {
1048 24a3178d djkim
            try
1049 787a4489 KangIngu
            {
1050 24a3178d djkim
                isCheck_Status = false;
1051
1052
                foreach (var item in tb.Items)
1053 787a4489 KangIngu
                {
1054 24a3178d djkim
                    if (Select_StatusID == (item as Customer).ID.ToString())
1055 69ef0800 KangIngu
                    {
1056 24a3178d djkim
                        if (ViewerDataModel.Instance.CheckStatus != "" && ViewerDataModel.Instance.CheckStatus != null)
1057
                        {
1058
                            (item as Customer).STATUS_DESC = ViewerDataModel.Instance.CheckStatus;
1059
                        }
1060
                        else
1061
                        {
1062
                            (item as Customer).STATUS = "False";
1063
                            (item as Customer)._STATUS = "Open";
1064
                            (item as Customer).STATUS_ = "True";
1065
                        }
1066 69ef0800 KangIngu
1067 24a3178d djkim
                        ViewerDataModel.Instance.CheckStatus = "";
1068
                        Select_StatusID = "";
1069
                        tb.Rebind();
1070
                        return;
1071
                    }
1072 787a4489 KangIngu
                }
1073
            }
1074 90e7968d ljiyeon
            catch(Exception ex)
1075 24a3178d djkim
            {
1076 664ea2e1 taeseongkim
                //Logger.sendResLog("CheckPop_Closed", ex.Message, 0);
1077 24a3178d djkim
            }
1078 90e7968d ljiyeon
            
1079 69ef0800 KangIngu
1080 787a4489 KangIngu
        }
1081
1082
        private void Radio_Unchecked(object sender, RoutedEventArgs e)
1083
        {
1084 24a3178d djkim
            try
1085
            {
1086
                (e.Source as RadioButton).Foreground = Brushes.Black;
1087
                (e.Source as RadioButton).FontWeight = FontWeights.Normal;
1088
            }
1089 90e7968d ljiyeon
            catch(Exception ex)
1090 24a3178d djkim
            {
1091 664ea2e1 taeseongkim
                //Logger.sendResLog("Radio_Unchecked", ex.Message, 0);
1092 24a3178d djkim
            }
1093 90e7968d ljiyeon
            
1094 787a4489 KangIngu
        }
1095
1096
        private void mousedownOnImage(object sender, MouseButtonEventArgs args)
1097
        {
1098 24a3178d djkim
            try
1099 787a4489 KangIngu
            {
1100 24a3178d djkim
                if (args.OriginalSource as TextBlock != null && (args.OriginalSource as TextBlock).Parent != null)
1101 787a4489 KangIngu
                {
1102 24a3178d djkim
                    if ((args.OriginalSource as TextBlock).Parent.GetType().Name == "GridViewHeaderCell")
1103
                    {
1104
                        Isinit = false;
1105
                        return;
1106
                    }
1107 787a4489 KangIngu
                }
1108
1109 24a3178d djkim
                Isinit = true;
1110 787a4489 KangIngu
1111 24a3178d djkim
                RadWindow CheckPop = new RadWindow();
1112 787a4489 KangIngu
1113 24a3178d djkim
                if (args.OriginalSource is Image)
1114
                {
1115
                    Image img = (args.OriginalSource as Image);
1116
                    if (img.Height != 45)
1117
                        return;
1118 787a4489 KangIngu
1119 24a3178d djkim
                    CommantImage check = new CommantImage(img);
1120 787a4489 KangIngu
1121 24a3178d djkim
                    CheckPop = new RadWindow
1122
                    {
1123
                        MinWidth = 500,
1124
                        MinHeight = 500,
1125
                        Header = "Image",
1126
                        Content = check,
1127
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1128
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1129
                        IsTopmost = true,
1130
                    };
1131
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1132
                    CheckPop.Show();
1133
                }
1134
1135
                if (args.OriginalSource as TextBlock == null || (args.OriginalSource as TextBlock).Parent == null || ((args.OriginalSource as TextBlock).Parent) as GridViewCell == null)
1136 787a4489 KangIngu
                {
1137 24a3178d djkim
                    return;
1138
                }
1139 787a4489 KangIngu
1140 24a3178d djkim
                if ((((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.ColumnGroupName.ToString() == "History")
1141
                {
1142 787a4489 KangIngu
1143 24a3178d djkim
                    CheckList_Detail Detail = new CheckList_Detail((((args.OriginalSource as TextBlock).Parent as GridViewCell).ParentRow.Item as KCOM.Controls.Customer).ID, (((args.OriginalSource as TextBlock).Parent) as GridViewCell).DataColumn.Header.ToString());
1144 787a4489 KangIngu
1145 24a3178d djkim
                    CheckPop = new RadWindow
1146
                    {
1147
                        MinWidth = 800,
1148
                        MinHeight = 400,
1149
                        Header = "Detail",
1150
                        Content = Detail,
1151
                        //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1152
                        ResizeMode = System.Windows.ResizeMode.NoResize,
1153
                        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1154
                        IsTopmost = true,
1155
                    };
1156
                    StyleManager.SetTheme(CheckPop, new Office2013Theme());
1157
                    //CheckPop.ShowDialog();
1158
                    CheckPop.Show();
1159
                }
1160
            }
1161 90e7968d ljiyeon
            catch(Exception ex)
1162 24a3178d djkim
            {
1163 664ea2e1 taeseongkim
                //Logger.sendResLog("mousedownOnImage", ex.Message, 0);
1164 787a4489 KangIngu
            }
1165 90e7968d ljiyeon
            
1166 24a3178d djkim
1167 787a4489 KangIngu
        }
1168
1169
        private void SyncEvent(object sender, MouseButtonEventArgs e)
1170
        {
1171 24a3178d djkim
            try
1172 0f065e57 ljiyeon
            {
1173 24a3178d djkim
                old_DocID = ((e.Source as Image).DataContext as Customer).DOCUMENT_ID;
1174
                if (old_DocID.Equals(Current_Revision))
1175
                {
1176
                    DialogMessage_Alert("같은 Revision 은 비교할 수 없습니다.");
1177
                    return;
1178
                }
1179 664ea2e1 taeseongkim
                //Logger.sendReqLog("GetVPRevisionFirstOrDefault: ", App.ViewInfo.ProjectNO + "," + old_DocID, 1);
1180 24a3178d djkim
                var _vpList = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVPRevisionFirstOrDefault(App.ViewInfo.ProjectNO, old_DocID);
1181
                if (_vpList != null)
1182
                {
1183 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetVPRevisionFirstOrDefault", "TRUE", 1);
1184 24a3178d djkim
                }
1185
                else
1186
                {
1187 664ea2e1 taeseongkim
                    //Logger.sendResLog("GetVPRevisionFirstOrDefault", "FALSE", 1);
1188 24a3178d djkim
                }
1189
1190 0f065e57 ljiyeon
1191 787a4489 KangIngu
1192 24a3178d djkim
                SyncInit();
1193
                Rect rect = new Rect();
1194
                string[] RectPoint = ((e.Source as Image).DataContext as Customer).IMAGE_ANCHOR.Split(',');
1195
                rect = new Rect(new Point(double.Parse(RectPoint[0]), double.Parse(RectPoint[1])), new Point(double.Parse(RectPoint[0]) + double.Parse(RectPoint[2]), double.Parse(RectPoint[1]) + double.Parse(RectPoint[3])));
1196
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(((e.Source as Image).DataContext as Customer).PAGENUMBER);
1197
                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.Sync_ZoomTo(rect);
1198 77922798 송근호
                (mainWindow as MainWindow).dzMainMenu.Sync_Event(_vpList);
1199 24a3178d djkim
1200
            }
1201
            catch (Exception ex)
1202 787a4489 KangIngu
            {
1203 664ea2e1 taeseongkim
                //Logger.sendResLog("SyncEvent", ex.Message, 0);
1204 787a4489 KangIngu
            }
1205 90e7968d ljiyeon
            
1206 787a4489 KangIngu
        }
1207
1208
        #endregion
1209
    }
1210
}
클립보드 이미지 추가 (최대 크기: 500 MB)