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