프로젝트

일반

사용자정보

개정판 3bde451b

ID3bde451b422200cd73fd780e9fdbaa7768afaead
상위 7b095cc3
하위 504c5aa1, 2c634aed

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

FINALPDF와 CONVERT_DOC 저장 프로시저로 변경

Change-Id: I832b4103112d7b9968f573688378b779a9df2db8

차이점 보기:

ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseItemsModel.cs
23 23
using Markus.Mvvm.ToolKit;
24 24
using System.Windows.Data;
25 25
using System.Windows.Controls;
26
using System.IO;
26 27

  
27 28
namespace Markus.Service.StationController.ViewModel
28 29
{
......
322 323
            }
323 324
        }
324 325

  
325
        public string _Docuemnt_NameFilter;
326
        public string Docuemnt_NameFilter
326
        public string _Document_NameFilter;
327
        public string Document_NameFilter
327 328
        {
328
            get { return _Docuemnt_NameFilter; }
329
            get { return _Document_NameFilter; }
329 330
            set
330 331
            {
331
                if (_Docuemnt_NameFilter == "")
332
                if (_Document_NameFilter == "")
332 333
                {
333
                    _Docuemnt_NameFilter = null;
334
                    _Document_NameFilter = null;
334 335
                }
335
                else if (_Docuemnt_NameFilter != value)
336
                else if (_Document_NameFilter != value)
336 337
                {
337
                    _Docuemnt_NameFilter = value;
338
                    OnPropertyChanged(() => Docuemnt_NameFilter);
338
                    _Document_NameFilter = value;
339
                    OnPropertyChanged(() => Document_NameFilter);
339 340
                }
340 341
            }
341 342
        }
......
598 599
        {
599 600
            try
600 601
            {
601
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
602
                using (markusEntities entities = new markusEntities())
602 603
                {
603
                    var items = database.GetConvertProjects(collection)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
604
                                          .Take(SelectedCount.ValueMember).ToList();//
604
                    List<ConvertItem> Listitems = new List<ConvertItem>();
605 605

  
606
                    items.ForEach(newitem =>
606
                    foreach (var coll in collection)
607
                    {
608
                        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).ToList();
609

  
610
                        foreach (var x in items)
611
                        {
612
                            var convertpath = GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
613

  
614
                            ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE,
615
                                x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.DOCUMENT_URL, convertpath[0], convertpath[1], x.RECONVERTER);
616
                            Listitems.Add(AddItem);
617
 
618
                        }
619
                    }
620

  
621
                    Listitems.ForEach(newitem =>
607 622
                    {
608 623
                        collection.UpdateWhere(changeitem =>
609 624
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
......
612 627
                    RealConvert_Height = 80 + (10 * collection.Count());
613 628
                    DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
614 629
                }
630
                //using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
631
                //{
632
                //    var items = database.GetConvertProjects(collection)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
633
                //                          .Take(SelectedCount.ValueMember).ToList();//
634

  
635
                //    items.ForEach(newitem =>
636
                //    {
637
                //        collection.UpdateWhere(changeitem =>
638
                //        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
639
                //    });
640

  
641
                //    RealConvert_Height = 80 + (10 * collection.Count());
642
                //    DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
643
                //}
615 644
            }
616 645
            catch (Exception ex)
617 646
            {
......
623 652
        {
624 653
            try
625 654
            {
626
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
655
                using (markusEntities entities = new markusEntities())
627 656
                {
628 657

  
629 658
                    int _status = 0;
......
632 661
                        _status = (int)SelectedStatus.Value;
633 662
                    }
634 663

  
664
                    var items = entities.SELECT_CONVERT_ITEM(null, null, null, _status, SelectedCount.ValueMember, null, null, null,
665
                        null, null, null, null, null, null, null, null, null).ToList();
666
                    //var items = database.GetConvertProjects(_status, ProjectNumberFilter, UniqueKeyFilter, Document_NameFilter, Service_IDFilter, Docuemnt_NOFilter
667
                    //    , ReconverterFilter, RevisionFilter)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
668
                    //                      .Take(SelectedCount.ValueMember).ToList();
635 669

  
636
                    var items = database.GetConvertProjects(_status, ProjectNumberFilter, UniqueKeyFilter, Docuemnt_NameFilter, Service_IDFilter, Docuemnt_NOFilter
637
                        , ReconverterFilter, RevisionFilter)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
638
                                          .Take(SelectedCount.ValueMember).ToList();
670
                    List<ConvertItem> Listitems = new List<ConvertItem>();
671

  
672
                    foreach (var x in items)
673
                    {
674
                        var convertpath = GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
675

  
676
                        ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE,
677
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.DOCUMENT_URL, convertpath[0], convertpath[1], x.RECONVERTER);
678
                        Listitems.Add(AddItem);
679

  
680
                    }
639 681

  
640 682
                    if (collection.Count() == 0)
641 683
                    {
642 684
                        if (statusCodeTypeList.Count() == 1)
643 685
                        {
644
                            items.ForEach(x => collection.Add(x));
686
                            Listitems.ForEach(x => collection.Add(x));
645 687
                        }
646 688
                    }
647 689
                    else
648 690
                    {
649 691

  
650 692
                        ////세미 업데이트
651
                        items.ForEach(newitem =>
693
                        Listitems.ForEach(newitem =>
652 694
                        {
653 695
                            collection.UpdateWhere(changeitem =>
654 696
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
......
661 703
                            {
662 704
                                var item = collection[i];
663 705

  
664
                                if (items.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
706
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
665 707
                                {//참=> 0제외한 모든 수
666 708
                                    collection.RemoveAt(i);
667 709
                                }
......
671 713
                        if (statusCodeTypeList.Count() == 1)
672 714
                        {
673 715
                            //추가 convert 후 추가됨
674
                            foreach (var item in items)
716
                            foreach (var item in Listitems)
675 717
                            {
676 718
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감
677 719
                                {
......
713 755
        {
714 756
            try
715 757
            {
716
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
758
                using (markusEntities entities = new markusEntities())
717 759
                {
718
                    using (markusEntities entities = new markusEntities())
760
                    int _status = 0;
761
                    if (SelectedStatus != null)
719 762
                    {
763
                        _status = (int)SelectedStatus.Value;
764
                    }
720 765

  
766
                    //DocumentID = unikey
767
                    DateTime? Start_CreateTime = null;
768
                    DateTime? Finish_CreateTime = null;
769
                    if(SelectedCreateTimeBegin != DefaultCreateTime)
770
                    {
771
                        Start_CreateTime = SelectedCreateTimeBegin;
772
                    }
773
                    if(SelectedCreateTimeEnd != DefaultCreateTime)
774
                    {
775
                        Finish_CreateTime = SelectedCreateTimeEnd;
776
                    }
721 777

  
722
                        int _status = 0;
723
                        if (SelectedStatus != null)
724
                        {
725
                            _status = (int)SelectedStatus.Value;
726
                        }
727

  
728
                        //DocumentID = unikey
729

  
730
                        var items = entities.SELECT_CONVERT_ITEM(ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, SelectedCreateTimeBegin, SelectedCreateTimeEnd, null, null, null, null, GroupNOFilter,
731
                            Docuemnt_NameFilter, Docuemnt_NOFilter, RevisionFilter).ToList();
778
                    var items = entities.SELECT_CONVERT_ITEM(null, ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
779
                        null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter).ToList();
732 780

  
733
                        //SEARCH 할때 최소한 프로젝트 넘버랑 유니크키(다큐먼트 넘버) 크레이트타임 시작 줘야함
781
                    List<ConvertItem> Listitems = new List<ConvertItem>();
734 782

  
735
                        List<ConvertItem> Listitems = new List<ConvertItem>();
783
                    foreach (var x in items)
784
                    {
785
                        var convertpath = GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
736 786

  
737
                        foreach (var x in items)
738
                        {
739
                            var convertpath = database.GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
787
                        ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE,
788
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.DOCUMENT_URL, convertpath[0], convertpath[1], x.RECONVERTER);
789
                        Listitems.Add(AddItem);
740 790

  
741
                            ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
742
                             , x.DOCUMENT_URL, convertpath[0], convertpath[1]);
743
                            Listitems.Add(AddItem);
744
                            //이거 없으면 collection.Insert(i, item); 할때 문제 생김
745
                        }
791
                    }
746 792

  
747
                        if (collection.Count() == 0)
793
                    if (collection.Count() == 0)
794
                    {
795
                        if (statusCodeTypeList.Count() == 1)
748 796
                        {
749
                            if (statusCodeTypeList.Count() == 1)
797
                            foreach (var x in Listitems)
750 798
                            {
751
                                foreach (var x in Listitems)
752
                                {
753
                                    collection.Add(x);
754
                                }
799
                                collection.Add(x);
755 800
                            }
756 801
                        }
757
                        else
802
                    }
803
                    else
804
                    {
805

  
806
                        ////세미 업데이트
807
                        foreach (var newitem in Listitems)
758 808
                        {
809
                            collection.UpdateWhere(changeitem =>
810
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
811
                        }
759 812

  
760
                            ////세미 업데이트
761
                            foreach (var newitem in Listitems)
762
                            {
763
                                collection.UpdateWhere(changeitem =>
764
                                ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
765
                            }
766 813

  
814
                        if (statusCodeTypeList.Count() == 1)
815
                        {
767 816

  
768
                            if (statusCodeTypeList.Count() == 1)
817
                            //삭제
818
                            for (int i = collection.Count() - 1; i >= 0; --i)
769 819
                            {
820
                                var item = collection[i];
770 821

  
771
                                //삭제
772
                                for (int i = collection.Count() - 1; i >= 0; --i)
822
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
773 823
                                {
774
                                    var item = collection[i];
775

  
776
                                    if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
777
                                    {
778
                                        collection.RemoveAt(i);
779
                                    }
824
                                    collection.RemoveAt(i);
780 825
                                }
781 826
                            }
827
                        }
782 828

  
783
                            if (statusCodeTypeList.Count() == 1)
829
                        if (statusCodeTypeList.Count() == 1)
830
                        {
831
                            //추가 convert 후 추가됨
832
                            foreach (var item in Listitems)
784 833
                            {
785
                                //추가 convert 후 추가됨
786
                                foreach (var item in Listitems)
834
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
787 835
                                {
788
                                    if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
836
                                    for (int i = 0; i < 200; i++)
789 837
                                    {
790
                                        for (int i = 0; i < 200; i++)
838
                                        if (i < collection.Count() - 1)
791 839
                                        {
792
                                            if (i < collection.Count() - 1)
793
                                            {
794
                                                if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
795
                                                {
796
                                                    collection.Insert(i, item);
797
                                                    break;
798
                                                }
799
                                            }
800
                                            else
840
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
801 841
                                            {
802
                                                collection.Add(item);
842
                                                collection.Insert(i, item);
803 843
                                                break;
804 844
                                            }
805 845
                                        }
806

  
846
                                        else
847
                                        {
848
                                            collection.Add(item);
849
                                            break;
850
                                        }
807 851
                                    }
808 852

  
809 853
                                }
810
                            }
811 854

  
855
                            }
812 856
                        }
857

  
813 858
                    }
859

  
814 860
                }
815 861

  
816 862
            }
......
828 874
            try
829 875
            {
830 876
                List<ConvertItem> newitems = new List<ConvertItem>();
831
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
877
                foreach (var client in App.StationClientList)
832 878
                {
833
                    foreach (var client in App.StationClientList)
879
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
834 880
                    {
835
                        if (await SimplePingAsync(client.Endpoint.Address.ToString()))
881
                        try
836 882
                        {
837
                            try
838
                            {
839
                                List<ConvertItem> itemsToList = new List<ConvertItem>();
840
                                var items = await client.AliveConvertListAsync();
841
                                string result = "";
842

  
843
                                foreach (var item in items)
844
                                {
845
                                    ConvertItem itemsToEach = new ConvertItem();
846
                                    itemsToEach.ServiceID = item.ServiceID;
847
                                    itemsToEach.ConvertID = item.ConvertID;
848
                                    itemsToEach.ProjectNumber = item.ProjectNumber;
883
                            List<ConvertItem> itemsToList = new List<ConvertItem>();
884
                            var items = await client.AliveConvertListAsync();
885
                            string result = "";
849 886

  
850
                                    var convertpath = database.GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
887
                            foreach (var item in items)
888
                            {
889
                                ConvertItem itemsToEach = new ConvertItem();
890
                                itemsToEach.ServiceID = item.ServiceID;
891
                                itemsToEach.ConvertID = item.ConvertID;
892
                                itemsToEach.ProjectNumber = item.ProjectNumber;
851 893

  
852
                                    if (item.ConvertState != null)
853
                                    {
854
                                        itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
855
                                    }
894
                                var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
856 895

  
857
                                    if (item.OriginfilePath.Contains("/"))
858
                                    {
859
                                        result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
860
                                    }
861
                                    else
862
                                    {
863
                                        result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
864
                                    }
865
                                    itemsToEach.FileName = result;
866

  
867
                                    itemsToEach.CurrentPageNo = item.CurrentPageNo;
868
                                    itemsToEach.TotalPage = item.TotalPage;
869
                                    itemsToEach.OriginfilePath = item.OriginfilePath;
870
                                    itemsToEach.ConvertPath = item.ConvertPath;
871
                                    itemsToEach.MarkusLink = convertpath[1];
872
                                    itemsToEach.UniqueKey = item.UniqueKey;
873
                                    itemsToEach.GroupNo = item.GroupNo;
874
                                    itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
875
                                    itemsToEach.DocumnetName = item.DocumnetName;
876
                                    itemsToEach.Revision = item.Revision;
877
                                    itemsToEach.Exception = item.Exception;
878
                                    itemsToEach.ConvertPath = convertpath[0];
879
                                    itemsToEach.CreateTime = item.CreateTime;
880
                                    itemsToEach.ReConverter = item.ReConverter;
881
                                    itemsToEach.DocumentID = item.DocumentID;
882
                                    itemsToEach.StartTime = item.StartTime;
883
                                    itemsToEach.EndTime = item.EndTime;
884

  
885
                                    itemsToList.Add(itemsToEach);
896
                                if (item.ConvertState != null)
897
                                {
898
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
886 899
                                }
887
                                newitems.AddRange(itemsToList);
888
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
889 900

  
890
                                if (items.Count() == 0)
901
                                if (item.OriginfilePath.Contains("/"))
902
                                {
903
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
904
                                }
905
                                else
891 906
                                {
892
                                    System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
907
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
893 908
                                }
909
                                itemsToEach.FileName = result;
910

  
911
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
912
                                itemsToEach.TotalPage = item.TotalPage;
913
                                itemsToEach.OriginfilePath = item.OriginfilePath;
914
                                itemsToEach.ConvertPath = item.ConvertPath;
915
                                itemsToEach.MarkusLink = convertpath[1];
916
                                itemsToEach.UniqueKey = item.UniqueKey;//DocumentNO 없음
917
                                itemsToEach.GroupNo = item.GroupNo;//없음 
918
                                itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
919
                                itemsToEach.DocumnetName = item.DocumnetName;
920
                                itemsToEach.Revision = item.Revision;//없음
921
                                itemsToEach.Exception = item.Exception;//없음
922
                                itemsToEach.ConvertPath = convertpath[0];
923
                                itemsToEach.CreateTime = item.CreateTime;
924
                                itemsToEach.ReConverter = item.ReConverter;
925
                                itemsToEach.DocumentID = item.DocumentID;
926
                                itemsToEach.StartTime = item.StartTime;
927
                                itemsToEach.EndTime = item.EndTime;
928

  
929
                                itemsToList.Add(itemsToEach);
894 930
                            }
895
                            catch (Exception ex)
931
                            newitems.AddRange(itemsToList);
932
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
933

  
934
                            if (items.Count() == 0)
896 935
                            {
897
                                System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
936
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
898 937
                            }
899 938
                        }
900
                        else
939
                        catch (Exception ex)
901 940
                        {
902
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
941
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
903 942
                        }
904 943
                    }
944
                    else
945
                    {
946
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
947
                    }
948

  
905 949
                }
906 950
                ItemsUpdate(newitems);
907 951
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
952

  
953
                //List<ConvertItem> newitems = new List<ConvertItem>();
954
                //using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
955
                //{
956
                //    foreach (var client in App.StationClientList)
957
                //    {
958
                //        if (await SimplePingAsync(client.Endpoint.Address.ToString()))
959
                //        {
960
                //            try
961
                //            {
962
                //                List<ConvertItem> itemsToList = new List<ConvertItem>();
963
                //                var items = await client.AliveConvertListAsync();
964
                //                string result = "";
965

  
966
                //                foreach (var item in items)
967
                //                {
968
                //                    ConvertItem itemsToEach = new ConvertItem();
969
                //                    itemsToEach.ServiceID = item.ServiceID;
970
                //                    itemsToEach.ConvertID = item.ConvertID;
971
                //                    itemsToEach.ProjectNumber = item.ProjectNumber;
972

  
973
                //                    var convertpath = database.GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
974

  
975
                //                    if (item.ConvertState != null)
976
                //                    {
977
                //                        itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
978
                //                    }
979

  
980
                //                    if (item.OriginfilePath.Contains("/"))
981
                //                    {
982
                //                        result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
983
                //                    }
984
                //                    else
985
                //                    {
986
                //                        result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
987
                //                    }
988
                //                    itemsToEach.FileName = result;
989

  
990
                //                    itemsToEach.CurrentPageNo = item.CurrentPageNo;
991
                //                    itemsToEach.TotalPage = item.TotalPage;
992
                //                    itemsToEach.OriginfilePath = item.OriginfilePath;
993
                //                    itemsToEach.ConvertPath = item.ConvertPath;
994
                //                    itemsToEach.MarkusLink = convertpath[1];
995
                //                    itemsToEach.UniqueKey = item.UniqueKey;
996
                //                    itemsToEach.GroupNo = item.GroupNo;
997
                //                    itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
998
                //                    itemsToEach.DocumnetName = item.DocumnetName;
999
                //                    itemsToEach.Revision = item.Revision;
1000
                //                    itemsToEach.Exception = item.Exception;
1001
                //                    itemsToEach.ConvertPath = convertpath[0];
1002
                //                    itemsToEach.CreateTime = item.CreateTime;
1003
                //                    itemsToEach.ReConverter = item.ReConverter;
1004
                //                    itemsToEach.DocumentID = item.DocumentID;
1005
                //                    itemsToEach.StartTime = item.StartTime;
1006
                //                    itemsToEach.EndTime = item.EndTime;
1007

  
1008
                //                    itemsToList.Add(itemsToEach);
1009
                //                }
1010
                //                newitems.AddRange(itemsToList);
1011
                //                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1012

  
1013
                //                if (items.Count() == 0)
1014
                //                {
1015
                //                    System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1016
                //                }
1017
                //            }
1018
                //            catch (Exception ex)
1019
                //            {
1020
                //                System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1021
                //            }
1022
                //        }
1023
                //        else
1024
                //        {
1025
                //            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1026
                //        }
1027
                //    }
1028
                //}
1029
                //ItemsUpdate(newitems);
1030
                //await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
908 1031
            }
909 1032
            catch (Exception ex)
910 1033
            {
......
1020 1143
            }
1021 1144
            else
1022 1145
            {
1023
                ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1146
                //ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1024 1147
                var resultRealConvert = 0;
1025 1148
                var resultFiltertConvert = 0;
1026 1149

  
1027 1150
                if (SelectRealConvert != null)
1028 1151
                {
1029
                    resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);
1152
                    //resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1153
                    resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1030 1154
                }
1031 1155
                else if (SelectFilterConvert != null)
1032 1156
                {
1033
                    resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);
1157
                    //resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);//ConvertDataBase
1158
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert);
1034 1159
                }
1035 1160
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1036 1161

  
1037
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
1162
                using (markusEntities entities = new markusEntities())
1038 1163
                {
1039
                    var items = database.GetConvertProjects(SelectFilterConvert);
1040 1164

  
1041
                    foreach (var item in items)
1042
                    {
1043
                        RealConvertSource.Add(item);
1044
                    }
1045
                    if (RealConvertSource.Count() == 1)
1165
                    var items = entities.SELECT_CONVERT_ITEM(SelectFilterConvert.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null); //프로시저 이용
1166

  
1167

  
1168
                    foreach (var x in items)
1046 1169
                    {
1047
                        ConvertShow = true;
1170
                        var convertpath = GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
1171

  
1172
                        ConvertItem AddItem = new ConvertItem(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1173
                         , x.DOCUMENT_URL, convertpath[0], convertpath[1], x.RECONVERTER);
1174

  
1175
                        RealConvertSource.Add(AddItem);
1176

  
1177
                        if (RealConvertSource.Count() == 1)
1178
                        {
1179
                            ConvertShow = true;
1180
                        }
1048 1181
                    }
1182

  
1049 1183
                }
1184

  
1185
                //ConvertDataBase
1186
                //using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
1187
                //{
1188
                //    var items = database.GetConvertProjects(SelectFilterConvert);
1189

  
1190
                //    foreach (var item in items)
1191
                //    {
1192
                //        RealConvertSource.Add(item);
1193
                //    }
1194
                //    if (RealConvertSource.Count() == 1)
1195
                //    {
1196
                //        ConvertShow = true;
1197
                //    }
1198
                //}
1199
            }
1200
        }
1201

  
1202

  
1203
        public int SetCleanUpItem(ConvertItem _ConvertItem)
1204
        {
1205
            using (markusEntities entities = new markusEntities())
1206
            {
1207
                int result = 0;
1208

  
1209
                var items = entities.SELECT_CONVERT_ITEM(_ConvertItem.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null).ToList();
1210

  
1211
                if (items.Count() > 0)
1212
                {
1213
                    var item = items.First();
1214

  
1215
                    var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1216
                    var _CREATE_DATETIME = DateTime.Now;
1217
                    var _STATUS = (int)StatusCodeType.None;
1218

  
1219
                  entities.SELECT_RERECONVERT_ITEM(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1220

  
1221
                }
1222

  
1223
                return result;
1224
            }
1225
        }
1226

  
1227
        public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1228
        {
1229
            string[] ConvertPath = new string[2];
1230
            ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1231
            ConvertPath[1] = "kcom://" + Markus.Service.DataBase.Extensions.MarkusAPI.CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1232

  
1233
            return ConvertPath;
1234
        }
1235

  
1236
        #region Convert Path
1237

  
1238
        private string GetConvertPath(string ProjectNo, string DocumentID)
1239
        {
1240
            try
1241
            {
1242
                return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1243
            }
1244
            catch (Exception)
1245
            {
1246
                throw new Exception("GetConvertPath Error");
1247
            }
1248

  
1249
        }
1250

  
1251
        private string BaseStorage(string ProjectNo)
1252
        {
1253
            using (markusEntities entities = new markusEntities())
1254
            {
1255
                string result = "";
1256

  
1257
                var properties = entities.SELECT_CONVERT_ITEM(null, ProjectNo, null, null, 1, null, null, null, null, null, null, null, null,  null, null, null, null).ToList();
1258
                //var properties = entities.PROPERTIES.Where(f => f.PROPERTY == ProjectNo && f.TYPE == PROPERTIES_DEFINE.TILE_SOURCE_STORAGE);//
1259

  
1260

  
1261
                if (properties.Count() > 0)
1262
                {
1263
                    result = properties.First().PROPERTIES_VALUE;
1264
                }
1265
                else
1266
                {
1267
                    throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1268
                }
1269

  
1270
                return result;
1050 1271
            }
1051 1272
        }
1052 1273

  
1053 1274
        #endregion
1054 1275

  
1276
        #endregion
1277

  
1055 1278
        #region Validation
1056 1279

  
1057 1280
        private void DataValidate(object obj)
......
1135 1358

  
1136 1359
        private void OnClosed(object sender, WindowClosedEventArgs e)
1137 1360
        {
1138
            var result = e.DialogResult;
1139
            if (result == true)
1361
            using (markusEntities entities = new markusEntities())
1140 1362
            {
1141
                ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1142
                var resultRealConvert = _DataConvert.RemoveItem(SelectRealConvert.ConvertID);
1143
                var resultFiltertConvert = _DataConvert.RemoveItem(SelectFilterConvert.ConvertID);
1144
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1363
                var result = e.DialogResult;
1364
                if (result == true)
1365
                {
1366
                    if (SelectRealConvert != null)
1367
                    {
1368
                        entities.SELECT_CONVERT_DELETE(SelectRealConvert.ConvertID);
1369
                    }
1370
                    if (SelectFilterConvert != null)
1371
                    {
1372
                        entities.SELECT_CONVERT_DELETE(SelectFilterConvert.ConvertID);
1373
                    }
1374
                    //System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1375

  
1376
                    //ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1377
                    //var resultRealConvert = _DataConvert.RemoveItem(SelectRealConvert.ConvertID);
1378
                    //var resultFiltertConvert = _DataConvert.RemoveItem(SelectFilterConvert.ConvertID);
1379
                    //System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1380
                }
1145 1381
            }
1146 1382
        }
1147 1383

  
......
1226 1462

  
1227 1463
        public void Reset(object obj)
1228 1464
        {
1465
            ProjectNumberFilter = null;
1466
            UniqueKeyFilter = null;
1467
            Service_IDFilter = null;
1468
            Document_NameFilter = null;
1469
            Docuemnt_NOFilter = null;
1470
            ReconverterFilter = null;
1471
            RevisionFilter = null;
1472
            GroupNOFilter = null;
1473
            DefaultCreateTime = DateTime.Now;
1474
            SelectedCreateTimeBegin = DefaultCreateTime;
1475
            SelectedCreateTimeEnd = DefaultCreateTime;
1229 1476
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1230 1477
        }
1231 1478

  
......
1245 1492

  
1246 1493
            Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1247 1494

  
1495
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1496

  
1248 1497
            convertAddDialog.ShowDialog();
1249 1498

  
1250 1499
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);

내보내기 Unified diff

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