hytos / ID2.Manager / ID2.Manager.Controller / Controllers / MarkusInfoController.cs @ 7a9c6a5b
이력 | 보기 | 이력해설 | 다운로드 (3.35 KB)
1 | c112c3c3 | taeseongkim | using ID2.Manager.Dapper.Repository; |
---|---|---|---|
2 | using ID2.Manager.Data.Models; |
||
3 | using Newtonsoft.Json; |
||
4 | using System; |
||
5 | using System.Collections.Generic; |
||
6 | using System.Linq; |
||
7 | using System.Text; |
||
8 | using System.Threading.Tasks; |
||
9 | |||
10 | namespace ID2.Manager.Controller.Controllers |
||
11 | { |
||
12 | public class MarkusInfoController : BaseController |
||
13 | { |
||
14 | c7f3eb42 | taeseongkim | //public IEnumerable<MarkupText> GetMarkupData(IEnumerable<string> ProjectNoList, IEnumerable<string> DocumentNoList) |
15 | //{ |
||
16 | // IEnumerable<MarkupText> result = null; |
||
17 | 0b008ea6 | taeseongkim | |
18 | c7f3eb42 | taeseongkim | // using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
19 | // { |
||
20 | // result = rep.GetMarkupText(ProjectNoList, DocumentNoList); |
||
21 | // } |
||
22 | 0b008ea6 | taeseongkim | |
23 | c7f3eb42 | taeseongkim | // return result; |
24 | //} |
||
25 | c112c3c3 | taeseongkim | |
26 | 753a1c26 | taeseongkim | public bool SetProperties(IEnumerable<string> ProjectNoList) |
27 | { |
||
28 | bool result = false; |
||
29 | |||
30 | try |
||
31 | { |
||
32 | using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
||
33 | { |
||
34 | foreach (var ProjectNo in ProjectNoList) |
||
35 | { |
||
36 | rep.InsertProperties(ProjectNo); |
||
37 | } |
||
38 | result = true; |
||
39 | } |
||
40 | |||
41 | } |
||
42 | catch (Exception) |
||
43 | { |
||
44 | throw; |
||
45 | } |
||
46 | |||
47 | return result; |
||
48 | } |
||
49 | |||
50 | c112c3c3 | taeseongkim | public bool SetMarkusInfo(List<Documents> docList) |
51 | { |
||
52 | bool result = false; |
||
53 | |||
54 | fe57f64a | yoush97 | using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
55 | c112c3c3 | taeseongkim | { |
56 | foreach (var item in docList) |
||
57 | { |
||
58 | try |
||
59 | { |
||
60 | 6c3bdda6 | yoush97 | result = rep.Insert(item.RefProjectCode, item.DocumentNo); |
61 | c112c3c3 | taeseongkim | |
62 | if (!result) |
||
63 | { |
||
64 | throw new Exception($"Insert Item Error."); |
||
65 | } |
||
66 | } |
||
67 | catch (Exception ex) |
||
68 | { |
||
69 | result = false; |
||
70 | this.Exception = new Exception($"{JsonConvert.SerializeObject(item)}",ex); |
||
71 | break; |
||
72 | } |
||
73 | } |
||
74 | } |
||
75 | |||
76 | return result; |
||
77 | } |
||
78 | 5b086e44 | taeseongkim | |
79 | public bool SetMembers(IEnumerable<UserInfo> users) |
||
80 | { |
||
81 | bool result = false; |
||
82 | |||
83 | try |
||
84 | { |
||
85 | using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
||
86 | { |
||
87 | foreach (var user in users) |
||
88 | { |
||
89 | rep.InsertOrUpdateUsers(new Dapper.Entities.MEMBER |
||
90 | { |
||
91 | ID = user.ID, |
||
92 | NAME = user.Name, |
||
93 | DEPARTMENT = "SAMSUNG ELEC", |
||
94 | POSITION = user.Role, |
||
95 | EMAIL_ADDRESS = user.ID, |
||
96 | PASSWORD = "", |
||
97 | COMPANY = "SAMSUNG ELEC", |
||
98 | CREATE_DATETIME = DateTime.Now, |
||
99 | MODIFIED_DATETIME = DateTime.Now, |
||
100 | ISLICENSE = 1 |
||
101 | }); |
||
102 | } |
||
103 | |||
104 | result = true; |
||
105 | } |
||
106 | } |
||
107 | catch (Exception) |
||
108 | { |
||
109 | throw; |
||
110 | } |
||
111 | |||
112 | return result; |
||
113 | } |
||
114 | c112c3c3 | taeseongkim | } |
115 | } |