markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / DataBaseItemsModel.cs @ 8c128693
이력 | 보기 | 이력해설 | 다운로드 (47.9 KB)
1 | e6281033 | alzkakdixm | using Markus.Message; |
---|---|---|---|
2 | a6e5055d | alzkakdixm | using Markus.Service.DataBase; |
3 | using Markus.Service.Extensions; |
||
4 | e6281033 | alzkakdixm | using Markus.Service.StationController.Data; |
5 | a6e5055d | alzkakdixm | using Markus.Service.StationController.Behaviors; |
6 | using Markus.Service.StationController.Extensions; |
||
7 | b63dcfbb | semi | using Markus.Service.StationController.Controls; |
8 | a6e5055d | alzkakdixm | using Microsoft.Win32; |
9 | using System; |
||
10 | using System.Collections.Generic; |
||
11 | using System.ComponentModel; |
||
12 | using System.Linq; |
||
13 | 2decfbdf | alzkakdixm | using System.Threading.Tasks; |
14 | using System.Web; |
||
15 | a6e5055d | alzkakdixm | using System.Windows; |
16 | using Telerik.Windows.Controls; |
||
17 | using Telerik.Windows.Data; |
||
18 | using ConvertItem = Markus.Service.Interface.ConvertItem; |
||
19 | e6281033 | alzkakdixm | using System.Net; |
20 | using System.Windows.Threading; |
||
21 | e78f0871 | alzkakdixm | using System.Diagnostics; |
22 | using System.Windows.Input; |
||
23 | using Markus.Mvvm.ToolKit; |
||
24 | 902f397c | semi | using System.Windows.Data; |
25 | a6e5055d | alzkakdixm | |
26 | namespace Markus.Service.StationController.ViewModel |
||
27 | { |
||
28 | //세미 |
||
29 | dfc86b71 | taeseongkim | public class DataBaseItemsModel : Mvvm.ToolKit.ViewModelBase |
30 | a6e5055d | alzkakdixm | { |
31 | e6281033 | alzkakdixm | #region Constructor |
32 | |||
33 | /// <summary> |
||
34 | /// 실행하면 처음 들어가는 부분 |
||
35 | /// </summary> |
||
36 | public DataBaseItemsModel() |
||
37 | { |
||
38 | b63dcfbb | semi | DataFilterCommand = new DelegateCommand(DataFilter); |
39 | e6281033 | alzkakdixm | DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData); |
40 | ConvertCommand = new DelegateCommand(DataConvert); |
||
41 | DeleteCommand = new DelegateCommand(DataDelete); |
||
42 | ValidateCommand = new DelegateCommand(DataValidate); |
||
43 | e78f0871 | alzkakdixm | MarkusLinkCommand = new DelegateCommand(MarkusLink); |
44 | 5a954acc | semi | RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter); |
45 | FilterConvertSourceView.Filter = new Predicate<object>(o => DetailFilter(o as ConvertItem)); |
||
46 | b63dcfbb | semi | ResetCommand = new DelegateCommand(Reset); |
47 | 218e5002 | semi | ConverAddCommand = new DelegateCommand(ConverAdd); |
48 | e6281033 | alzkakdixm | } |
49 | |||
50 | #endregion |
||
51 | |||
52 | #region Properties |
||
53 | |||
54 | b63dcfbb | semi | private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterSearch; |
55 | public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterSearch |
||
56 | { |
||
57 | get |
||
58 | { |
||
59 | if (_FilterSearch == null) |
||
60 | { |
||
61 | _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<ConvertItem> |
||
62 | { |
||
63 | new ConvertItem{ProjectNumber = "Filter Search"} |
||
64 | }; |
||
65 | } |
||
66 | |||
67 | return _FilterSearch; |
||
68 | } |
||
69 | } |
||
70 | |||
71 | 2decfbdf | alzkakdixm | private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _AliveItems; |
72 | public System.Collections.ObjectModel.ObservableCollection<ConvertItem> AliveItems |
||
73 | { |
||
74 | e6281033 | alzkakdixm | get => _AliveItems; |
75 | set |
||
76 | 2decfbdf | alzkakdixm | { |
77 | 0cb12397 | alzkakdixm | _AliveItems = value; |
78 | 2decfbdf | alzkakdixm | OnPropertyChanged(() => AliveItems); |
79 | } |
||
80 | } |
||
81 | |||
82 | 5a954acc | semi | public ICollectionView FilterConvertSourceView |
83 | { |
||
84 | b63dcfbb | semi | get |
85 | { |
||
86 | var view = CollectionViewSource.GetDefaultView(FilterConvertSource); |
||
87 | //if (view.CanFilter) |
||
88 | //{ |
||
89 | // view.Filter = DetailFilter; |
||
90 | // view.Filter = o => String.IsNullOrEmpty(ProjectNumberFilter) ? true : ((string)o).Contains(ProjectNumberFilter); |
||
91 | // view.Filter = o => String.IsNullOrEmpty(UniqueKeyFilter) ? true : ((string)o).Contains(UniqueKeyFilter); |
||
92 | //} |
||
93 | return view; |
||
94 | } |
||
95 | 5a954acc | semi | } |
96 | |||
97 | dfc86b71 | taeseongkim | private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterConvertSource; |
98 | public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterConvertSource |
||
99 | { |
||
100 | 902f397c | semi | //get => _FilterConvertSource; |
101 | get |
||
102 | { |
||
103 | 5a954acc | semi | if (_FilterConvertSource == null) |
104 | { |
||
105 | _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
||
106 | } |
||
107 | //if (_FilterConvertSource != null) |
||
108 | 902f397c | semi | //{ |
109 | 5a954acc | semi | // var view = CollectionViewSource.GetDefaultView(FilterConvertSource); |
110 | // if (view.CanFilter) |
||
111 | // { |
||
112 | // view.Filter = DetailFilter; |
||
113 | // } |
||
114 | 902f397c | semi | //} |
115 | return _FilterConvertSource; |
||
116 | } |
||
117 | dfc86b71 | taeseongkim | set |
118 | { |
||
119 | _FilterConvertSource = value; |
||
120 | OnPropertyChanged(() => FilterConvertSource); |
||
121 | } |
||
122 | } |
||
123 | |||
124 | |||
125 | private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _RealConvertSource; |
||
126 | public System.Collections.ObjectModel.ObservableCollection<ConvertItem> RealConvertSource |
||
127 | { |
||
128 | get => _RealConvertSource; |
||
129 | set |
||
130 | { |
||
131 | _RealConvertSource = value; |
||
132 | OnPropertyChanged(() => RealConvertSource); |
||
133 | } |
||
134 | } |
||
135 | |||
136 | 2decfbdf | alzkakdixm | |
137 | 0cb12397 | alzkakdixm | private System.Windows.Documents.FlowDocument connectionLog; |
138 | 2decfbdf | alzkakdixm | public System.Windows.Documents.FlowDocument ConnectionLog |
139 | { |
||
140 | get => connectionLog; |
||
141 | set |
||
142 | { |
||
143 | if (connectionLog != value) |
||
144 | { |
||
145 | connectionLog = value; |
||
146 | OnPropertyChanged(() => ConnectionLog); |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 | |||
151 | a6e5055d | alzkakdixm | |
152 | private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus; |
||
153 | public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus |
||
154 | { |
||
155 | get => _SelectedStatus; |
||
156 | set |
||
157 | { |
||
158 | _SelectedStatus = value; |
||
159 | 0cb12397 | alzkakdixm | OnPropertyChanged(() => SelectedStatus); |
160 | a6e5055d | alzkakdixm | } |
161 | } |
||
162 | |||
163 | |||
164 | private SelectedCountItem _SelectedCount; |
||
165 | public SelectedCountItem SelectedCount |
||
166 | { |
||
167 | get => _SelectedCount; |
||
168 | set |
||
169 | { |
||
170 | _SelectedCount = value; |
||
171 | dfc86b71 | taeseongkim | OnPropertyChanged(() => SelectedCount); |
172 | a6e5055d | alzkakdixm | } |
173 | } |
||
174 | |||
175 | e6281033 | alzkakdixm | List<SelectedCountItem> _SelectedCountList; |
176 | public List<SelectedCountItem> SelectedCountList |
||
177 | a6e5055d | alzkakdixm | { |
178 | e6281033 | alzkakdixm | get |
179 | 2decfbdf | alzkakdixm | { |
180 | e6281033 | alzkakdixm | if (_SelectedCountList == null) |
181 | 2decfbdf | alzkakdixm | { |
182 | e6281033 | alzkakdixm | _SelectedCountList = new List<SelectedCountItem> |
183 | 2decfbdf | alzkakdixm | { |
184 | e6281033 | alzkakdixm | new SelectedCountItem{DisplayMember = "50",ValueMember = 50}, |
185 | new SelectedCountItem{DisplayMember = "100",ValueMember = 100}, |
||
186 | new SelectedCountItem{DisplayMember = "150",ValueMember = 150}, |
||
187 | new SelectedCountItem{DisplayMember = "200",ValueMember = 200} |
||
188 | }; |
||
189 | 2decfbdf | alzkakdixm | } |
190 | a6e5055d | alzkakdixm | |
191 | e6281033 | alzkakdixm | return _SelectedCountList; |
192 | 2decfbdf | alzkakdixm | } |
193 | } |
||
194 | a6e5055d | alzkakdixm | |
195 | 0cb12397 | alzkakdixm | private ConvertItem _SelectFilterConvert; |
196 | a6e5055d | alzkakdixm | public ConvertItem SelectFilterConvert |
197 | { |
||
198 | get => _SelectFilterConvert; |
||
199 | set |
||
200 | { |
||
201 | _SelectFilterConvert = value; |
||
202 | dfc86b71 | taeseongkim | OnPropertyChanged(() => SelectFilterConvert); |
203 | a6e5055d | alzkakdixm | } |
204 | } |
||
205 | 0cb12397 | alzkakdixm | |
206 | private ConvertItem _SelectRealConvert; |
||
207 | a6e5055d | alzkakdixm | public ConvertItem SelectRealConvert |
208 | { |
||
209 | get => _SelectRealConvert; |
||
210 | set |
||
211 | { |
||
212 | _SelectRealConvert = value; |
||
213 | dfc86b71 | taeseongkim | OnPropertyChanged(() => SelectRealConvert); |
214 | a6e5055d | alzkakdixm | } |
215 | } |
||
216 | |||
217 | 0cb12397 | alzkakdixm | |
218 | 8c128693 | semi | private ConvertItem _SelectAliveConvert; |
219 | public ConvertItem SelectAliveConvert |
||
220 | { |
||
221 | get => _SelectAliveConvert; |
||
222 | set |
||
223 | { |
||
224 | _SelectAliveConvert = value; |
||
225 | OnPropertyChanged(() => SelectAliveConvert); |
||
226 | } |
||
227 | } |
||
228 | |||
229 | |||
230 | 0cb12397 | alzkakdixm | private StatusTypeList _StatusType; |
231 | a6e5055d | alzkakdixm | public StatusTypeList StatusType |
232 | { |
||
233 | get => _StatusType; |
||
234 | set |
||
235 | { |
||
236 | _StatusType = value; |
||
237 | dfc86b71 | taeseongkim | OnPropertyChanged(() => StatusType); |
238 | a6e5055d | alzkakdixm | } |
239 | } |
||
240 | |||
241 | 0cb12397 | alzkakdixm | private bool _IsLoading; |
242 | a6e5055d | alzkakdixm | public bool IsLoading |
243 | { |
||
244 | get => _IsLoading; |
||
245 | set |
||
246 | { |
||
247 | if (_IsLoading != value) |
||
248 | { |
||
249 | _IsLoading = value; |
||
250 | dfc86b71 | taeseongkim | OnPropertyChanged(() => IsLoading); |
251 | a6e5055d | alzkakdixm | } |
252 | } |
||
253 | } |
||
254 | |||
255 | e6281033 | alzkakdixm | IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList; |
256 | public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList |
||
257 | a6e5055d | alzkakdixm | { |
258 | get |
||
259 | { |
||
260 | e6281033 | alzkakdixm | if (_StatusCodeList == null) |
261 | a6e5055d | alzkakdixm | { |
262 | e6281033 | alzkakdixm | _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>(); |
263 | a6e5055d | alzkakdixm | } |
264 | |||
265 | e6281033 | alzkakdixm | return _StatusCodeList; |
266 | a6e5055d | alzkakdixm | } |
267 | } |
||
268 | 8c7d1ea1 | alzkakdixm | |
269 | 902f397c | semi | public string _ProjectNumberFilter; |
270 | public string ProjectNumberFilter |
||
271 | { |
||
272 | get { return _ProjectNumberFilter; } |
||
273 | set |
||
274 | { |
||
275 | b63dcfbb | semi | if(_ProjectNumberFilter == "") |
276 | { |
||
277 | _ProjectNumberFilter = null; |
||
278 | } |
||
279 | else if (_ProjectNumberFilter != value) |
||
280 | 902f397c | semi | { |
281 | _ProjectNumberFilter = value; |
||
282 | 5a954acc | semi | OnPropertyChanged(() => ProjectNumberFilter); |
283 | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
||
284 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
285 | 902f397c | semi | } |
286 | } |
||
287 | } |
||
288 | |||
289 | public string _UniqueKeyFilter; |
||
290 | public string UniqueKeyFilter |
||
291 | { |
||
292 | b63dcfbb | semi | get |
293 | { |
||
294 | return _UniqueKeyFilter; |
||
295 | } |
||
296 | 902f397c | semi | set |
297 | { |
||
298 | b63dcfbb | semi | if (_UniqueKeyFilter == "") |
299 | { |
||
300 | _UniqueKeyFilter = null; |
||
301 | } |
||
302 | else if (_UniqueKeyFilter != value) |
||
303 | 902f397c | semi | { |
304 | _UniqueKeyFilter = value; |
||
305 | OnPropertyChanged(() => UniqueKeyFilter); |
||
306 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
307 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
308 | 902f397c | semi | } |
309 | } |
||
310 | } |
||
311 | |||
312 | 5a954acc | semi | public StatusCodeType _ConvertStateFilter; |
313 | public StatusCodeType ConvertStateFilter |
||
314 | 902f397c | semi | { |
315 | get { return _ConvertStateFilter; } |
||
316 | set |
||
317 | { |
||
318 | if (_ConvertStateFilter != value) |
||
319 | { |
||
320 | _ConvertStateFilter = value; |
||
321 | OnPropertyChanged(() => ConvertStateFilter); |
||
322 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
323 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
324 | 902f397c | semi | } |
325 | } |
||
326 | } |
||
327 | |||
328 | public string _Docuemnt_NOFilter; |
||
329 | public string Docuemnt_NOFilter |
||
330 | { |
||
331 | get { return _Docuemnt_NOFilter; } |
||
332 | set |
||
333 | { |
||
334 | b63dcfbb | semi | if (_Docuemnt_NOFilter == "") |
335 | { |
||
336 | _Docuemnt_NOFilter = null; |
||
337 | } |
||
338 | else if (_Docuemnt_NOFilter != value) |
||
339 | 902f397c | semi | { |
340 | _Docuemnt_NOFilter = value; |
||
341 | OnPropertyChanged(() => Docuemnt_NOFilter); |
||
342 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
343 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
344 | 902f397c | semi | } |
345 | } |
||
346 | } |
||
347 | |||
348 | public string _Docuemnt_NameFilter; |
||
349 | public string Docuemnt_NameFilter |
||
350 | { |
||
351 | get { return _Docuemnt_NameFilter; } |
||
352 | set |
||
353 | { |
||
354 | b63dcfbb | semi | if (_Docuemnt_NameFilter == "") |
355 | { |
||
356 | _Docuemnt_NameFilter = null; |
||
357 | } |
||
358 | else if (_Docuemnt_NameFilter != value) |
||
359 | 902f397c | semi | { |
360 | _Docuemnt_NameFilter = value; |
||
361 | OnPropertyChanged(() => Docuemnt_NameFilter); |
||
362 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
363 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
364 | 902f397c | semi | } |
365 | } |
||
366 | } |
||
367 | |||
368 | b63dcfbb | semi | public int? _ReconverterFilter = 0; |
369 | 5a954acc | semi | public int? ReconverterFilter |
370 | 902f397c | semi | { |
371 | get { return _ReconverterFilter; } |
||
372 | set |
||
373 | { |
||
374 | b63dcfbb | semi | if (_ReconverterFilter == null) |
375 | { |
||
376 | _ReconverterFilter = 0; |
||
377 | } |
||
378 | else if (_ReconverterFilter != value) |
||
379 | 902f397c | semi | { |
380 | _ReconverterFilter = value; |
||
381 | OnPropertyChanged(() => ReconverterFilter); |
||
382 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
383 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
384 | 5a954acc | semi | |
385 | 902f397c | semi | } |
386 | } |
||
387 | } |
||
388 | |||
389 | public string _Service_IDFilter; |
||
390 | public string Service_IDFilter |
||
391 | { |
||
392 | get { return _Service_IDFilter; } |
||
393 | set |
||
394 | { |
||
395 | b63dcfbb | semi | if (_Service_IDFilter == "") |
396 | { |
||
397 | _Service_IDFilter = null; |
||
398 | } |
||
399 | else if (_Service_IDFilter != value) |
||
400 | 902f397c | semi | { |
401 | _Service_IDFilter = value; |
||
402 | OnPropertyChanged(() => Service_IDFilter); |
||
403 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
404 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
405 | 902f397c | semi | } |
406 | } |
||
407 | } |
||
408 | |||
409 | public string _RevisionFilter; |
||
410 | public string RevisionFilter |
||
411 | { |
||
412 | get { return _RevisionFilter; } |
||
413 | set |
||
414 | { |
||
415 | b63dcfbb | semi | if (_RevisionFilter == "") |
416 | { |
||
417 | _RevisionFilter = null ; |
||
418 | } |
||
419 | else if (_RevisionFilter != value) |
||
420 | 902f397c | semi | { |
421 | _RevisionFilter = value; |
||
422 | OnPropertyChanged(() => RevisionFilter); |
||
423 | 5a954acc | semi | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
424 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
425 | } |
||
426 | } |
||
427 | } |
||
428 | |||
429 | public string _GroupNOFilter; |
||
430 | public string GroupNOFilter |
||
431 | { |
||
432 | get { return _GroupNOFilter; } |
||
433 | set |
||
434 | { |
||
435 | if (_GroupNOFilter == "") |
||
436 | { |
||
437 | _GroupNOFilter = null; |
||
438 | } |
||
439 | else if (_GroupNOFilter != value) |
||
440 | { |
||
441 | _GroupNOFilter = value; |
||
442 | OnPropertyChanged(() => GroupNOFilter); |
||
443 | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
||
444 | //FilterConvertSourceView.Refresh(); |
||
445 | 902f397c | semi | } |
446 | } |
||
447 | } |
||
448 | 5a954acc | semi | |
449 | b63dcfbb | semi | static DateTime DefaultCreateTime = DateTime.Now; |
450 | private DateTime _SelectedCreateTimeBegin = DefaultCreateTime; |
||
451 | 5a954acc | semi | public DateTime SelectedCreateTimeBegin |
452 | { |
||
453 | |||
454 | get { return _SelectedCreateTimeBegin; } |
||
455 | set |
||
456 | { |
||
457 | if (_SelectedCreateTimeBegin == value) |
||
458 | return; |
||
459 | _SelectedCreateTimeBegin = value; |
||
460 | OnPropertyChanged(() => SelectedCreateTimeBegin); |
||
461 | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
||
462 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
463 | 5a954acc | semi | //AddGeneratorBeginFilter(); |
464 | |||
465 | } |
||
466 | } |
||
467 | |||
468 | b63dcfbb | semi | private DateTime _SelectedCreateTimeEnd = DefaultCreateTime; |
469 | 5a954acc | semi | public DateTime SelectedCreateTimeEnd |
470 | { |
||
471 | |||
472 | get { return _SelectedCreateTimeEnd; } |
||
473 | set |
||
474 | { |
||
475 | if (_SelectedCreateTimeEnd == value) |
||
476 | return; |
||
477 | _SelectedCreateTimeEnd = value; |
||
478 | OnPropertyChanged(() => SelectedCreateTimeEnd); |
||
479 | //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh(); |
||
480 | 218e5002 | semi | //FilterConvertSourceView.Refresh(); |
481 | 5a954acc | semi | //AddGeneratorBeginFilter(); |
482 | |||
483 | } |
||
484 | } |
||
485 | |||
486 | 8c128693 | semi | public int _DataBase_ItemsHeight = 800; |
487 | public int DataBase_ItemsHeight |
||
488 | { |
||
489 | get { return _DataBase_ItemsHeight; } |
||
490 | set |
||
491 | { |
||
492 | _DataBase_ItemsHeight = value; |
||
493 | OnPropertyChanged(() => DataBase_ItemsHeight); |
||
494 | |||
495 | } |
||
496 | } |
||
497 | |||
498 | |||
499 | public int _RealConvert_Height = 80; |
||
500 | public int RealConvert_Height |
||
501 | 218e5002 | semi | { |
502 | 8c128693 | semi | get { return _RealConvert_Height; } |
503 | 218e5002 | semi | set |
504 | { |
||
505 | 8c128693 | semi | _RealConvert_Height = value; |
506 | OnPropertyChanged(() => RealConvert_Height); |
||
507 | 218e5002 | semi | } |
508 | } |
||
509 | |||
510 | 8c128693 | semi | public int _Alive_Height = 80; |
511 | public int Alive_Height |
||
512 | b63dcfbb | semi | { |
513 | 8c128693 | semi | get { return _Alive_Height; } |
514 | set |
||
515 | { |
||
516 | _Alive_Height = value; |
||
517 | OnPropertyChanged(() => Alive_Height); |
||
518 | } |
||
519 | } |
||
520 | b63dcfbb | semi | |
521 | 8c128693 | semi | public bool _ConvertShow; |
522 | public bool ConvertShow |
||
523 | { |
||
524 | get => _ConvertShow; |
||
525 | set |
||
526 | { |
||
527 | if (_ConvertShow = !value) |
||
528 | { |
||
529 | _ConvertShow = false; |
||
530 | } |
||
531 | _ConvertShow = value; |
||
532 | OnPropertyChanged(() => ConvertShow); |
||
533 | } |
||
534 | b63dcfbb | semi | } |
535 | 8c128693 | semi | |
536 | e6281033 | alzkakdixm | #endregion |
537 | |||
538 | #region Command |
||
539 | a6e5055d | alzkakdixm | |
540 | 0cb12397 | alzkakdixm | public DelegateCommand ConvertCommand { get; private set; } |
541 | public DelegateCommand DeleteCommand { get; private set; } |
||
542 | public DelegateCommand ValidateCommand { get; private set; } |
||
543 | e6281033 | alzkakdixm | public DelegateCommand DataSaveFileGemBoxCommand { get; private set; } |
544 | e78f0871 | alzkakdixm | public DelegateCommand MarkusLinkCommand { get; private set; } |
545 | b63dcfbb | semi | public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; } |
546 | |||
547 | public DelegateCommand DataFilterCommand { get; private set; } |
||
548 | public DelegateCommand ResetCommand { get; private set; } |
||
549 | 218e5002 | semi | public DelegateCommand ConverAddCommand { get; private set; } |
550 | 5a954acc | semi | |
551 | e6281033 | alzkakdixm | #endregion |
552 | a6e5055d | alzkakdixm | |
553 | e6281033 | alzkakdixm | #region Main Logic |
554 | a6e5055d | alzkakdixm | |
555 | e6281033 | alzkakdixm | /// <summary> |
556 | /// 각각의 Grid row 객체들 업데이트 |
||
557 | /// </summary> |
||
558 | |||
559 | private DispatcherTimer dispatcherTimer; |
||
560 | 8c128693 | semi | public override void Loaded() |
561 | { |
||
562 | base.Loaded(); |
||
563 | |||
564 | if (!App.IsDesignMode) |
||
565 | { |
||
566 | dispatcherTimer = new DispatcherTimer(); |
||
567 | dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
||
568 | dispatcherTimer.Interval = new TimeSpan(0, 0, 1); |
||
569 | dispatcherTimer.Start(); |
||
570 | } |
||
571 | } |
||
572 | a6e5055d | alzkakdixm | |
573 | b119eeaa | taeseongkim | private async void Timer_Tick(object sender, EventArgs e) |
574 | a6e5055d | alzkakdixm | { |
575 | e6281033 | alzkakdixm | dispatcherTimer.Stop(); |
576 | |||
577 | if (IsAcitve) |
||
578 | a6e5055d | alzkakdixm | { |
579 | b119eeaa | taeseongkim | await App.Current.Dispatcher.InvokeAsync(() => |
580 | a6e5055d | alzkakdixm | { |
581 | e6281033 | alzkakdixm | DataSelect(); |
582 | |||
583 | AliveDataSelect(); |
||
584 | }); |
||
585 | } |
||
586 | |||
587 | b119eeaa | taeseongkim | await Task.Delay(5000); |
588 | |||
589 | //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100)); |
||
590 | e6281033 | alzkakdixm | |
591 | dispatcherTimer.Start(); |
||
592 | } |
||
593 | a6e5055d | alzkakdixm | |
594 | e6281033 | alzkakdixm | public override void Closed() |
595 | { |
||
596 | if (dispatcherTimer != null) |
||
597 | { |
||
598 | dispatcherTimer.Stop(); |
||
599 | a6e5055d | alzkakdixm | } |
600 | e6281033 | alzkakdixm | |
601 | base.Closed(); |
||
602 | a6e5055d | alzkakdixm | } |
603 | 0cb12397 | alzkakdixm | |
604 | 2decfbdf | alzkakdixm | |
605 | e6281033 | alzkakdixm | #endregion |
606 | a6e5055d | alzkakdixm | |
607 | e6281033 | alzkakdixm | #region Function |
608 | a6e5055d | alzkakdixm | |
609 | e6281033 | alzkakdixm | #region Data Select |
610 | |||
611 | /// <summary> |
||
612 | /// 상단 그리드 중앙 그리드 출력 데이터 |
||
613 | /// </summary> |
||
614 | private void DataSelect() |
||
615 | { |
||
616 | a6e5055d | alzkakdixm | |
617 | e6281033 | alzkakdixm | if (FilterConvertSource == null) |
618 | { |
||
619 | FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
||
620 | } |
||
621 | |||
622 | if (RealConvertSource == null) |
||
623 | { |
||
624 | RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
||
625 | } |
||
626 | |||
627 | /// combobox 에서 선택된 items |
||
628 | if (SelectedStatus != null) |
||
629 | { |
||
630 | DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
||
631 | a6e5055d | alzkakdixm | } |
632 | |||
633 | e6281033 | alzkakdixm | /// 컨버터중인 items |
634 | RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource); |
||
635 | 2decfbdf | alzkakdixm | |
636 | e6281033 | alzkakdixm | } |
637 | 2decfbdf | alzkakdixm | |
638 | private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection) |
||
639 | { |
||
640 | try |
||
641 | { |
||
642 | using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
||
643 | { |
||
644 | var items = database.GetConvertProjects(collection)//x:database객체 y:statusCodeTypeList의값 Count()안에 predicator 조건 만족하면 count개수안에 넣음 |
||
645 | .Take(SelectedCount.ValueMember).ToList();// |
||
646 | |||
647 | items.ForEach(newitem => |
||
648 | { |
||
649 | collection.UpdateWhere(changeitem => |
||
650 | ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber); |
||
651 | }); |
||
652 | 8c128693 | semi | |
653 | RealConvert_Height = 80 + ( 10 * collection.Count()); |
||
654 | DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height); |
||
655 | 2decfbdf | alzkakdixm | } |
656 | } |
||
657 | catch (Exception ex) |
||
658 | { |
||
659 | MessageBox.Show(ex.ToString()); |
||
660 | } |
||
661 | } |
||
662 | |||
663 | a6e5055d | alzkakdixm | private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection) |
664 | { |
||
665 | try |
||
666 | { |
||
667 | using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
||
668 | { |
||
669 | |||
670 | 2decfbdf | alzkakdixm | int _status = 0; |
671 | if (SelectedStatus != null) |
||
672 | { |
||
673 | _status = (int)SelectedStatus.Value; |
||
674 | } |
||
675 | |||
676 | 218e5002 | semi | |
677 | b63dcfbb | semi | var items = database.GetConvertProjects(_status, ProjectNumberFilter, UniqueKeyFilter, Docuemnt_NameFilter, Service_IDFilter, Docuemnt_NOFilter |
678 | , ReconverterFilter, RevisionFilter)//x:database객체 y:statusCodeTypeList의값 Count()안에 predicator 조건 만족하면 count개수안에 넣음 |
||
679 | .Take(SelectedCount.ValueMember).ToList(); |
||
680 | 2decfbdf | alzkakdixm | |
681 | a6e5055d | alzkakdixm | if (collection.Count() == 0) |
682 | { |
||
683 | 2decfbdf | alzkakdixm | if (statusCodeTypeList.Count() == 1) |
684 | { |
||
685 | items.ForEach(x => collection.Add(x)); |
||
686 | } |
||
687 | a6e5055d | alzkakdixm | } |
688 | else |
||
689 | { |
||
690 | 2decfbdf | alzkakdixm | |
691 | ////세미 업데이트 |
||
692 | items.ForEach(newitem => |
||
693 | a6e5055d | alzkakdixm | { |
694 | collection.UpdateWhere(changeitem => |
||
695 | 2decfbdf | alzkakdixm | ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
696 | a6e5055d | alzkakdixm | }); |
697 | |||
698 | 2decfbdf | alzkakdixm | if (statusCodeTypeList.Count() == 1) |
699 | a6e5055d | alzkakdixm | { |
700 | 2decfbdf | alzkakdixm | //삭제 |
701 | for (int i = collection.Count() - 1; i >= 0; --i) |
||
702 | a6e5055d | alzkakdixm | { |
703 | 2decfbdf | alzkakdixm | var item = collection[i]; |
704 | a6e5055d | alzkakdixm | |
705 | 2decfbdf | alzkakdixm | if (items.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교 |
706 | {//참=> 0제외한 모든 수 |
||
707 | collection.RemoveAt(i); |
||
708 | } |
||
709 | } |
||
710 | a6e5055d | alzkakdixm | } |
711 | |||
712 | 2decfbdf | alzkakdixm | if (statusCodeTypeList.Count() == 1) |
713 | a6e5055d | alzkakdixm | { |
714 | 2decfbdf | alzkakdixm | //추가 convert 후 추가됨 |
715 | foreach (var item in items) |
||
716 | { |
||
717 | if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감 |
||
718 | { |
||
719 | /*for (int i = 0; i < collection.Count()+1; i++)//위 그리드에서 카운드 개수 변함 없고 컨버터 끝난 후 추가할때 createtime 비교 하며 order by 순으로 추가*/ |
||
720 | for (int i = 0; i < 200; i++) |
||
721 | { |
||
722 | if (i < collection.Count() - 1) |
||
723 | { |
||
724 | if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0) |
||
725 | { |
||
726 | collection.Insert(i, item); |
||
727 | break; |
||
728 | } |
||
729 | } |
||
730 | else |
||
731 | { |
||
732 | collection.Add(item); |
||
733 | break; |
||
734 | } |
||
735 | } |
||
736 | |||
737 | } |
||
738 | a6e5055d | alzkakdixm | |
739 | } |
||
740 | } |
||
741 | 2decfbdf | alzkakdixm | |
742 | a6e5055d | alzkakdixm | } |
743 | } |
||
744 | 2decfbdf | alzkakdixm | |
745 | a6e5055d | alzkakdixm | } |
746 | catch (Exception ex) |
||
747 | { |
||
748 | b63dcfbb | semi | //MessageBox.Show(ex.ToString()); |
749 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
750 | a6e5055d | alzkakdixm | } |
751 | } |
||
752 | |||
753 | b63dcfbb | semi | private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection) |
754 | { |
||
755 | try |
||
756 | { |
||
757 | 218e5002 | semi | using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
758 | b63dcfbb | semi | { |
759 | 218e5002 | semi | using (markusEntities entities = new markusEntities()) |
760 | { |
||
761 | b63dcfbb | semi | |
762 | |||
763 | 218e5002 | semi | int _status = 0; |
764 | if (SelectedStatus != null) |
||
765 | { |
||
766 | _status = (int)SelectedStatus.Value; |
||
767 | } |
||
768 | b63dcfbb | semi | |
769 | 218e5002 | semi | //DocumentID = unikey |
770 | b63dcfbb | semi | |
771 | 218e5002 | semi | //null 왼쪽에서 부터 p_BEGIN_START_DATETIE, p_Finish_START_DATETIE, BEGIN_END_DATETIME, Finish_END_DATETIME (전에 없애라고 하셔서..) |
772 | //오류떠서 [Model].Context.tt File에서 288줄 Function.Name to edmFunction.FullName바꿨더니 오류 안남 |
||
773 | var items = entities.SELECT_CONVERT_ITEM(ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, SelectedCreateTimeBegin, SelectedCreateTimeEnd, null, null, null, null, GroupNOFilter, |
||
774 | Docuemnt_NameFilter, Docuemnt_NOFilter, RevisionFilter).ToList();//이대로 그냥 쓰면 쿼리 -> 쿼리 결과는 두 번 이상 열거할 수 없습니다 뜸 |
||
775 | b63dcfbb | semi | |
776 | 218e5002 | semi | //SEARCH 할때 최소한 프로젝트 넘버랑 유니크키(다큐먼트 넘버) 크레이트타임 시작 줘야함 |
777 | b63dcfbb | semi | |
778 | 218e5002 | semi | List<ConvertItem> Listitems = new List<ConvertItem>(); |
779 | b63dcfbb | semi | |
780 | 218e5002 | semi | foreach (var x in items) |
781 | { |
||
782 | var convertpath = database.GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID); |
||
783 | b63dcfbb | semi | |
784 | 218e5002 | semi | ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
785 | , x.DOCUMENT_URL, convertpath[0], convertpath[1]); |
||
786 | Listitems.Add(AddItem); |
||
787 | //이거 없으면 collection.Insert(i, item); 할때 문제 생김 |
||
788 | } |
||
789 | |||
790 | if (collection.Count() == 0) |
||
791 | b63dcfbb | semi | { |
792 | 218e5002 | semi | if (statusCodeTypeList.Count() == 1) |
793 | b63dcfbb | semi | { |
794 | 218e5002 | semi | foreach (var x in Listitems) |
795 | { |
||
796 | collection.Add(x); |
||
797 | } |
||
798 | b63dcfbb | semi | } |
799 | } |
||
800 | 218e5002 | semi | else |
801 | b63dcfbb | semi | { |
802 | |||
803 | 218e5002 | semi | ////세미 업데이트 |
804 | foreach (var newitem in Listitems) |
||
805 | { |
||
806 | collection.UpdateWhere(changeitem => |
||
807 | ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
||
808 | } |
||
809 | b63dcfbb | semi | |
810 | |||
811 | 218e5002 | semi | if (statusCodeTypeList.Count() == 1) |
812 | b63dcfbb | semi | { |
813 | |||
814 | 218e5002 | semi | //삭제 |
815 | for (int i = collection.Count() - 1; i >= 0; --i) |
||
816 | b63dcfbb | semi | { |
817 | 218e5002 | semi | var item = collection[i]; |
818 | |||
819 | if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
||
820 | { |
||
821 | collection.RemoveAt(i); |
||
822 | } |
||
823 | b63dcfbb | semi | } |
824 | } |
||
825 | |||
826 | 218e5002 | semi | if (statusCodeTypeList.Count() == 1) |
827 | b63dcfbb | semi | { |
828 | 218e5002 | semi | //추가 convert 후 추가됨 |
829 | foreach (var item in Listitems) |
||
830 | b63dcfbb | semi | { |
831 | 218e5002 | semi | if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
832 | b63dcfbb | semi | { |
833 | 218e5002 | semi | for (int i = 0; i < 200; i++) |
834 | b63dcfbb | semi | { |
835 | 218e5002 | semi | if (i < collection.Count() - 1) |
836 | b63dcfbb | semi | { |
837 | 218e5002 | semi | if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0) |
838 | { |
||
839 | collection.Insert(i, item); |
||
840 | break; |
||
841 | } |
||
842 | } |
||
843 | else |
||
844 | { |
||
845 | collection.Add(item); |
||
846 | b63dcfbb | semi | break; |
847 | } |
||
848 | } |
||
849 | 218e5002 | semi | |
850 | b63dcfbb | semi | } |
851 | |||
852 | } |
||
853 | } |
||
854 | |||
855 | 218e5002 | semi | } |
856 | b63dcfbb | semi | } |
857 | } |
||
858 | |||
859 | } |
||
860 | catch (Exception ex) |
||
861 | { |
||
862 | //MessageBox.Show(ex.ToString()); |
||
863 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
864 | } |
||
865 | } |
||
866 | e6281033 | alzkakdixm | /// <summary> |
867 | /// 서비스의 실시간 컨버터 Item |
||
868 | /// </summary> |
||
869 | private async void AliveDataSelect() |
||
870 | a6e5055d | alzkakdixm | { |
871 | e6281033 | alzkakdixm | try |
872 | a6e5055d | alzkakdixm | { |
873 | e6281033 | alzkakdixm | List<ConvertItem> newitems = new List<ConvertItem>(); |
874 | 8c128693 | semi | using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
875 | e6281033 | alzkakdixm | { |
876 | 8c128693 | semi | foreach (var client in App.StationClientList) |
877 | e6281033 | alzkakdixm | { |
878 | 8c128693 | semi | if (await SimplePingAsync(client.Endpoint.Address.ToString())) |
879 | e6281033 | alzkakdixm | { |
880 | 8c128693 | semi | try |
881 | e6281033 | alzkakdixm | { |
882 | 8c128693 | semi | List<ConvertItem> itemsToList = new List<ConvertItem>(); |
883 | var items = await client.AliveConvertListAsync(); |
||
884 | string result = ""; |
||
885 | 29000595 | alzkakdixm | |
886 | 8c128693 | semi | foreach (var item in items) |
887 | e6281033 | alzkakdixm | { |
888 | 8c128693 | semi | ConvertItem itemsToEach = new ConvertItem(); |
889 | itemsToEach.ServiceID = item.ServiceID; |
||
890 | itemsToEach.ConvertID = item.ConvertID; |
||
891 | itemsToEach.ProjectNumber = item.ProjectNumber; |
||
892 | |||
893 | var convertpath = database.GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey); |
||
894 | |||
895 | if (item.ConvertState != null) |
||
896 | { |
||
897 | itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState); |
||
898 | } |
||
899 | |||
900 | if (item.OriginfilePath.Contains("/")) |
||
901 | { |
||
902 | result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1); |
||
903 | } |
||
904 | else |
||
905 | { |
||
906 | result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1); |
||
907 | } |
||
908 | itemsToEach.FileName = result; |
||
909 | |||
910 | itemsToEach.CurrentPageNo = item.CurrentPageNo; |
||
911 | itemsToEach.TotalPage = item.TotalPage; |
||
912 | itemsToEach.OriginfilePath = item.OriginfilePath; |
||
913 | itemsToEach.ConvertPath = item.ConvertPath; |
||
914 | itemsToEach.MarkusLink = convertpath[1]; |
||
915 | itemsToEach.UniqueKey = item.UniqueKey; |
||
916 | |||
917 | //itemsToEach.ConvertPath = item.ConvertPath; |
||
918 | itemsToEach.ConvertPath = convertpath[0]; |
||
919 | itemsToEach.CreateTime = item.CreateTime; |
||
920 | itemsToEach.Exception = item.Exception; |
||
921 | itemsToEach.ProcessorAffinity = item.ProcessorAffinity; |
||
922 | itemsToEach.ReConverter = item.ReConverter; |
||
923 | itemsToEach.DocumentID = item.DocumentID; |
||
924 | itemsToEach.DocumnetName = item.DocumnetName; |
||
925 | itemsToEach.GroupNo = item.GroupNo; |
||
926 | itemsToEach.Revision = item.Revision; |
||
927 | itemsToEach.StartTime = item.StartTime; |
||
928 | itemsToEach.EndTime = item.EndTime; |
||
929 | |||
930 | itemsToList.Add(itemsToEach); |
||
931 | e6281033 | alzkakdixm | } |
932 | 8c128693 | semi | newitems.AddRange(itemsToList); |
933 | System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping"); |
||
934 | e6281033 | alzkakdixm | |
935 | 8c128693 | semi | if (items.Count() == 0) |
936 | { |
||
937 | System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero."); |
||
938 | } |
||
939 | e6281033 | alzkakdixm | } |
940 | 8c128693 | semi | catch (Exception ex) |
941 | e6281033 | alzkakdixm | { |
942 | 8c128693 | semi | System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}"); |
943 | e6281033 | alzkakdixm | } |
944 | } |
||
945 | 8c128693 | semi | else |
946 | e6281033 | alzkakdixm | { |
947 | 8c128693 | semi | System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error"); |
948 | e6281033 | alzkakdixm | } |
949 | } |
||
950 | } |
||
951 | ItemsUpdate(newitems); |
||
952 | await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems)); |
||
953 | } |
||
954 | catch (Exception ex) |
||
955 | { |
||
956 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
957 | a6e5055d | alzkakdixm | } |
958 | } |
||
959 | |||
960 | e6281033 | alzkakdixm | /// <summary> |
961 | /// AliveDataSelect의 Data Update |
||
962 | /// </summary> |
||
963 | /// <param name="newitems"></param> |
||
964 | private void ItemsUpdate(List<ConvertItem> newitems) |
||
965 | a6e5055d | alzkakdixm | { |
966 | |||
967 | e6281033 | alzkakdixm | foreach (var item in newitems) |
968 | { |
||
969 | item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath); |
||
970 | } |
||
971 | |||
972 | if (AliveItems == null) |
||
973 | { |
||
974 | AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
||
975 | |||
976 | foreach (var item in newitems) |
||
977 | { |
||
978 | AliveItems.Add(item); |
||
979 | } |
||
980 | } |
||
981 | else |
||
982 | a6e5055d | alzkakdixm | { |
983 | e6281033 | alzkakdixm | /// 데이터 업데이트 |
984 | newitems.ForEach(newitem => |
||
985 | { |
||
986 | AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
||
987 | }); |
||
988 | |||
989 | // 추가 |
||
990 | foreach (var item in newitems) |
||
991 | { |
||
992 | if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
||
993 | { |
||
994 | AliveItems.Add(item); |
||
995 | } |
||
996 | } |
||
997 | a6e5055d | alzkakdixm | |
998 | e6281033 | alzkakdixm | /// 삭제 |
999 | 2decfbdf | alzkakdixm | |
1000 | e6281033 | alzkakdixm | for (int i = AliveItems.Count() - 1; i > -1; --i) |
1001 | { |
||
1002 | var item = AliveItems[i]; |
||
1003 | a6e5055d | alzkakdixm | |
1004 | e6281033 | alzkakdixm | if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
1005 | { |
||
1006 | try |
||
1007 | { |
||
1008 | AliveItems.RemoveAt(i); |
||
1009 | } |
||
1010 | catch (Exception ex) |
||
1011 | { |
||
1012 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
1013 | } |
||
1014 | } |
||
1015 | } |
||
1016 | 2decfbdf | alzkakdixm | } |
1017 | 8c128693 | semi | |
1018 | Alive_Height = 80 + (newitems.Count() * 10 ); |
||
1019 | DataBase_ItemsHeight = 800 - ( RealConvert_Height + Alive_Height); |
||
1020 | a6e5055d | alzkakdixm | } |
1021 | |||
1022 | |||
1023 | e6281033 | alzkakdixm | public static async Task<bool> SimplePingAsync(string uri) |
1024 | a6e5055d | alzkakdixm | { |
1025 | e6281033 | alzkakdixm | bool result = false; |
1026 | |||
1027 | try |
||
1028 | { |
||
1029 | using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient()) |
||
1030 | { |
||
1031 | Client.Timeout = new TimeSpan(0, 0, 60); |
||
1032 | |||
1033 | var message = await Client.GetAsync(uri); |
||
1034 | |||
1035 | System.Net.HttpStatusCode StatusCode = message.StatusCode; |
||
1036 | |||
1037 | switch (StatusCode) |
||
1038 | { |
||
1039 | |||
1040 | case System.Net.HttpStatusCode.Accepted: |
||
1041 | case System.Net.HttpStatusCode.OK: |
||
1042 | result = true; |
||
1043 | break; |
||
1044 | } |
||
1045 | } |
||
1046 | } |
||
1047 | catch (Exception ex) |
||
1048 | { |
||
1049 | result = false; |
||
1050 | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
||
1051 | } |
||
1052 | |||
1053 | return result; |
||
1054 | a6e5055d | alzkakdixm | } |
1055 | |||
1056 | e6281033 | alzkakdixm | #endregion |
1057 | |||
1058 | #region Data Convert |
||
1059 | a6e5055d | alzkakdixm | |
1060 | e6281033 | alzkakdixm | private void DataConvert(object obj) |
1061 | { |
||
1062 | if (SelectFilterConvert == null && SelectRealConvert == null) |
||
1063 | { |
||
1064 | MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!"); |
||
1065 | } |
||
1066 | else |
||
1067 | a6e5055d | alzkakdixm | { |
1068 | e6281033 | alzkakdixm | ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString); |
1069 | var resultRealConvert = 0; |
||
1070 | var resultFiltertConvert = 0; |
||
1071 | |||
1072 | if (SelectRealConvert != null) |
||
1073 | { |
||
1074 | resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert); |
||
1075 | } |
||
1076 | else if (SelectFilterConvert != null) |
||
1077 | a6e5055d | alzkakdixm | { |
1078 | e6281033 | alzkakdixm | resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert); |
1079 | } |
||
1080 | System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
||
1081 | |||
1082 | using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
||
1083 | { |
||
1084 | var items = database.GetConvertProjects(SelectFilterConvert); |
||
1085 | |||
1086 | foreach (var item in items) |
||
1087 | { |
||
1088 | RealConvertSource.Add(item); |
||
1089 | } |
||
1090 | 8c7d1ea1 | alzkakdixm | if (RealConvertSource.Count() == 1) |
1091 | { |
||
1092 | ConvertShow = true; |
||
1093 | } |
||
1094 | a6e5055d | alzkakdixm | } |
1095 | } |
||
1096 | e6281033 | alzkakdixm | } |
1097 | |||
1098 | #endregion |
||
1099 | |||
1100 | #region Validation |
||
1101 | a6e5055d | alzkakdixm | |
1102 | e6281033 | alzkakdixm | private void DataValidate(object obj) |
1103 | { |
||
1104 | |||
1105 | bool result = false; |
||
1106 | a6e5055d | alzkakdixm | |
1107 | e6281033 | alzkakdixm | WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath); |
1108 | webRequest.Timeout = 1200; // miliseconds |
||
1109 | webRequest.Method = "HEAD"; |
||
1110 | |||
1111 | HttpWebResponse response = null; |
||
1112 | |||
1113 | try |
||
1114 | { |
||
1115 | response = (HttpWebResponse)webRequest.GetResponse(); |
||
1116 | result = true; |
||
1117 | } |
||
1118 | catch (WebException webException) |
||
1119 | { |
||
1120 | MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message); |
||
1121 | result = true; |
||
1122 | } |
||
1123 | finally |
||
1124 | a6e5055d | alzkakdixm | { |
1125 | e6281033 | alzkakdixm | if (response != null) |
1126 | a6e5055d | alzkakdixm | { |
1127 | e6281033 | alzkakdixm | response.Close(); |
1128 | a6e5055d | alzkakdixm | } |
1129 | 2decfbdf | alzkakdixm | } |
1130 | e6281033 | alzkakdixm | if (result == true) |
1131 | { |
||
1132 | MessageBox.Show("File exists"); |
||
1133 | } |
||
1134 | } |
||
1135 | |||
1136 | #endregion |
||
1137 | |||
1138 | b63dcfbb | semi | #region DataFilter |
1139 | |||
1140 | public void DataFilter(object obj) |
||
1141 | { |
||
1142 | dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
||
1143 | DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
||
1144 | //dispatcherTimer.Start(); |
||
1145 | } |
||
1146 | |||
1147 | #endregion |
||
1148 | |||
1149 | e78f0871 | alzkakdixm | #region MarkusLink |
1150 | |||
1151 | private void MarkusLink(object obj)///여기서 부터 |
||
1152 | { |
||
1153 | if (obj is ConvertItem) |
||
1154 | { |
||
1155 | if (obj != null) |
||
1156 | { |
||
1157 | var convertitem = obj as ConvertItem; |
||
1158 | |||
1159 | SelectFilterConvert = convertitem; |
||
1160 | |||
1161 | SelectRealConvert = convertitem; |
||
1162 | |||
1163 | ProcessStartInfo startInfo = null; |
||
1164 | |||
1165 | startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink); |
||
1166 | |||
1167 | Process.Start(startInfo); |
||
1168 | } |
||
1169 | } |
||
1170 | } |
||
1171 | |||
1172 | #endregion |
||
1173 | |||
1174 | e6281033 | alzkakdixm | #region Data Delete |
1175 | |||
1176 | private void DataDelete(object obj) |
||
1177 | { |
||
1178 | 8c7d1ea1 | alzkakdixm | RadWindow.Alert("do you want to delete it??", this.OnClosed); |
1179 | e6281033 | alzkakdixm | } |
1180 | |||
1181 | private void OnClosed(object sender, WindowClosedEventArgs e) |
||
1182 | { |
||
1183 | var result = e.DialogResult; |
||
1184 | if (result == true) |
||
1185 | { |
||
1186 | ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString); |
||
1187 | var resultRealConvert = _DataConvert.RemoveItem(SelectRealConvert.ConvertID); |
||
1188 | var resultFiltertConvert = _DataConvert.RemoveItem(SelectFilterConvert.ConvertID); |
||
1189 | System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
||
1190 | } |
||
1191 | } |
||
1192 | |||
1193 | |||
1194 | #endregion |
||
1195 | |||
1196 | #region Data Export |
||
1197 | |||
1198 | |||
1199 | /// <summary> |
||
1200 | /// 필터된 상단 그리드 엑셀로 출력 |
||
1201 | /// </summary> |
||
1202 | |||
1203 | public void DataExportData(object obj) |
||
1204 | { |
||
1205 | SaveFileDialog saveFileDialog = new SaveFileDialog(); |
||
1206 | |||
1207 | saveFileDialog.FileName = "Document"; // Default file name |
||
1208 | saveFileDialog.DefaultExt = ".txt"; // Default file extension |
||
1209 | saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension |
||
1210 | |||
1211 | |||
1212 | if (saveFileDialog.ShowDialog() == true) |
||
1213 | 2decfbdf | alzkakdixm | { |
1214 | e6281033 | alzkakdixm | |
1215 | |||
1216 | if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName)) |
||
1217 | 0cb12397 | alzkakdixm | { |
1218 | e6281033 | alzkakdixm | |
1219 | var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension; |
||
1220 | |||
1221 | if (extension == ".xlsx" || extension == ".csv") |
||
1222 | { |
||
1223 | |||
1224 | var headers = new List<HeaderMember> |
||
1225 | { |
||
1226 | new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" }, |
||
1227 | new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" }, |
||
1228 | new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" }, |
||
1229 | new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" }, |
||
1230 | new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" }, |
||
1231 | new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" }, |
||
1232 | new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" }, |
||
1233 | new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" }, |
||
1234 | new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" }, |
||
1235 | new HeaderMember{HeaderName = "Exception", Property = "Exception" }, |
||
1236 | new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" }, |
||
1237 | new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" }, |
||
1238 | new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" } |
||
1239 | }; |
||
1240 | |||
1241 | |||
1242 | DataExport dataExport = new DataExport(); |
||
1243 | dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers); |
||
1244 | //_dataExport.DataExportExcel(saveFileDialog.FileName, saveFileDialog.FileName.ToString(), Projectsource, headers); |
||
1245 | //GemBoxFileSave(obj); |
||
1246 | } |
||
1247 | 0cb12397 | alzkakdixm | } |
1248 | 2decfbdf | alzkakdixm | } |
1249 | } |
||
1250 | e6281033 | alzkakdixm | |
1251 | #endregion |
||
1252 | |||
1253 | b63dcfbb | semi | #region Data Search |
1254 | 902f397c | semi | |
1255 | |||
1256 | /// <summary> |
||
1257 | /// Grid Filter |
||
1258 | /// </summary> |
||
1259 | |||
1260 | 5a954acc | semi | private bool DetailFilter(object item) |
1261 | 902f397c | semi | { |
1262 | var Item = item as ConvertItem; |
||
1263 | if (ProjectNumberFilter == null) return true; |
||
1264 | if (ProjectNumberFilter == Item.ProjectNumber) return true; |
||
1265 | 5a954acc | semi | //if (ConvertStateFilter == null) return true; |
1266 | //if (ConvertStateFilter == (StatusCodeType)Item.ConvertState) return true; |
||
1267 | if (Docuemnt_NameFilter == null) return true; |
||
1268 | if (Docuemnt_NameFilter == Item.DocumnetName) return true; |
||
1269 | if (Service_IDFilter == null) return true; |
||
1270 | if (Service_IDFilter == Item.ServiceID) return true; |
||
1271 | if (UniqueKeyFilter == null) return true; |
||
1272 | if (UniqueKeyFilter == Item.UniqueKey) return true; |
||
1273 | if (Docuemnt_NOFilter == null) return true; |
||
1274 | if (Docuemnt_NOFilter == Item.DocumnetNo) return true; |
||
1275 | if (ReconverterFilter == null) return true; |
||
1276 | if (ReconverterFilter == Item.ReConverter) return true; |
||
1277 | if (RevisionFilter == null) return true; |
||
1278 | if (RevisionFilter == Item.Revision) return true; |
||
1279 | |||
1280 | 902f397c | semi | return false; |
1281 | } |
||
1282 | |||
1283 | b63dcfbb | semi | public void RemoveCreateTimeFilter(object obj) |
1284 | { |
||
1285 | DefaultCreateTime = DateTime.Now; |
||
1286 | SelectedCreateTimeBegin = DefaultCreateTime; |
||
1287 | SelectedCreateTimeEnd = DefaultCreateTime; |
||
1288 | |||
1289 | } |
||
1290 | |||
1291 | #endregion |
||
1292 | |||
1293 | #region Reset |
||
1294 | |||
1295 | /// <summary> |
||
1296 | /// 그리드 상단 원상복귀 버튼 |
||
1297 | /// 필터를 끝낸 후 다시 복귀 |
||
1298 | /// </summary> |
||
1299 | |||
1300 | public void Reset(object obj) |
||
1301 | 5a954acc | semi | { |
1302 | b63dcfbb | semi | dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1303 | 5a954acc | semi | } |
1304 | |||
1305 | 902f397c | semi | #endregion |
1306 | |||
1307 | 218e5002 | semi | |
1308 | 8c128693 | semi | #region ConvertAddDialog |
1309 | 218e5002 | semi | |
1310 | /// <summary> |
||
1311 | /// 그리드 상단 Conver 추가 버튼 |
||
1312 | /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 |
||
1313 | /// </summary> |
||
1314 | |||
1315 | public void ConverAdd(object obj) |
||
1316 | { |
||
1317 | 8c128693 | semi | dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
1318 | 43b2e236 | semi | |
1319 | Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog(); |
||
1320 | 8c128693 | semi | |
1321 | 43b2e236 | semi | convertAddDialog.ShowDialog(); |
1322 | 218e5002 | semi | |
1323 | 8c128693 | semi | dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1324 | 218e5002 | semi | } |
1325 | |||
1326 | #endregion |
||
1327 | |||
1328 | 8c128693 | semi | |
1329 | e6281033 | alzkakdixm | #endregion |
1330 | a6e5055d | alzkakdixm | } |
1331 | } |