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