프로젝트

일반

사용자정보

개정판 86886d41

ID86886d41b3b41c8e93497b9822aa27c89fe4b73b
상위 82705273
하위 0fbe4172

유성호이(가) 약 2년 전에 추가함

issue #0000
Exception 처리 및 Log 추가진행
- 프로젝트 선택화면
- 유저setup 조회/수정/삭제
- 프로젝트setup 조회/수정/삭제

Change-Id: I628ce59edfd55293b774a323f7704b1c489dcead

차이점 보기:

ID2.Manager/ID2.Manager/Controls/OpenProjectView.cs
8 8
using System.Threading.Tasks;
9 9
using System.Windows.Forms;
10 10

  
11
using System.Reflection;
12

  
11 13
using ID2.Manager.Forms;
12 14
using ID2.Manager.Data.Models;
13 15
using ID2.Manager.Controller.Controllers;
......
103 105

  
104 106
            if (RadMessageBox.Show($"Are you sure you want to delete '{selectedProjectGroup.Name}'?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
105 107
            {
106
                var projectGroup = this.radGridViewGroup.SelectedRows[0].DataBoundItem as ProjectInfo;
107

  
108
                bool result = new ProjectController().SetProjectGroupData(projectGroup);
109
                if (result)
108
                try
110 109
                {
111
                    RadMessageBox.Show("Delete is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
110
                    var projectGroup = this.radGridViewGroup.SelectedRows[0].DataBoundItem as ProjectInfo;
112 111

  
113
                    this.GetProjectGroups();
112
                    bool result = new ProjectController().SetProjectGroupData(projectGroup);
113
                    if (result)
114
                    {
115
                        RadMessageBox.Show("Delete is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
116

  
117
                        this.GetProjectGroups();
118
                    }
119
                }
120
                catch (Exception ex)
121
                {
122
                    Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
123
                    RadMessageBox.Show("Failed to delete project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
114 124
                }
115 125
            }
116 126
        }
ID2.Manager/ID2.Manager/Forms/AddUser.cs
9 9
using System.Windows.Forms;
10 10

  
11 11
using System.Text.RegularExpressions;
12
using System.Reflection;
12 13

  
13 14
using ID2.Manager.Dapper;
14 15
using ID2.Manager.Common;
......
19 20
using Telerik.WinControls;
20 21
using Telerik.WinControls.UI;
21 22

  
22

  
23 23
namespace ID2.Manager.Forms
24 24
{
25 25
    public partial class AddUser : RadForm
......
160 160
                this.UserInfo.RefProjectID = projectId;
161 161
                this.UserInfo.Password = Globals.EncryptionSHA256(password);
162 162

  
163
                bool result = new UserController().SetUserInfo(this.UserInfo);
164
                if (result)
163
                try
165 164
                {
166
                    RadMessageBox.Show("User saved successfully.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
167
                    this.DialogResult = DialogResult.OK;
165
                    bool result = new UserController().SetUserInfo(this.UserInfo);
166
                    if (result)
167
                    {
168
                        RadMessageBox.Show("User saved successfully.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
169
                        this.DialogResult = DialogResult.OK;
170
                    }
171
                    else
172
                    {
173
                        this.DialogResult = DialogResult.Cancel;
174
                    }
168 175
                }
169
                else
176
                catch (Exception ex)
170 177
                {
171
                    this.DialogResult = DialogResult.Cancel;
178
                    Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
172 179
                }
173 180
            }
174 181
        }
ID2.Manager/ID2.Manager/Forms/SetupProject.cs
8 8
using System.Threading.Tasks;
9 9
using System.Windows.Forms;
10 10

  
11
using System.Reflection;
12

  
11 13
using ID2.Manager.Common;
12 14
using ID2.Manager.Data.Models;
13 15
using ID2.Manager.Controller.Controllers;
......
50 52

  
51 53
        public void GetProjectList()
52 54
        {
53
            var id2Project = new ID2Controller().GetID2ProjectList().ToList();
54
            List<ProjectInfo> prjs = informations.ProjectList.Where(x => x.Level.Equals(2)).ToList();
55
            try
56
            {
57
                var id2Project = new ID2Controller().GetID2ProjectList().ToList();
58
                List<ProjectInfo> prjs = informations.ProjectList.Where(x => x.Level.Equals(2)).ToList();
55 59

  
56
            if (this.ProjectInfo != null)
60
                if (this.ProjectInfo != null)
61
                {
62
                    this.radTextBoxProjectCode.Text = this.ProjectInfo.Code;
63
                    this.radTextBoxProjectName.Text = this.ProjectInfo.Name;
64
                    this.radTextBoxDescription.Text = this.ProjectInfo.Description;
65
                }
66

  
67
                this.radGridViewID2Project.DataSource = new BindingList<ID2ProjectInfo>(id2Project);
68
            }
69
            catch (Exception ex)
57 70
            {
58
                this.radTextBoxProjectCode.Text = this.ProjectInfo.Code;
59
                this.radTextBoxProjectName.Text = this.ProjectInfo.Name;
60
                this.radTextBoxDescription.Text = this.ProjectInfo.Description;
71
                Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
72
                RadMessageBox.Show("Failed to query the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
61 73
            }
62

  
63
            this.radGridViewID2Project.DataSource = new BindingList<ID2ProjectInfo>(id2Project);
64 74
        }
65 75

  
66 76
        private void RadGridViewID2Project_RowFormatting(object sender, RowFormattingEventArgs e)
......
174 184
                this.ProjectInfo.Name = this.radTextBoxProjectName.Text.Trim();
175 185
                this.ProjectInfo.Description = this.radTextBoxDescription.Text.Trim();
176 186

  
177
                bool result = new ProjectController().SetProjectData(this.ProjectInfo, id2prjs);
178

  
179
                if (result)
187
                try
180 188
                {
181
                    IEnumerable<ProjectInfo> allProjectList = new ProjectController().GetAllProjectList();
189
                    bool result = new ProjectController().SetProjectData(this.ProjectInfo, id2prjs);
190

  
191
                    if (result)
192
                    {
193
                        IEnumerable<ProjectInfo> allProjectList = new ProjectController().GetAllProjectList();
182 194

  
183
                    if (informations.ProjectList.Count > 0)
184
                        informations.ProjectList.Clear();
185
                    informations.ProjectList = allProjectList.ToList();
195
                        if (informations.ProjectList.Count > 0)
196
                            informations.ProjectList.Clear();
197
                        informations.ProjectList = allProjectList.ToList();
186 198

  
187
                    RadMessageBox.Show("Project saved successfully.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
188
                    this.DialogResult = DialogResult.OK;
199
                        RadMessageBox.Show("Project saved successfully.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
200
                        this.DialogResult = DialogResult.OK;
201
                    }
189 202
                }
190
                else
203
                catch (Exception ex)
191 204
                {
205
                    Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
206
                    RadMessageBox.Show("Failed to save project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
207

  
192 208
                    this.DialogResult = DialogResult.Cancel;
193 209
                }
194 210
            }
ID2.Manager/ID2.Manager/Forms/SetupUser.cs
8 8
using System.Threading.Tasks;
9 9
using System.Windows.Forms;
10 10

  
11
using System.Reflection;
12

  
11 13
using ID2.Manager.Dapper;
12 14
using ID2.Manager.Common;
13 15
using ID2.Manager.Data.Models;
......
48 50

  
49 51
        private void GetUserList()
50 52
        {
51
            GridViewComboBoxColumn colProject = this.radGridViewUser.Columns["RefProjectID"] as GridViewComboBoxColumn;
52
            colProject.DataSource = informations.ProjectList.Where(x => x.Level.Equals(1)).ToList();
53
            colProject.DisplayMember = "Name";
54
            colProject.ValueMember = "ProjectID";
53
            try
54
            {
55
                GridViewComboBoxColumn colProject = this.radGridViewUser.Columns["RefProjectID"] as GridViewComboBoxColumn;
56
                colProject.DataSource = informations.ProjectList.Where(x => x.Level.Equals(1)).ToList();
57
                colProject.DisplayMember = "Name";
58
                colProject.ValueMember = "ProjectID";
55 59

  
56
            this.radGridViewUser.DataSource = informations.UserList;
60
                this.radGridViewUser.DataSource = informations.UserList;
61
            }
62
            catch (Exception ex)
63
            {
64
                Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
65
                RadMessageBox.Show("Failed to query user.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
66
            }
57 67
        }
58 68

  
59 69
        private void RadGridViewUser_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
......
66 76

  
67 77
        private void RadGridViewUser_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
68 78
        {
69
            if (e.OldItems != null)
79
            try
70 80
            {
71
                var row = e.OldItems[0] as GridViewDataRowInfo;
72
                if (row != null && row.DataBoundItem is UserInfo)
81
                if (e.OldItems != null)
73 82
                {
74
                    var userInfo = row.DataBoundItem as UserInfo;
75

  
76
                    if (RadMessageBox.Show("Do you want to Delete the User?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
83
                    var row = e.OldItems[0] as GridViewDataRowInfo;
84
                    if (row != null && row.DataBoundItem is UserInfo)
77 85
                    {
78
                        bool result = new UserController().SetUserInfo(userInfo, DMLType.DELETE);
79
                        if (result)
86
                        var userInfo = row.DataBoundItem as UserInfo;
87

  
88
                        if (RadMessageBox.Show("Do you want to Delete the User?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
80 89
                        {
81
                            IEnumerable<UserInfo> allUserList = new UserController().GetAllUserInfo();
90
                            bool result = new UserController().SetUserInfo(userInfo, DMLType.DELETE);
91
                            if (result)
92
                            {
93
                                IEnumerable<UserInfo> allUserList = new UserController().GetAllUserInfo();
82 94

  
83
                            if (informations.UserList.Count > 0)
84
                                informations.UserList.Clear();
85
                            allUserList.ToList().ForEach(x => informations.UserList.Add(x.DeepCopy(x)));
95
                                if (informations.UserList.Count > 0)
96
                                    informations.UserList.Clear();
97
                                allUserList.ToList().ForEach(x => informations.UserList.Add(x.DeepCopy(x)));
86 98

  
87
                            this.GetUserList();
99
                                this.GetUserList();
88 100

  
89
                            RadMessageBox.Show("User has been deleted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
101
                                RadMessageBox.Show("User has been deleted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
102
                            }
90 103
                        }
91 104
                    }
92 105
                }
93 106
            }
107
            catch (Exception ex)
108
            {
109
                Program.logger.Debug($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
110
                RadMessageBox.Show("Failed to delete user.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
111
            }
94 112
        }
95 113

  
96 114
        private void RadGridViewUser_CellDoubleClick(object sender, GridViewCellEventArgs e)

내보내기 Unified diff

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