markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / DataBaseItemsModel.cs @ 78683624
이력 | 보기 | 이력해설 | 다운로드 (47.4 KB)
1 |
using Markus.Service.Extensions; |
---|---|
2 |
using Markus.Service.StationController.Data; |
3 |
using Markus.Service.StationController.Behaviors; |
4 |
using Markus.Service.StationController.Extensions; |
5 |
using Markus.Service.StationController.Controls; |
6 |
using Microsoft.Win32; |
7 |
using System; |
8 |
using System.Collections.Generic; |
9 |
using System.ComponentModel; |
10 |
using System.Linq; |
11 |
using System.Threading.Tasks; |
12 |
using System.Web; |
13 |
using System.Windows; |
14 |
using Telerik.Windows.Controls; |
15 |
using Telerik.Windows.Data; |
16 |
using System.Net; |
17 |
using System.Windows.Threading; |
18 |
using System.Diagnostics; |
19 |
using System.Windows.Input; |
20 |
using Markus.Mvvm.ToolKit; |
21 |
using System.Windows.Data; |
22 |
using System.Windows.Controls; |
23 |
using System.IO; |
24 |
using Newtonsoft.Json; |
25 |
//using Markus.Service.Interface; |
26 |
using static Markus.Service.StationController.Data.DataConvert; |
27 |
|
28 |
namespace Markus.Service.StationController.ViewModel |
29 |
{ |
30 |
//세미 |
31 |
public class DataBaseItemsModel : Mvvm.ToolKit.ViewModelBase |
32 |
{ |
33 |
#region Constructor |
34 |
|
35 |
/// <summary> |
36 |
/// 실행하면 처음 들어가는 부분 |
37 |
/// </summary> |
38 |
public DataBaseItemsModel() |
39 |
{ |
40 |
DataFilterCommand = new DelegateCommand(DataFilter); |
41 |
DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData); |
42 |
ConvertCommand = new DelegateCommand(DataConvert); |
43 |
DeleteCommand = new DelegateCommand(DataDelete); |
44 |
ValidateCommand = new DelegateCommand(DataValidate); |
45 |
MarkusLinkCommand = new DelegateCommand(MarkusLink); |
46 |
RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter); |
47 |
ResetCommand = new DelegateCommand(Reset); |
48 |
ConverAddCommand = new DelegateCommand(ConverAdd); |
49 |
ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch); |
50 |
} |
51 |
|
52 |
#endregion |
53 |
|
54 |
#region Properties |
55 |
|
56 |
private System.Collections.ObjectModel.ObservableCollection<DataConvert> _FilterSearch; |
57 |
public System.Collections.ObjectModel.ObservableCollection<DataConvert> FilterSearch |
58 |
{ |
59 |
get |
60 |
{ |
61 |
if (_FilterSearch == null) |
62 |
{ |
63 |
_FilterSearch = new System.Collections.ObjectModel.ObservableCollection<DataConvert> |
64 |
{ |
65 |
new DataConvert{ProjectNumber = "Filter Search"} |
66 |
}; |
67 |
} |
68 |
|
69 |
return _FilterSearch; |
70 |
} |
71 |
} |
72 |
|
73 |
private System.Collections.ObjectModel.ObservableCollection<DataConvert> _AliveItems; |
74 |
public System.Collections.ObjectModel.ObservableCollection<DataConvert> AliveItems |
75 |
{ |
76 |
get => _AliveItems; |
77 |
set |
78 |
{ |
79 |
_AliveItems = value; |
80 |
OnPropertyChanged(() => AliveItems); |
81 |
} |
82 |
} |
83 |
|
84 |
public ICollectionView FilterConvertSourceView |
85 |
{ |
86 |
get |
87 |
{ |
88 |
var view = CollectionViewSource.GetDefaultView(FilterConvertSource); |
89 |
return view; |
90 |
} |
91 |
} |
92 |
|
93 |
private System.Collections.ObjectModel.ObservableCollection<DataConvert> _FilterConvertSource; |
94 |
public System.Collections.ObjectModel.ObservableCollection<DataConvert> FilterConvertSource |
95 |
{ |
96 |
get |
97 |
{ |
98 |
if (_FilterConvertSource == null) |
99 |
{ |
100 |
_FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<DataConvert>(); |
101 |
} |
102 |
return _FilterConvertSource; |
103 |
} |
104 |
set |
105 |
{ |
106 |
_FilterConvertSource = value; |
107 |
OnPropertyChanged(() => FilterConvertSource); |
108 |
} |
109 |
} |
110 |
|
111 |
|
112 |
private System.Collections.ObjectModel.ObservableCollection<DataConvert> _RealConvertSource; |
113 |
public System.Collections.ObjectModel.ObservableCollection<DataConvert> RealConvertSource |
114 |
{ |
115 |
get => _RealConvertSource; |
116 |
set |
117 |
{ |
118 |
_RealConvertSource = value; |
119 |
OnPropertyChanged(() => RealConvertSource); |
120 |
} |
121 |
} |
122 |
|
123 |
|
124 |
private System.Windows.Documents.FlowDocument connectionLog; |
125 |
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 |
|
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 |
OnPropertyChanged(() => SelectedStatus); |
147 |
} |
148 |
} |
149 |
|
150 |
|
151 |
private SelectedCountItem _SelectedCount; |
152 |
public SelectedCountItem SelectedCount |
153 |
{ |
154 |
get => _SelectedCount; |
155 |
set |
156 |
{ |
157 |
_SelectedCount = value; |
158 |
OnPropertyChanged(() => SelectedCount); |
159 |
} |
160 |
} |
161 |
|
162 |
List<SelectedCountItem> _SelectedCountList; |
163 |
public List<SelectedCountItem> SelectedCountList |
164 |
{ |
165 |
get |
166 |
{ |
167 |
if (_SelectedCountList == null) |
168 |
{ |
169 |
_SelectedCountList = new List<SelectedCountItem> |
170 |
{ |
171 |
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 |
} |
177 |
|
178 |
return _SelectedCountList; |
179 |
} |
180 |
} |
181 |
|
182 |
private DataConvert _SelectFilterConvert; |
183 |
public DataConvert SelectFilterConvert |
184 |
{ |
185 |
get => _SelectFilterConvert; |
186 |
set |
187 |
{ |
188 |
_SelectFilterConvert = value; |
189 |
OnPropertyChanged(() => SelectFilterConvert); |
190 |
} |
191 |
} |
192 |
|
193 |
private DataConvert _SelectRealConvert; |
194 |
public DataConvert SelectRealConvert |
195 |
{ |
196 |
get => _SelectRealConvert; |
197 |
set |
198 |
{ |
199 |
_SelectRealConvert = value; |
200 |
OnPropertyChanged(() => SelectRealConvert); |
201 |
} |
202 |
} |
203 |
|
204 |
|
205 |
private DataConvert _SelectAliveConvert; |
206 |
public DataConvert SelectAliveConvert |
207 |
{ |
208 |
get => _SelectAliveConvert; |
209 |
set |
210 |
{ |
211 |
_SelectAliveConvert = value; |
212 |
OnPropertyChanged(() => SelectAliveConvert); |
213 |
} |
214 |
} |
215 |
|
216 |
|
217 |
private StatusTypeList _StatusType; |
218 |
public StatusTypeList StatusType |
219 |
{ |
220 |
get => _StatusType; |
221 |
set |
222 |
{ |
223 |
_StatusType = value; |
224 |
OnPropertyChanged(() => StatusType); |
225 |
} |
226 |
} |
227 |
|
228 |
private bool _IsLoading; |
229 |
public bool IsLoading |
230 |
{ |
231 |
get => _IsLoading; |
232 |
set |
233 |
{ |
234 |
if (_IsLoading != value) |
235 |
{ |
236 |
_IsLoading = value; |
237 |
OnPropertyChanged(() => IsLoading); |
238 |
} |
239 |
} |
240 |
} |
241 |
|
242 |
IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList; |
243 |
public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList |
244 |
{ |
245 |
get |
246 |
{ |
247 |
if (_StatusCodeList == null) |
248 |
{ |
249 |
_StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>(); |
250 |
} |
251 |
|
252 |
return _StatusCodeList; |
253 |
} |
254 |
} |
255 |
|
256 |
public string _ProjectNumberFilter; |
257 |
public string ProjectNumberFilter |
258 |
{ |
259 |
get { return _ProjectNumberFilter; } |
260 |
set |
261 |
{ |
262 |
if (_ProjectNumberFilter == "") |
263 |
{ |
264 |
_ProjectNumberFilter = null; |
265 |
} |
266 |
else if (_ProjectNumberFilter != value) |
267 |
{ |
268 |
_ProjectNumberFilter = value; |
269 |
OnPropertyChanged(() => ProjectNumberFilter); |
270 |
} |
271 |
} |
272 |
} |
273 |
|
274 |
public string _UniqueKeyFilter; |
275 |
public string UniqueKeyFilter |
276 |
{ |
277 |
get |
278 |
{ |
279 |
return _UniqueKeyFilter; |
280 |
} |
281 |
set |
282 |
{ |
283 |
if (_UniqueKeyFilter == "") |
284 |
{ |
285 |
_UniqueKeyFilter = null; |
286 |
} |
287 |
else if (_UniqueKeyFilter != value) |
288 |
{ |
289 |
_UniqueKeyFilter = value; |
290 |
OnPropertyChanged(() => UniqueKeyFilter); |
291 |
} |
292 |
} |
293 |
} |
294 |
|
295 |
public StatusCodeType _ConvertStateFilter; |
296 |
public StatusCodeType ConvertStateFilter |
297 |
{ |
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 |
if (_Docuemnt_NOFilter == "") |
316 |
{ |
317 |
_Docuemnt_NOFilter = null; |
318 |
} |
319 |
else if (_Docuemnt_NOFilter != value) |
320 |
{ |
321 |
_Docuemnt_NOFilter = value; |
322 |
OnPropertyChanged(() => Docuemnt_NOFilter); |
323 |
} |
324 |
} |
325 |
} |
326 |
|
327 |
public string _Document_NameFilter; |
328 |
public string Document_NameFilter |
329 |
{ |
330 |
get { return _Document_NameFilter; } |
331 |
set |
332 |
{ |
333 |
if (_Document_NameFilter == "") |
334 |
{ |
335 |
_Document_NameFilter = null; |
336 |
} |
337 |
else if (_Document_NameFilter != value) |
338 |
{ |
339 |
_Document_NameFilter = value; |
340 |
OnPropertyChanged(() => Document_NameFilter); |
341 |
} |
342 |
} |
343 |
} |
344 |
|
345 |
public int? _ReconverterFilter = 0; |
346 |
public int? ReconverterFilter |
347 |
{ |
348 |
get { return _ReconverterFilter; } |
349 |
set |
350 |
{ |
351 |
if (_ReconverterFilter == null) |
352 |
{ |
353 |
_ReconverterFilter = 0; |
354 |
} |
355 |
else if (_ReconverterFilter != value) |
356 |
{ |
357 |
_ReconverterFilter = value; |
358 |
OnPropertyChanged(() => ReconverterFilter); |
359 |
|
360 |
} |
361 |
} |
362 |
} |
363 |
|
364 |
public string _Service_IDFilter; |
365 |
public string Service_IDFilter |
366 |
{ |
367 |
get { return _Service_IDFilter; } |
368 |
set |
369 |
{ |
370 |
if (_Service_IDFilter == "") |
371 |
{ |
372 |
_Service_IDFilter = null; |
373 |
} |
374 |
else if (_Service_IDFilter != value) |
375 |
{ |
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 |
if (_RevisionFilter == "") |
389 |
{ |
390 |
_RevisionFilter = null; |
391 |
} |
392 |
else if (_RevisionFilter != value) |
393 |
{ |
394 |
_RevisionFilter = value; |
395 |
OnPropertyChanged(() => RevisionFilter); |
396 |
} |
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 |
} |
415 |
} |
416 |
} |
417 |
|
418 |
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 |
static DateTime DefaultCreateTime = DateTime.Now; |
437 |
private DateTime _SelectedCreateTimeBegin = DefaultCreateTime; |
438 |
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 |
private DateTime _SelectedCreateTimeEnd = DefaultCreateTime; |
453 |
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 |
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 |
} |
480 |
|
481 |
#endregion |
482 |
|
483 |
#region Command |
484 |
|
485 |
public DelegateCommand ConvertCommand { get; private set; } |
486 |
public DelegateCommand DeleteCommand { get; private set; } |
487 |
public DelegateCommand ValidateCommand { get; private set; } |
488 |
public DelegateCommand DataSaveFileGemBoxCommand { get; private set; } |
489 |
public DelegateCommand MarkusLinkCommand { get; private set; } |
490 |
public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; } |
491 |
|
492 |
public DelegateCommand DataFilterCommand { get; private set; } |
493 |
public DelegateCommand ResetCommand { get; private set; } |
494 |
public DelegateCommand ConverAddCommand { get; private set; } |
495 |
public DelegateCommand ConvertPathFileSearchCommand { get; private set; } |
496 |
|
497 |
#endregion |
498 |
|
499 |
#region Main Logic |
500 |
|
501 |
/// <summary> |
502 |
/// 각각의 Grid row 객체들 업데이트 |
503 |
/// </summary> |
504 |
|
505 |
private DispatcherTimer dispatcherTimer; |
506 |
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 |
|
519 |
private async void Timer_Tick(object sender, EventArgs e) |
520 |
{ |
521 |
dispatcherTimer.Stop(); |
522 |
|
523 |
if (IsAcitve) |
524 |
{ |
525 |
await App.Current.Dispatcher.InvokeAsync(() => |
526 |
{ |
527 |
DataSelect(); |
528 |
|
529 |
AliveDataSelect(); |
530 |
}); |
531 |
} |
532 |
|
533 |
//await Task.Delay(5000); |
534 |
await Task.Delay(10000); |
535 |
|
536 |
//System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100)); |
537 |
|
538 |
dispatcherTimer.Start(); |
539 |
} |
540 |
|
541 |
public override void Closed() |
542 |
{ |
543 |
if (dispatcherTimer != null) |
544 |
{ |
545 |
dispatcherTimer.Stop(); |
546 |
} |
547 |
|
548 |
base.Closed(); |
549 |
} |
550 |
|
551 |
|
552 |
#endregion |
553 |
|
554 |
#region Function |
555 |
|
556 |
#region Data Select |
557 |
|
558 |
/// <summary> |
559 |
/// 상단 그리드 중앙 그리드 출력 데이터 |
560 |
/// </summary> |
561 |
private void DataSelect() |
562 |
{ |
563 |
|
564 |
if (FilterConvertSource == null) |
565 |
{ |
566 |
FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<DataConvert>(); |
567 |
} |
568 |
|
569 |
if (RealConvertSource == null) |
570 |
{ |
571 |
RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<DataConvert>(); |
572 |
} |
573 |
|
574 |
/// combobox 에서 선택된 items |
575 |
if (SelectedStatus != null) |
576 |
{ |
577 |
DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
578 |
} |
579 |
|
580 |
/// 컨버터중인 items |
581 |
RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource); |
582 |
|
583 |
} |
584 |
|
585 |
private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<DataConvert> collection) |
586 |
{ |
587 |
try |
588 |
{ |
589 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
590 |
{ |
591 |
List<DataConvert> Listitems = new List<DataConvert>(); |
592 |
|
593 |
foreach (var coll in collection) |
594 |
{ |
595 |
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 |
|
597 |
foreach (var x in items) |
598 |
{ |
599 |
var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech"); |
600 |
|
601 |
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 |
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 |
Listitems.Add(AddItem); |
604 |
|
605 |
} |
606 |
} |
607 |
|
608 |
Listitems.ForEach(newitem => |
609 |
{ |
610 |
collection.UpdateWhere(changeitem => |
611 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber); |
612 |
}); |
613 |
|
614 |
} |
615 |
} |
616 |
catch (Exception ex) |
617 |
{ |
618 |
MessageBox.Show(ex.ToString()); |
619 |
} |
620 |
} |
621 |
|
622 |
private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<DataConvert> collection) |
623 |
{ |
624 |
try |
625 |
{ |
626 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
627 |
{ |
628 |
|
629 |
int _status = 0; |
630 |
if (SelectedStatus != null) |
631 |
{ |
632 |
_status = (int)SelectedStatus.Value; |
633 |
} |
634 |
|
635 |
var items = entities.SELECT_CONVERT_ITEM(null, null, null, _status, SelectedCount.ValueMember, null, null, null, |
636 |
null, null, null, null, null, null, null, null, null, null).ToList(); |
637 |
|
638 |
List<DataConvert> Listitems = new List<DataConvert>(); |
639 |
|
640 |
foreach (var x in items) |
641 |
{ |
642 |
var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech"); |
643 |
|
644 |
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 |
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 |
Listitems.Add(AddItem); |
647 |
|
648 |
} |
649 |
|
650 |
if (collection.Count() == 0) |
651 |
{ |
652 |
if (statusCodeTypeList.Count() == 1) |
653 |
{ |
654 |
Listitems.ForEach(x => collection.Add(x)); |
655 |
} |
656 |
} |
657 |
else |
658 |
{ |
659 |
|
660 |
////세미 업데이트 |
661 |
Listitems.ForEach(newitem => |
662 |
{ |
663 |
collection.UpdateWhere(changeitem => |
664 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
665 |
}); |
666 |
|
667 |
if (statusCodeTypeList.Count() == 1) |
668 |
{ |
669 |
//삭제 |
670 |
for (int i = collection.Count() - 1; i >= 0; --i) |
671 |
{ |
672 |
var item = collection[i]; |
673 |
|
674 |
if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교 |
675 |
{//참=> 0제외한 모든 수 |
676 |
collection.RemoveAt(i); |
677 |
} |
678 |
} |
679 |
} |
680 |
|
681 |
if (statusCodeTypeList.Count() == 1) |
682 |
{ |
683 |
//추가 convert 후 추가됨 |
684 |
foreach (var item in Listitems) |
685 |
{ |
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 |
|
708 |
} |
709 |
} |
710 |
|
711 |
} |
712 |
} |
713 |
|
714 |
} |
715 |
catch (Exception ex) |
716 |
{ |
717 |
MessageBox.Show(ex.ToString()); |
718 |
//System.Diagnostics.Debug.WriteLine(ex.ToString()); |
719 |
} |
720 |
} |
721 |
|
722 |
private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<DataConvert> collection) |
723 |
{ |
724 |
try |
725 |
{ |
726 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
727 |
{ |
728 |
int _status = 0; |
729 |
if (SelectedStatus != null) |
730 |
{ |
731 |
_status = (int)SelectedStatus.Value; |
732 |
} |
733 |
|
734 |
//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 |
|
746 |
var items = entities.SELECT_CONVERT_ITEM(null, ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null, |
747 |
null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter).ToList(); |
748 |
|
749 |
List<DataConvert> Listitems = new List<DataConvert>(); |
750 |
|
751 |
foreach (var x in items) |
752 |
{ |
753 |
var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech"); |
754 |
|
755 |
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 |
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 |
Listitems.Add(AddItem); |
758 |
|
759 |
} |
760 |
|
761 |
if (collection.Count() == 0) |
762 |
{ |
763 |
if (statusCodeTypeList.Count() == 1) |
764 |
{ |
765 |
foreach (var x in Listitems) |
766 |
{ |
767 |
collection.Add(x); |
768 |
} |
769 |
} |
770 |
} |
771 |
else |
772 |
{ |
773 |
|
774 |
////세미 업데이트 |
775 |
foreach (var newitem in Listitems) |
776 |
{ |
777 |
collection.UpdateWhere(changeitem => |
778 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
779 |
} |
780 |
|
781 |
|
782 |
if (statusCodeTypeList.Count() == 1) |
783 |
{ |
784 |
|
785 |
//삭제 |
786 |
for (int i = collection.Count() - 1; i >= 0; --i) |
787 |
{ |
788 |
var item = collection[i]; |
789 |
|
790 |
if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
791 |
{ |
792 |
collection.RemoveAt(i); |
793 |
} |
794 |
} |
795 |
} |
796 |
|
797 |
if (statusCodeTypeList.Count() == 1) |
798 |
{ |
799 |
//추가 convert 후 추가됨 |
800 |
foreach (var item in Listitems) |
801 |
{ |
802 |
if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
803 |
{ |
804 |
for (int i = 0; i < 200; i++) |
805 |
{ |
806 |
if (i < collection.Count() - 1) |
807 |
{ |
808 |
if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0) |
809 |
{ |
810 |
collection.Insert(i, item); |
811 |
break; |
812 |
} |
813 |
} |
814 |
else |
815 |
{ |
816 |
collection.Add(item); |
817 |
break; |
818 |
} |
819 |
} |
820 |
|
821 |
} |
822 |
|
823 |
} |
824 |
} |
825 |
|
826 |
} |
827 |
|
828 |
} |
829 |
|
830 |
} |
831 |
catch (Exception ex) |
832 |
{ |
833 |
MessageBox.Show(ex.ToString()); |
834 |
//System.Diagnostics.Debug.WriteLine(ex.ToString()); |
835 |
} |
836 |
} |
837 |
/// <summary> |
838 |
/// 서비스의 실시간 컨버터 Item |
839 |
/// </summary> |
840 |
private async void AliveDataSelect() |
841 |
{ |
842 |
try |
843 |
{ |
844 |
List<DataConvert> newitems = new List<DataConvert>(); |
845 |
foreach (var client in App.StationClientList) |
846 |
{ |
847 |
if (await SimplePingAsync(client.Endpoint.Address.ToString())) |
848 |
{ |
849 |
try |
850 |
{ |
851 |
List<DataConvert> itemsToList = new List<DataConvert>(); |
852 |
var items = await client.AliveConvertListAsync(); |
853 |
string result = ""; |
854 |
|
855 |
foreach (var item in items) |
856 |
{ |
857 |
DataConvert itemsToEach = new DataConvert(); |
858 |
itemsToEach.ServiceID = item.ServiceID; |
859 |
itemsToEach.ConvertID = item.ConvertID; |
860 |
itemsToEach.ProjectNumber = item.ProjectNumber; |
861 |
|
862 |
var MarkusLink = "kcom://" + CreateMarkusParam(item.ProjectNumber, item.DocumentID, "doftech"); |
863 |
|
864 |
if (item.ConvertState != null) |
865 |
{ |
866 |
itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState); |
867 |
} |
868 |
|
869 |
if (item.OriginfilePath.Contains("/")) |
870 |
{ |
871 |
result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1); |
872 |
} |
873 |
else |
874 |
{ |
875 |
result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1); |
876 |
} |
877 |
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 |
itemsToEach.MarkusLink = MarkusLink; |
884 |
itemsToEach.UniqueKey = item.UniqueKey;//DocumentNO 없음 |
885 |
itemsToEach.GroupNo = item.GroupNo;//없음 |
886 |
//itemsToEach.ProcessorAffinity = item.ProcessorAffinity; |
887 |
itemsToEach.DocumentName = item.DocumnetName; |
888 |
itemsToEach.Revision = item.Revision; //없음 |
889 |
itemsToEach.Exception = item.Exception;//없음 |
890 |
itemsToEach.ConvertPath = item.ConvertPath; |
891 |
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 |
} |
899 |
newitems.AddRange(itemsToList); |
900 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping"); |
901 |
|
902 |
if (items.Count() == 0) |
903 |
{ |
904 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero."); |
905 |
} |
906 |
} |
907 |
catch (Exception ex) |
908 |
{ |
909 |
System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}"); |
910 |
} |
911 |
} |
912 |
else |
913 |
{ |
914 |
System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error"); |
915 |
} |
916 |
|
917 |
} |
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 |
} |
925 |
} |
926 |
|
927 |
/// <summary> |
928 |
/// AliveDataSelect의 Data Update |
929 |
/// </summary> |
930 |
/// <param name="newitems"></param> |
931 |
private void ItemsUpdate(List<DataConvert> newitems) |
932 |
{ |
933 |
|
934 |
foreach (var item in newitems) |
935 |
{ |
936 |
item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath); |
937 |
} |
938 |
|
939 |
if (AliveItems == null) |
940 |
{ |
941 |
AliveItems = new System.Collections.ObjectModel.ObservableCollection<DataConvert>(); |
942 |
|
943 |
foreach (var item in newitems) |
944 |
{ |
945 |
AliveItems.Add(item); |
946 |
} |
947 |
} |
948 |
else |
949 |
{ |
950 |
/// 데이터 업데이트 |
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 |
|
965 |
/// 삭제 |
966 |
|
967 |
for (int i = AliveItems.Count() - 1; i > -1; --i) |
968 |
{ |
969 |
var item = AliveItems[i]; |
970 |
|
971 |
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 |
} |
984 |
} |
985 |
|
986 |
|
987 |
public static async Task<bool> SimplePingAsync(string uri) |
988 |
{ |
989 |
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 |
} |
1019 |
|
1020 |
#endregion |
1021 |
|
1022 |
#region Data Convert |
1023 |
|
1024 |
private void DataConvert(object obj) |
1025 |
{ |
1026 |
if (SelectFilterConvert == null && SelectRealConvert == null) |
1027 |
{ |
1028 |
MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!"); |
1029 |
} |
1030 |
else |
1031 |
{ |
1032 |
var resultRealConvert = 0; |
1033 |
var resultFiltertConvert = 0; |
1034 |
|
1035 |
if (SelectRealConvert != null) |
1036 |
{ |
1037 |
resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase |
1038 |
} |
1039 |
else if (SelectFilterConvert != null) |
1040 |
{ |
1041 |
resultFiltertConvert = SetCleanUpItem(SelectFilterConvert); |
1042 |
} |
1043 |
System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
1044 |
|
1045 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
1046 |
{ |
1047 |
|
1048 |
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 |
|
1050 |
|
1051 |
foreach (var x in items) |
1052 |
{ |
1053 |
var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech"); |
1054 |
|
1055 |
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 |
, x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER); |
1057 |
|
1058 |
RealConvertSource.Add(AddItem); |
1059 |
|
1060 |
if (RealConvertSource.Count() == 1) |
1061 |
{ |
1062 |
ConvertShow = true; |
1063 |
} |
1064 |
} |
1065 |
|
1066 |
} |
1067 |
} |
1068 |
} |
1069 |
|
1070 |
|
1071 |
public int SetCleanUpItem(DataConvert _ConvertItem) |
1072 |
{ |
1073 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
1074 |
{ |
1075 |
int result = 0; |
1076 |
|
1077 |
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 |
|
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 |
|
1096 |
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 |
|
1119 |
#endregion |
1120 |
|
1121 |
#region Validation |
1122 |
|
1123 |
private void DataValidate(object obj) |
1124 |
{ |
1125 |
|
1126 |
bool result = false; |
1127 |
|
1128 |
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 |
{ |
1146 |
if (response != null) |
1147 |
{ |
1148 |
response.Close(); |
1149 |
} |
1150 |
} |
1151 |
if (result == true) |
1152 |
{ |
1153 |
MessageBox.Show("File exists"); |
1154 |
} |
1155 |
} |
1156 |
|
1157 |
#endregion |
1158 |
|
1159 |
#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 |
#region MarkusLink |
1170 |
|
1171 |
private void MarkusLink(object obj)///여기서 부터 |
1172 |
{ |
1173 |
if (obj is DataConvert) |
1174 |
{ |
1175 |
if (obj != null) |
1176 |
{ |
1177 |
var convertitem = obj as DataConvert; |
1178 |
|
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 |
#region Data Delete |
1195 |
|
1196 |
private void DataDelete(object obj) |
1197 |
{ |
1198 |
RadWindow.Alert("do you want to delete it??", this.OnClosed); |
1199 |
} |
1200 |
|
1201 |
private void OnClosed(object sender, WindowClosedEventArgs e) |
1202 |
{ |
1203 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
1204 |
{ |
1205 |
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 |
} |
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 |
{ |
1241 |
|
1242 |
|
1243 |
if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName)) |
1244 |
{ |
1245 |
|
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 |
} |
1273 |
} |
1274 |
} |
1275 |
|
1276 |
#endregion |
1277 |
|
1278 |
#region Data Search |
1279 |
|
1280 |
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 |
{ |
1298 |
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 |
DOCUMENT_URLFilter = null; |
1307 |
DefaultCreateTime = DateTime.Now; |
1308 |
SelectedCreateTimeBegin = DefaultCreateTime; |
1309 |
SelectedCreateTimeEnd = DefaultCreateTime; |
1310 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1311 |
} |
1312 |
|
1313 |
#endregion |
1314 |
|
1315 |
#region ConvertAddDialog |
1316 |
|
1317 |
/// <summary> |
1318 |
/// 그리드 상단 Conver 추가 버튼 |
1319 |
/// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 |
1320 |
/// </summary> |
1321 |
|
1322 |
public void ConverAdd(object obj) |
1323 |
{ |
1324 |
dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
1325 |
|
1326 |
Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog(); |
1327 |
|
1328 |
convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; |
1329 |
|
1330 |
convertAddDialog.ShowDialog(); |
1331 |
|
1332 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1333 |
} |
1334 |
|
1335 |
#endregion |
1336 |
|
1337 |
|
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 |
#endregion |
1369 |
} |
1370 |
} |
1371 |
|