프로젝트

일반

사용자정보

개정판 037ab674

ID037ab6741cc8e731844afcd800a78c322fc38de3
상위 6927ec82
하위 19d6b221

semi 이(가) 약 5년 전에 추가함

WCF 변경

Change-Id: Iac482667ce5ff20c3acee80186ef2356928bc6da

차이점 보기:

ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseItemsModel.cs
46 46
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
47 47
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
48 48
            ResetCommand = new DelegateCommand(Reset);
49
            ConverAddCommand = new DelegateCommand(ConverAdd);
49
            ConvertAddCommand = new DelegateCommand(ConvertAdd);
50 50
            ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch);
51 51
        }
52 52

  
......
54 54

  
55 55
        #region Properties
56 56

  
57
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
58

  
57 59
        public ObservableCollection<ProjectName> _ProjectNames;
58 60
        public ObservableCollection<ProjectName> ProjectNames
59 61
        {
......
73 75
            }
74 76
        }
75 77

  
78
        private bool _ExcptionCheck = false;
79
        public bool ExcptionCheck
80
        {
81
            get
82
            {
83
                return _ExcptionCheck;
84
            }
85
            set
86
            {
87
                _ExcptionCheck = value;
88
                OnPropertyChanged(() => ExcptionCheck);
89
            }
90
        }
91

  
76 92
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterSearch;
77 93
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterSearch
78 94
        {
......
110 126
            }
111 127
        }
112 128

  
129
        private static System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _ConvertSource;
130
        public static System.Collections.ObjectModel.ObservableCollection<ConvertPDF> ConvertSource
131
        {
132
            get
133
            {
134
                if (_ConvertSource == null)
135
                {
136
                    _ConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
137
                }
138
                return _ConvertSource;
139
            }
140
            set
141
            {
142
                _ConvertSource = value;
143
            }
144
        }
145

  
113 146
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterConvertSource;
114 147
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterConvertSource
115 148
        {
......
124 157
            set
125 158
            {
126 159
                _FilterConvertSource = value;
127
                OnPropertyChanged(() => FilterConvertSource);
160
               OnPropertyChanged(() => FilterConvertSource);
128 161
            }
129 162
        }
130 163

  
131

  
132 164
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _RealConvertSource;
133 165
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> RealConvertSource
134 166
        {
......
156 188
        }
157 189

  
158 190

  
191
        private int _SelectedInt = 4;
192
        public int SelectedInt
193
        {
194
            get => _SelectedInt;
195
            set
196
            {
197
                _SelectedInt = value;
198
                OnPropertyChanged(() => SelectedInt);
199
            }
200
        }
201

  
159 202
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
160 203
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
161 204
        {
......
535 578

  
536 579
        public DelegateCommand DataFilterCommand { get; private set; }
537 580
        public DelegateCommand ResetCommand { get; private set; }
538
        public DelegateCommand ConverAddCommand { get; private set; }
581
        public DelegateCommand ConvertAddCommand { get; private set; }
539 582
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
540 583

  
541 584
        #endregion
......
575 618
            }
576 619

  
577 620
            await Task.Delay(5000);
578
            //await Task.Delay(10000);
579 621

  
580
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
622
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
581 623

  
582 624
            dispatcherTimer.Start();
583 625
        }
......
621 663

  
622 664
        #region Function
623 665

  
666
        #region Return_FilterConvertSource
667

  
668
        public static void Return_FilterConvertSource(ObservableCollection<ConvertPDF> convertPDFs)
669
        {
670
            ConvertSource = new ObservableCollection<ConvertPDF>();
671
            ConvertSource = convertPDFs;
672
        }
673

  
674
        public static ObservableCollection<ConvertPDF> Return_FilterConvertSource()
675
        {
676
            return ConvertSource;
677
        }
678

  
679
        #endregion
680

  
681

  
624 682
        #region Data Select
625 683

  
626 684
        /// <summary>
......
651 709

  
652 710
        }
653 711

  
654
        private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
712
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
655 713
        {
656 714
            try
657 715
            {
658
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
659
                {
660
                    List<ConvertPDF> Listitems = new List<ConvertPDF>();
716
                IEnumerable<ConvertPDF> Listitems = Enumerable.Empty<ConvertPDF>();
661 717

  
662
                    foreach (var coll in collection)
663
                    {
664
                        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();
665

  
666
                        foreach (var x in items)
667
                        {
668
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
669

  
670
                            ConvertPDF AddItem = new ConvertPDF(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,
671
                                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);
672
                            Listitems.Add(AddItem);
673

  
674
                        }
675
                    }
676

  
677
                    Listitems.ForEach(newitem =>
678
                    {
679
                        collection.UpdateWhere(changeitem =>
680
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
681
                    });
718
                foreach (var coll in collection)
719
                {
720
                   Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(coll.ConvertID, coll.ProjectNumber, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
721
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
722
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
723
                            num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
724
                }
682 725

  
726
                foreach (var Listitem in Listitems)
727
                {
728
                    collection.UpdateWhere(changeitem =>
729
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
683 730
                }
684 731
            }
685 732
            catch (Exception ex)
......
688 735
            }
689 736
        }
690 737

  
691
        private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
738
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
692 739
        {
693 740
            try
694 741
            {
695
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
742
                int _status = 0;
743
                if (SelectedStatus != null)
696 744
                {
745
                    _status = (int)SelectedStatus.Value;
746
                }
697 747

  
698
                    int _status = 0;
699
                    if (SelectedStatus != null)
748
                if (ProjectNames.Count() == 0)
749
                {
750
                    ProjectName Clear = new ProjectName("Clear", "Clear");
751
                    ProjectNames.Add(Clear);
752
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
700 753
                    {
701
                        _status = (int)SelectedStatus.Value;
754
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
755
                        ProjectNames.Add(projectName);
702 756
                    }
757
                }
758

  
759
                var Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
760
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
761
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
762
           num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
703 763

  
704
                    if (ProjectNames.Count() == 0)
764
                if (collection.Count() == 0)
765
                {
766
                    if (statusCodeTypeList.Count() == 1)
705 767
                    {
706
                        foreach (var x in entities.SELECT_RUN_PROJECTS(0))
768
                        //Listitems.ForEach(x => collection.Add(x));
769
                        foreach (var Listitem in Listitems.ToList())
707 770
                        {
708
                            ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
709
                            ProjectNames.Add(projectName);
771
                            collection.Add(Listitem);
710 772
                        }
711 773
                    }
712

  
713
                    var Listitems = from num in entities.SELECT_CONVERT_ITEM(null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null, null, null, null).ToList()
714
                                                 let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
715
                                                 select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
716
                            num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
717

  
718
                    if (collection.Count() == 0)
774
                }
775
                else
776
                {
777
                    foreach (var Listitem in Listitems)
719 778
                    {
720
                        if (statusCodeTypeList.Count() == 1)
721
                        {
722
                            //Listitems.ForEach(x => collection.Add(x));
723
                            foreach(var Listitem in Listitems.ToList())
724
                            {
725
                                collection.Add(Listitem);
726
                            }
727
                        }
779
                        collection.UpdateWhere(changeitem =>
780
                        ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
728 781
                    }
729
                    else
782
                    if (statusCodeTypeList.Count() == 1)
730 783
                    {
731

  
732
                        ////세미 업데이트
733
                        //Listitems.ForEach(newitem =>
734
                        //{
735
                        //    collection.UpdateWhere(changeitem =>
736
                        //    ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
737
                        //});
738
                        foreach (var Listitem in Listitems)
784
                        for (int i = collection.Count() - 1; i >= 0; --i)
739 785
                        {
740
                            collection.UpdateWhere(changeitem =>
741
                            ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
742
                        }
743
                        if (statusCodeTypeList.Count() == 1)
744
                        {
745
                            //삭제
746
                            for (int i = collection.Count() - 1; i >= 0; --i)
747
                            {
748
                                var item = collection[i];
786
                            var item = collection[i];
749 787

  
750
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
751
                                {//참=> 0제외한 모든 수
752
                                    collection.RemoveAt(i);
753
                                }
788
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
789
                            {
790
                                collection.RemoveAt(i);
754 791
                            }
755 792
                        }
793
                    }
756 794

  
757
                        if (statusCodeTypeList.Count() == 1)
795
                    if (statusCodeTypeList.Count() == 1)
796
                    {
797
                        foreach (var item in Listitems)
758 798
                        {
759
                            //추가 convert 후 추가됨
760
                            foreach (var item in Listitems)
799
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
761 800
                            {
762
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감
801
                                for (int i = 0; i < 200; i++)
763 802
                                {
764
                                    /*for (int i = 0; i < collection.Count()+1; i++)//위 그리드에서 카운드 개수 변함 없고 컨버터 끝난 후 추가할때 createtime 비교 하며 order by 순으로 추가*/
765
                                    for (int i = 0; i < 200; i++)
803
                                    if (i < collection.Count() - 1)
766 804
                                    {
767
                                        if (i < collection.Count() - 1)
805
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
768 806
                                        {
769
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
770
                                            {
771
                                                collection.Insert(i, item);
772
                                                break;
773
                                            }
774
                                        }
775
                                        else
776
                                        {
777
                                            collection.Add(item);
807
                                            collection.Insert(i, item);
778 808
                                            break;
779 809
                                        }
780 810
                                    }
781

  
811
                                    else
812
                                    {
813
                                        collection.Add(item);
814
                                        break;
815
                                    }
782 816
                                }
783 817

  
784 818
                            }
785
                        }
786 819

  
820
                        }
787 821
                    }
788 822
                }
789

  
790 823
            }
791 824
            catch (Exception ex)
792 825
            {
......
795 828
            }
796 829
        }
797 830

  
798
        private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
831
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
799 832
        {
800 833
            try
801 834
            {
802
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
835
                int _status = 0;
836
                if (SelectedStatus != null)
803 837
                {
804
                    int _status = 0;
805
                    if (SelectedStatus != null)
806
                    {
807
                        _status = (int)SelectedStatus.Value;
808
                    }
838
                    _status = (int)SelectedStatus.Value;
839
                }
809 840

  
810
                    //DocumentID = unikey
811
                    DateTime? Start_CreateTime = null;
812
                    DateTime? Finish_CreateTime = null;
813
                    if (SelectedCreateTimeBegin != DefaultCreateTime)
814
                    {
815
                        Start_CreateTime = SelectedCreateTimeBegin;
816
                    }
817
                    if (SelectedCreateTimeEnd != DefaultCreateTime)
818
                    {
819
                        Finish_CreateTime = SelectedCreateTimeEnd;
820
                    }
841
                //DocumentID = unikey
842
                DateTime? Start_CreateTime = null;
843
                DateTime? Finish_CreateTime = null;
844
                if (SelectedCreateTimeBegin != DefaultCreateTime)
845
                {
846
                    Start_CreateTime = SelectedCreateTimeBegin;
847
                }
848
                if (SelectedCreateTimeEnd != DefaultCreateTime)
849
                {
850
                    Finish_CreateTime = SelectedCreateTimeEnd;
851
                }
821 852

  
822
                    if (ProjectNames.Count() == 0)
853
                if (ProjectNames.Count() == 0)
854
                {
855
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
823 856
                    {
824
                        foreach (var x in entities.SELECT_RUN_PROJECTS(0))
825
                        {
826
                            ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
827
                            ProjectNames.Add(projectName);
828
                        }
857
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
858
                        ProjectNames.Add(projectName);
829 859
                    }
860
                }
861
                
830 862

  
831
                    var Listitems = from num in entities.SELECT_CONVERT_ITEM(null, ProjectNumberFilter.Project_NO, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
832
                null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter).ToList()
833
                                    let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
834
                                    select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
835
               num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
863
                var Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(null, ProjectNumberFilter.Project_NO, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
864
            null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter, ExcptionCheck)
865
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
866
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
867
           num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
836 868

  
837
                    if (collection.Count() == 0)
869
                if (collection.Count() == 0)
870
                {
871
                    if (statusCodeTypeList.Count() == 1)
838 872
                    {
839
                        if (statusCodeTypeList.Count() == 1)
873
                        foreach (var x in Listitems)
840 874
                        {
841
                            foreach (var x in Listitems)
842
                            {
843
                                collection.Add(x);
844
                            }
875
                            collection.Add(x);
845 876
                        }
846 877
                    }
847
                    else
878
                }
879
                else
880
                {
881

  
882
                    ////세미 업데이트
883
                    foreach (var newitem in Listitems)
848 884
                    {
885
                        collection.UpdateWhere(changeitem =>
886
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
887
                    }
849 888

  
850
                        ////세미 업데이트
851
                        foreach (var newitem in Listitems)
852
                        {
853
                            collection.UpdateWhere(changeitem =>
854
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
855
                        }
856 889

  
890
                    if (statusCodeTypeList.Count() == 1)
891
                    {
857 892

  
858
                        if (statusCodeTypeList.Count() == 1)
893
                        //삭제
894
                        for (int i = collection.Count() - 1; i >= 0; --i)
859 895
                        {
896
                            var item = collection[i];
860 897

  
861
                            //삭제
862
                            for (int i = collection.Count() - 1; i >= 0; --i)
898
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
863 899
                            {
864
                                var item = collection[i];
865

  
866
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
867
                                {
868
                                    collection.RemoveAt(i);
869
                                }
900
                                collection.RemoveAt(i);
870 901
                            }
871 902
                        }
903
                    }
872 904

  
873
                        if (statusCodeTypeList.Count() == 1)
905
                    if (statusCodeTypeList.Count() == 1)
906
                    {
907
                        //추가 convert 후 추가됨
908
                        foreach (var item in Listitems)
874 909
                        {
875
                            //추가 convert 후 추가됨
876
                            foreach (var item in Listitems)
910
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
877 911
                            {
878
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
912
                                for (int i = 0; i < 200; i++)
879 913
                                {
880
                                    for (int i = 0; i < 200; i++)
914
                                    if (i < collection.Count() - 1)
881 915
                                    {
882
                                        if (i < collection.Count() - 1)
883
                                        {
884
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
885
                                            {
886
                                                collection.Insert(i, item);
887
                                                break;
888
                                            }
889
                                        }
890
                                        else
916
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
891 917
                                        {
892
                                            collection.Add(item);
918
                                            collection.Insert(i, item);
893 919
                                            break;
894 920
                                        }
895 921
                                    }
896

  
922
                                    else
923
                                    {
924
                                        collection.Add(item);
925
                                        break;
926
                                    }
897 927
                                }
898

  
899 928
                            }
900 929
                        }
901

  
902 930
                    }
903

  
904 931
                }
905

  
906 932
            }
907 933
            catch (Exception ex)
908 934
            {
......
1097 1123

  
1098 1124
        #region Data Convert
1099 1125

  
1100
        private void DataConvert(object obj)
1126
        private async void DataConvert(object obj)
1101 1127
        {
1102 1128
            if (SelectFilterConvertList == null)
1103 1129
            {
......
1109 1135
                var resultFiltertConvert = 0;
1110 1136
                if (SelectRealConvert != null)
1111 1137
                {
1112
                    resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1138
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;//ConvertDataBase
1113 1139
                }
1114 1140
                if (SelectFilterConvertList != null)
1115 1141
                {
1116 1142
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1117 1143
                    {
1118
                        resultFiltertConvert = SetCleanUpItem(SelectFilterConvert);
1144
                        resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1119 1145
                    }
1120 1146
                }
1121 1147
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1122 1148

  
1123
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1124
                {
1125
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1126
                    {
1127
                        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); //프로시저 이용
1128 1149

  
1129 1150

  
1130
                        foreach (var x in items)
1131
                        {
1132
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
1151
                foreach (var SelectFilterConvert in SelectFilterConvertList)
1152
                {
1133 1153

  
1134
                            ConvertPDF AddItem = new ConvertPDF(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
1135
                                 , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1154
                    var items = from x in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(SelectFilterConvert.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
1155
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
1156
                                select new ConvertPDF(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
1157
                             , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1136 1158

  
1137
                            RealConvertSource.Add(AddItem);
1159
                    foreach (var item in items)
1160
                    {
1161
                        RealConvertSource.Add(item);
1138 1162

  
1139
                            if (RealConvertSource.Count() == 1)
1140
                            {
1141
                                ConvertShow = true;
1142
                            }
1163
                        if (RealConvertSource.Count() == 1)
1164
                        {
1165
                            ConvertShow = true;
1143 1166
                        }
1144 1167
                    }
1145

  
1146 1168
                }
1147

  
1148 1169
            }
1149 1170
        }
1150 1171

  
1151 1172

  
1152
        public int SetCleanUpItem(ConvertPDF _ConvertItem)
1173
        public async Task<int> SetCleanUpItem(ConvertPDF _ConvertItem)
1153 1174
        {
1154
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1155
            {
1156
                int result = 0;
1157

  
1158
                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();
1175
            int result = 0;
1159 1176

  
1160
                if (items.Count() > 0)
1161
                {
1162
                    var item = items.First();
1177
            var items = await WcfClient.GET_SELECT_CONVERT_ITEMAsync(_ConvertItem.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
1163 1178

  
1164
                    var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1165
                    var _CREATE_DATETIME = DateTime.Now;
1166
                    var _STATUS = (int)StatusCodeType.None;
1179
            if (items.Count() > 0)
1180
            {
1181
                var item = items.First();
1167 1182

  
1168
                    entities.SELECT_RERECONVERT_ITEM(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1183
                var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1184
                var _CREATE_DATETIME = DateTime.Now;
1185
                var _STATUS = (int)StatusCodeType.None;
1169 1186

  
1170
                }
1171

  
1172
                return result;
1187
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1173 1188
            }
1189
            return result;
1174 1190
        }
1175 1191

  
1176 1192

  
......
1287 1303
            RadWindow.Alert("Do you want to delete it??", this.OnClosed);
1288 1304
        }
1289 1305

  
1290
        private void OnClosed(object sender, WindowClosedEventArgs e)
1306
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1291 1307
        {
1292
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1293 1308
            {
1294 1309
                var result = e.DialogResult;
1295 1310
                if (result == true)
......
1302 1317
                    {
1303 1318
                        if (SelectRealConvert != null)
1304 1319
                        {
1305
                            entities.SELECT_CONVERT_DELETE(SelectRealConvert.ConvertID);
1320
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1306 1321
                        }
1307 1322
                        if (SelectFilterConvertList != null)
1308 1323
                        {
1309
                            entities.SELECT_CONVERT_DELETE(SelectFilterConvertList[0].ConvertID);
1324
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1310 1325
                        }
1311 1326
                    }
1312 1327
                }
1313 1328
            }
1314 1329
        }
1315

  
1316

  
1317 1330
        #endregion
1318 1331

  
1319 1332
        #region Data Export
......
1325 1338

  
1326 1339
        public void DataExportData(object obj)
1327 1340
        {
1328
            SaveFileDialog saveFileDialog = new SaveFileDialog();
1329

  
1330
            saveFileDialog.FileName = "Document"; // Default file name
1331
            saveFileDialog.DefaultExt = ".txt"; // Default file extension
1332
            saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1341
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1333 1342

  
1343
            Return_FilterConvertSource(FilterConvertSource);
1334 1344

  
1335
            if (saveFileDialog.ShowDialog() == true)
1336
            {
1345
            Views.ConvertExcelDialog convertExcelDialog = new Views.ConvertExcelDialog();
1337 1346

  
1347
            convertExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1338 1348

  
1339
                if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName))
1340
                {
1349
            convertExcelDialog.ShowDialog();
1341 1350

  
1342
                    var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension;
1343

  
1344
                    if (extension == ".xlsx" || extension == ".csv")
1345
                    {
1346 1351

  
1347
                        var headers = new List<HeaderMember>
1348
                        {
1349
                            new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" },
1350
                            new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" },
1351
                            new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" },
1352
                            new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" },
1353
                            new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" },
1354
                            new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" },
1355
                            new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" },
1356
                            new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" },
1357
                            new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" },
1358
                            new HeaderMember{HeaderName = "Exception", Property = "Exception" },
1359
                            new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" },
1360
                            new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" },
1361
                            new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" }
1362
                        };
1363

  
1364

  
1365
                        DataExport dataExport = new DataExport();
1366
                        dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers);
1367
                    }
1368
                }
1369
            }
1352
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1370 1353
        }
1371 1354

  
1372 1355
        #endregion
......
1391 1374

  
1392 1375
        public void Reset(object obj)
1393 1376
        {
1394
            ProjectNumberFilter= null;
1377
            SelectedInt = 10;
1378
            ProjectNumberFilter = ProjectNames[0];
1395 1379
            UniqueKeyFilter = null;
1396 1380
            Service_IDFilter = null;
1397 1381
            Document_NameFilter = null;
......
1405 1389
            SelectedCreateTimeEnd = DefaultCreateTime;
1406 1390
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1407 1391
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1408
            ProjectNames.Clear();
1409
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1410
            {
1411
                foreach (var x in entities.SELECT_RUN_PROJECTS(0))
1412
                {
1413
                    ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
1414
                    ProjectNames.Add(projectName);
1415
                }
1416
            }
1417 1392
        }
1418 1393

  
1419 1394
        #endregion
......
1425 1400
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1426 1401
        /// </summary>
1427 1402

  
1428
        public void ConverAdd(object obj)
1403
        public void ConvertAdd(object obj)
1429 1404
        {
1430 1405
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1431 1406

  
......
1468 1443
        #endregion
1469 1444
    }
1470 1445
}
1471

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)