hytos / ID2.Manager / ID2.Manager.Controller / Controllers / ProjectController.cs @ 5b086e44
이력 | 보기 | 이력해설 | 다운로드 (2.48 KB)
1 | cab8a4a1 | yoush97 | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | using ID2.Manager.Data.Models; |
||
8 | using ID2.Manager.Dapper.Repository; |
||
9 | |||
10 | namespace ID2.Manager.Controller.Controllers |
||
11 | { |
||
12 | public class ProjectController : BaseController |
||
13 | { |
||
14 | 87bcedb4 | yoush97 | public IEnumerable<ProjectInfo> GetAllProjectList() |
15 | { |
||
16 | fe57f64a | yoush97 | using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR)) |
17 | 87bcedb4 | yoush97 | { |
18 | 1abdd7c3 | yoush97 | var id2Project = new ID2Controller().GetID2ProjectList(); |
19 | var allProject = rep.GetAllProjectList(); |
||
20 | 87bcedb4 | yoush97 | |
21 | 1abdd7c3 | yoush97 | 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 | 473ee829 | yoush97 | Level = mg.Level, |
34 | ID2Info = prjs ?? new ID2ProjectInfo(), |
||
35 | 1abdd7c3 | yoush97 | }; |
36 | cab8a4a1 | yoush97 | } |
37 | } |
||
38 | |||
39 | public ProjectInfo GetProjectInfo(string ProjectID) |
||
40 | { |
||
41 | fe57f64a | yoush97 | using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR)) |
42 | cab8a4a1 | yoush97 | { |
43 | 1abdd7c3 | yoush97 | var id2Project = new ID2Controller().GetID2ProjectList(); |
44 | var project = rep.GetProjectInfo(ProjectID); |
||
45 | |||
46 | var id2 = id2Project.Where(x => x.Name.Equals(project.Code)).FirstOrDefault(); |
||
47 | 473ee829 | yoush97 | project.ID2Path = id2?.Path ?? null; |
48 | project.ID2Info = id2 ?? new ID2ProjectInfo(); |
||
49 | 1abdd7c3 | yoush97 | |
50 | cab8a4a1 | yoush97 | return rep.GetProjectInfo(ProjectID); |
51 | } |
||
52 | } |
||
53 | a23d0a0c | yoush97 | |
54 | public bool SetProjectData(ProjectInfo projectInfo, List<ID2ProjectInfo> id2ProjectList) |
||
55 | { |
||
56 | fe57f64a | yoush97 | using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR)) |
57 | a23d0a0c | yoush97 | { |
58 | return rep.SetProjectData(projectInfo, id2ProjectList); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | public bool SetProjectGroupData(ProjectInfo projectInfo) |
||
63 | { |
||
64 | fe57f64a | yoush97 | using (ProjectRepository rep = new ProjectRepository(this._MSSQLCONNSTR)) |
65 | a23d0a0c | yoush97 | { |
66 | return rep.SetProjectGroupData(projectInfo); |
||
67 | } |
||
68 | } |
||
69 | cab8a4a1 | yoush97 | } |
70 | } |