프로젝트

일반

사용자정보

개정판 82705273

ID82705273400bdec9af8e7e47bd7c1978531807a5
상위 c0420a29
하위 86886d41

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

issue #0000
repository, controller 예외처리 추가

Change-Id: I36131f1b27f8e0095ea07f19a349ac0a5ded1904

차이점 보기:

ID2.Manager/ID2.Manager.Controller/Controllers/ProjectController.cs
13 13
    {
14 14
        public IEnumerable<ProjectInfo> GetAllProjectList()
15 15
        {
16
            using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
16
            try
17 17
            {
18
                var id2Project = new ID2Controller().GetID2ProjectList();
19
                var allProject = rep.GetAllProjectList();
18
                using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
19
                {
20
                    var id2Project = new ID2Controller().GetID2ProjectList();
21
                    var allProject = rep.GetAllProjectList();
20 22

  
21
                return from mg in allProject
22
                       join id2 in id2Project on mg.Code equals id2.Name into gj
23
                       from prjs in gj.DefaultIfEmpty()
24
                       select new ProjectInfo()
25
                       {
26
                           ProjectID = mg.ProjectID,
27
                           Code = mg.Code,
28
                           Name = mg.Name,
29
                           Description = mg.Description,
30
                           ID2Path = prjs?.Path ?? null,
31
                           GroupID = mg.GroupID,
32
                           GroupName = mg.GroupName,
33
                           Level = mg.Level,
34
                           ID2Info = prjs ?? new ID2ProjectInfo(),
35
                       };
23
                    return from mg in allProject
24
                           join id2 in id2Project on mg.Code equals id2.Name into gj
25
                           from prjs in gj.DefaultIfEmpty()
26
                           select new ProjectInfo()
27
                           {
28
                               ProjectID = mg.ProjectID,
29
                               Code = mg.Code,
30
                               Name = mg.Name,
31
                               Description = mg.Description,
32
                               ID2Path = prjs?.Path ?? null,
33
                               GroupID = mg.GroupID,
34
                               GroupName = mg.GroupName,
35
                               Level = mg.Level,
36
                               ID2Info = prjs ?? new ID2ProjectInfo(),
37
                           };
38
                }
39
            }
40
            catch (Exception ex)
41
            {
42
                throw ex;
36 43
            }
37 44
        }
38 45

  
39 46
        public ProjectInfo GetProjectInfo(string ProjectID)
40 47
        {
41
            using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
48
            try
42 49
            {
43
                var id2Project = new ID2Controller().GetID2ProjectList();
44
                var project = rep.GetProjectInfo(ProjectID);
50
                using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
51
                {
52
                    var id2Project = new ID2Controller().GetID2ProjectList();
53
                    var project = rep.GetProjectInfo(ProjectID);
45 54

  
46
                var id2 = id2Project.Where(x => x.Name.Equals(project.Code)).FirstOrDefault();
47
                project.ID2Path = id2?.Path ?? null;
48
                project.ID2Info = id2 ?? new ID2ProjectInfo();
55
                    var id2 = id2Project.Where(x => x.Name.Equals(project.Code)).FirstOrDefault();
56
                    project.ID2Path = id2?.Path ?? null;
57
                    project.ID2Info = id2 ?? new ID2ProjectInfo();
49 58

  
50
                return rep.GetProjectInfo(ProjectID);
59
                    return rep.GetProjectInfo(ProjectID);
60
                }
61
            }
62
            catch (Exception ex)
63
            {
64
                throw ex;
51 65
            }
52 66
        }
53 67

  
54 68
        public bool SetProjectData(ProjectInfo projectInfo, List<ID2ProjectInfo> id2ProjectList)
55 69
        {
56
            using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
70
            try
57 71
            {
58
                return rep.SetProjectData(projectInfo, id2ProjectList);
72
                using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
73
                {
74
                    return rep.SetProjectData(projectInfo, id2ProjectList);
75
                }
76
            }
77
            catch (Exception ex)
78
            {
79
                throw ex;
59 80
            }
60 81
        }
61 82

  
62 83
        public bool SetProjectGroupData(ProjectInfo projectInfo)
63 84
        {
64
            using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
85
            try
86
            {
87
                using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR))
88
                {
89
                    return rep.SetProjectGroupData(projectInfo);
90
                }
91
            }
92
            catch (Exception ex)
65 93
            {
66
                return rep.SetProjectGroupData(projectInfo);
94
                throw ex;
67 95
            }
68 96
        }
69 97
    }

내보내기 Unified diff

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