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