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