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