프로젝트

일반

사용자정보

개정판 b2ff5ff4

IDb2ff5ff4f11055e6e14325486cdb446ee0845369
상위 ac1b02f3
하위 986f7d35

유성호이(가) 일년 이상 전에 추가함

document 조회
- date 조건추가
- ID2 시작일, ID2 종료일, AVEVA 변환일, AVEVA 검토일 -> or 조건

Change-Id: I1918d4fe1f07aa1f303b0728ee0299c764c69f17

차이점 보기:

ID2.Manager/ID2.Manager.Common/Informations.cs
86 86
        private readonly Dictionary<string, string> _DateType = new Dictionary<string, string>()
87 87
        {
88 88
            { "ID2StartDate", "ID2 시작일" },
89
            { "ID2EndDate", "ID2 료일" },
89
            { "ID2EndDate", "ID2 료일" },
90 90
            { "AVEVAConvertDate", "AVEVA 변환일" },
91 91
            { "AVEVAReviewDate", "AVEVA 검토일" }
92 92
        };
ID2.Manager/ID2.Manager.Controller/Controllers/DocumentController.cs
31 31
            }
32 32
        }
33 33

  
34
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectGroupID, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
34
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectGroupID, List<string> dateTypes, DateTime? frDate, DateTime? toDate, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
35 35
        {
36 36
            try
37 37
            {
38 38
                using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
39 39
                {
40
                    return rep.GetDocuments(projectGroupID, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem);
40
                    return rep.GetDocuments(projectGroupID, dateTypes, frDate, toDate, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem);
41 41
                }
42 42
            }
43 43
            catch (Exception ex)
......
46 46
            }
47 47
        }
48 48

  
49
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(List<ID2ProjectInfo> id2Infos, string projectGroupID, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
49
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(List<ID2ProjectInfo> id2Infos, string projectGroupID, List<string> dateTypes, DateTime? frDate, DateTime? toDate, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
50 50
        {
51 51
            try
52 52
            {
53
                var (dwgs, totalCnt) = this.GetDocuments(projectGroupID, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem);
53
                var (dwgs, totalCnt) = this.GetDocuments(projectGroupID, dateTypes, frDate, toDate, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem);
54 54

  
55 55
                IEnumerable<Documents> docs = dwgs;
56 56
                List<ID2Drawings> id2docs = null;
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs
58 58
        }
59 59

  
60 60

  
61
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectGroupID, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
61
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectGroupID, List<string> dateTypes, DateTime? frDate, DateTime? toDate, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
62 62
        {
63 63
            var map = new CustomPropertyTypeMap(typeof(AttFileInfo), (type, columnName)
64 64
     => type.GetProperties().FirstOrDefault(prop => GetDescriptionFromAttribute(prop) == columnName.ToLower()));
......
71 71
            StringBuilder sbWhere = new StringBuilder();
72 72
            StringBuilder sbTotalWhere = new StringBuilder();
73 73
            var parameters = new Dictionary<string, object>();
74
            if (dateTypes.Count > 0 && (frDate != null || toDate != null))
75
            {
76
                List<string> subWheres = new List<string>();
77
                foreach (string dateType in dateTypes)
78
                {
79
                    StringBuilder sbSubWhere = new StringBuilder();
80
                    if (frDate != null)
81
                    {
82
                        sbSubWhere.Insert(0, $@"convert(datetime, '{Convert.ToDateTime(frDate).AddDays(-1):yyyy-MM-dd 23:59:59.997}') < doc.{dateType}");
83
                    }
84
                    if (toDate != null)
85
                    {
86
                        if (frDate != null)
87
                            sbSubWhere.Append($@" and ");
88
                        sbSubWhere.Append($@"doc.{dateType} < convert(datetime, '{Convert.ToDateTime(toDate).AddDays(1):yyyy-MM-dd 00:00:00.000}')");
89
                    }
90

  
91
                    if (sbSubWhere.Length > 0)
92
                    {
93
                        subWheres.Add("(" + sbSubWhere.ToString() + ")");
94
                    }
95
                }
96

  
97
                if (subWheres.Count > 0)
98
                {
99
                    sbWhere.Append(" and (" + string.Join(" or ", subWheres) + ") ");
100
                }
101
            }
74 102
            if (string.IsNullOrEmpty(projectCode))
75 103
            {
76 104
                sbWhere.Append(" and isnull(doc.RefProjectCode,'') in (select Code from dbo.Projects where ParentID=@RefGroupID union all select '') ");
ID2.Manager/ID2.Manager/Classes/DocumentsWorker.cs
20 20
        public OnWorkCompleted OnWorkCompletedHandler;
21 21

  
22 22
        readonly Informations informations = Informations.Instance;
23
        List<string> DateTypes { get; set; }
24
        DateTime? FrDate { get; set; }
25
        DateTime? ToDate { get; set; }
23 26
        string ProjectCode { get; set; }
24 27
        string PersonIncharge { get; set; }
25 28
        string JobLevel { get; set; } 
......
34 37
        string DTIsGateWay { get; set; }
35 38
        string DTIsRegSystem { get; set; }
36 39

  
37
        public LoadDocumentsWorker(string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem, Control parent = null) : base(parent)
40
        public LoadDocumentsWorker(List<string> dateTypes, DateTime? frDate, DateTime? toDate, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem, Control parent = null) : base(parent)
38 41
        {
42
            this.DateTypes = dateTypes;
43
            this.FrDate = frDate;
44
            this.ToDate = toDate;
39 45
            this.ProjectCode = projectCode;
40 46
            this.PersonIncharge = personIncharge;
41 47
            this.JobLevel = jobLevel;
......
55 61
        {
56 62
            try
57 63
            {
58
                var (dwgs, totalCnt) = new DocumentController().GetDocuments(informations.ActiveProject.ProjectID,  this.ProjectCode, this.PersonIncharge, this.JobLevel, this.DocumentNo, this.IsToIsDiscussion, this.IsFrReviewStatus, this.IsID2Work, this.Id2Status, this.AvevaStatus, this.ProdIsResult, this.ClientIsResult, this.DTIsGateWay, this.DTIsRegSystem);
64
                var (dwgs, totalCnt) = new DocumentController().GetDocuments(informations.ActiveProject.ProjectID, this.DateTypes, this.FrDate, this.ToDate, this.ProjectCode, this.PersonIncharge, this.JobLevel, this.DocumentNo, this.IsToIsDiscussion, this.IsFrReviewStatus, this.IsID2Work, this.Id2Status, this.AvevaStatus, this.ProdIsResult, this.ClientIsResult, this.DTIsGateWay, this.DTIsRegSystem);
59 65
                e.Result = new DocumentsResult() { Dwgs = dwgs.ToList(), TotalCount = totalCnt };
60 66
            }
61 67
            catch (Exception ex)
ID2.Manager/ID2.Manager/Main.Designer.cs
891 891
            this.radDateTimePickerFr.Anchor = System.Windows.Forms.AnchorStyles.Left;
892 892
            this.radDateTimePickerFr.Location = new System.Drawing.Point(403, 3);
893 893
            this.radDateTimePickerFr.Name = "radDateTimePickerFr";
894
            this.radDateTimePickerFr.NullText = "No date selected";
894 895
            this.radDateTimePickerFr.Size = new System.Drawing.Size(144, 20);
895 896
            this.radDateTimePickerFr.TabIndex = 1;
896 897
            this.radDateTimePickerFr.TabStop = false;
......
902 903
            this.radDateTimePickerTo.Anchor = System.Windows.Forms.AnchorStyles.Right;
903 904
            this.radDateTimePickerTo.Location = new System.Drawing.Point(583, 3);
904 905
            this.radDateTimePickerTo.Name = "radDateTimePickerTo";
906
            this.radDateTimePickerTo.NullText = "No date selected";
905 907
            this.radDateTimePickerTo.Size = new System.Drawing.Size(144, 20);
906 908
            this.radDateTimePickerTo.TabIndex = 2;
907 909
            this.radDateTimePickerTo.TabStop = false;
ID2.Manager/ID2.Manager/Main.cs
88 88
            this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click;
89 89
            this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click;
90 90

  
91
            this.radButtonDateClear.Click += RadButtonDateClear_Click;
91 92
            this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged;
92 93
            this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged;
93 94
            this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged;
......
782 783
        {
783 784
            try
784 785
            {
785
#region 도면
786
                #region Date
787
                //Date Type
788
                if (this.radCheckedDropDownListDateType.DataSource != null)
789
                    this.radCheckedDropDownListDateType.DataSource = null;
790

  
791
                this.radCheckedDropDownListDateType.DataSource = informations.DateType;
792
                this.radCheckedDropDownListDateType.DisplayMember = "Value";
793
                this.radCheckedDropDownListDateType.ValueMember = "Key";
794

  
795
                //FromDate
796
                this.radDateTimePickerFr.NullableValue = null;
797
                this.radDateTimePickerFr.SetToNullValue();
798

  
799
                //ToDate
800
                this.radDateTimePickerTo.NullableValue = null;
801
                this.radDateTimePickerTo.SetToNullValue();
802
                #endregion
803

  
804
                #region 도면
786 805
                //Project List
787 806
                if (this.radDropDownListProject.Items.Count > 0)
788 807
                    this.radDropDownListProject.Items.Clear();
......
954 973
            {
955 974
                if (this.radDropDownListProject.SelectedValue != null)
956 975
                {
976
                    List<string> dateTypes = this.radCheckedDropDownListDateType.CheckedItems.Select(x => x.Value.ToString()).ToList();
977
                    DateTime? frDate = this.radDateTimePickerFr.Value.Equals(this.radDateTimePickerFr.NullDate) ? (DateTime?)null : this.radDateTimePickerFr.Value;
978
                    DateTime? toDate = this.radDateTimePickerTo.Value.Equals(this.radDateTimePickerTo.NullDate) ? (DateTime?)null : this.radDateTimePickerTo.Value;
979

  
957 980
                    string projectCode = this.radDropDownListProject.SelectedValue.ToString();
958 981
                    string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
959 982
                    string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();
......
972 995
                    string isGateWay = this.radDropDownListGateway.SelectedValue.ToString();
973 996
                    string isRegSystem = this.radDropDownListRegistration.SelectedValue.ToString();
974 997

  
975
                    var worker = new LoadDocumentsWorker(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments);
998
                    var worker = new LoadDocumentsWorker(dateTypes, frDate, toDate, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments);
976 999
                    worker.OnWorkCompletedHandler += (e) =>
977 1000
                    {
978 1001
                        var docData = e.Result as DocumentsResult;
......
1077 1100
                throw ex;
1078 1101
            }
1079 1102
        }
1080
#endregion
1103
        #endregion
1104

  
1105
        #region Button, Checkbox event
1106
        private void RadButtonDateClear_Click(object sender, EventArgs e)
1107
        {
1108
            //DateType
1109
            this.radCheckedDropDownListDateType.CheckedItems.Clear();
1110
            //FromDate
1111
            this.radDateTimePickerFr.SetToNullValue();
1112
            //ToDate
1113
            this.radDateTimePickerTo.SetToNullValue();
1114
        }
1081 1115

  
1082
#region Button, Checkbox event
1083 1116
        private void RadCheckBox_CheckStateChanged(object sender, EventArgs e)
1084 1117
        {
1085 1118
            if (sender is RadCheckBox)

내보내기 Unified diff

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