hytos / ID2.Manager / ID2.Manager.Controller / Controllers / MarkusInfoController.cs @ 45322477
이력 | 보기 | 이력해설 | 다운로드 (3.81 KB)
1 |
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 |
//public IEnumerable<MarkupText> GetMarkupData(IEnumerable<string> ProjectNoList, IEnumerable<string> DocumentNoList) |
15 |
//{ |
16 |
// IEnumerable<MarkupText> result = null; |
17 |
|
18 |
// using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
19 |
// { |
20 |
// result = rep.GetMarkupText(ProjectNoList, DocumentNoList); |
21 |
// } |
22 |
|
23 |
// return result; |
24 |
//} |
25 |
|
26 |
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 |
public int GetConvertDoc(string ProjectNo, string DOCUMENT_ID) |
51 |
{ |
52 |
int result = -1; |
53 |
|
54 |
try |
55 |
{ |
56 |
using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
57 |
{ |
58 |
result = rep.GetConvertDoc(ProjectNo, DOCUMENT_ID); |
59 |
} |
60 |
|
61 |
} |
62 |
catch (Exception) |
63 |
{ |
64 |
throw; |
65 |
} |
66 |
|
67 |
return result; |
68 |
} |
69 |
|
70 |
public bool SetMarkusInfo(List<Documents> docList) |
71 |
{ |
72 |
bool result = false; |
73 |
|
74 |
using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
75 |
{ |
76 |
foreach (var item in docList) |
77 |
{ |
78 |
try |
79 |
{ |
80 |
result = rep.Insert(item.RefProjectCode, item.DocumentNo); |
81 |
|
82 |
if (!result) |
83 |
{ |
84 |
throw new Exception($"Insert Item Error."); |
85 |
} |
86 |
} |
87 |
catch (Exception ex) |
88 |
{ |
89 |
result = false; |
90 |
this.Exception = new Exception($"{JsonConvert.SerializeObject(item)}",ex); |
91 |
break; |
92 |
} |
93 |
} |
94 |
} |
95 |
|
96 |
return result; |
97 |
} |
98 |
|
99 |
public bool SetMembers(IEnumerable<UserInfo> users) |
100 |
{ |
101 |
bool result = false; |
102 |
|
103 |
try |
104 |
{ |
105 |
using (MarkusRepository rep = new MarkusRepository(this._MARKUSCONNSTR)) |
106 |
{ |
107 |
foreach (var user in users) |
108 |
{ |
109 |
rep.InsertOrUpdateUsers(new Dapper.Entities.MEMBER |
110 |
{ |
111 |
ID = user.ID, |
112 |
NAME = user.Name, |
113 |
DEPARTMENT = "SAMSUNG ELEC", |
114 |
POSITION = user.Role, |
115 |
EMAIL_ADDRESS = user.ID, |
116 |
PASSWORD = "", |
117 |
COMPANY = "SAMSUNG ELEC", |
118 |
CREATE_DATETIME = DateTime.Now, |
119 |
MODIFIED_DATETIME = DateTime.Now, |
120 |
ISLICENSE = 1 |
121 |
}); |
122 |
} |
123 |
|
124 |
result = true; |
125 |
} |
126 |
} |
127 |
catch (Exception) |
128 |
{ |
129 |
throw; |
130 |
} |
131 |
|
132 |
return result; |
133 |
} |
134 |
} |
135 |
} |