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