개정판 5b086e44
issue #00000 markus user insert 로직 추가
Change-Id: Id93ae38b80f01f5f2c660445ee7f2640dc63855d
ID2.Manager/ID2.Manager.Dapper/Repository/MarkusRepository.cs | ||
---|---|---|
44 | 44 |
return result; |
45 | 45 |
} |
46 | 46 | |
47 |
public bool InsertOrUpdateUsers(List<UserInfo> users)
|
|
47 |
public bool InsertOrUpdateUsers(MEMBER member)
|
|
48 | 48 |
{ |
49 | 49 |
bool result = false; |
50 | 50 | |
51 | 51 |
try |
52 | 52 |
{ |
53 |
var oMember = GetMEMBER(member.ID); |
|
53 | 54 | |
55 |
if(oMember?.Count() > 0) |
|
56 |
{ |
|
57 |
var tran = BeginTransaction(); |
|
58 | ||
59 |
string SQL = "UPDATE MEMBER" + |
|
60 |
" SET " + |
|
61 |
"DEPARTMENT = @DEPARTMENT" + |
|
62 |
",NAME = @NAME" + |
|
63 |
",POSITION = @POSITION" + |
|
64 |
",EMAIL_ADDRESS = @EMAIL_ADDRESS" + |
|
65 |
",PASSWORD = @PASSWORD" + |
|
66 |
",COMPANY = @COMPANY" + |
|
67 |
",CREATE_DATETIME = @CREATE_DATETIME" + |
|
68 |
",MODIFIED_DATETIME = @MODIFIED_DATETIME" + |
|
69 |
",ISLICENSE = @ISLICENSE" + |
|
70 |
"WHERE ID = @ID"; |
|
71 | ||
72 | ||
73 |
var parameters = new DynamicParameters(); |
|
74 |
parameters.Add("@ID", member.ID); |
|
75 |
parameters.Add("@DEPARTMENT", member.DEPARTMENT); |
|
76 |
parameters.Add("@NAME", member.NAME); |
|
77 |
parameters.Add("@POSITION", member.POSITION); |
|
78 |
parameters.Add("@EMAIL_ADDRESS", member.EMAIL_ADDRESS); |
|
79 |
parameters.Add("@PASSWORD", member.PASSWORD); |
|
80 |
parameters.Add("@COMPANY", member.COMPANY); |
|
81 |
parameters.Add("@CREATE_DATETIME", member.CREATE_DATETIME); |
|
82 |
parameters.Add("@MODIFIED_DATETIME", member.MODIFIED_DATETIME); |
|
83 |
parameters.Add("@ISLICENSE", member.ISLICENSE); |
|
84 | ||
85 |
var rowsAffected = base.Execute(SQL, parameters, tran); |
|
86 | ||
87 | ||
88 |
if (rowsAffected < 0) |
|
89 |
{ |
|
90 |
result = false; |
|
91 |
} |
|
92 |
else |
|
93 |
{ |
|
94 |
tran.Commit(); |
|
95 |
} |
|
96 |
} |
|
97 |
else |
|
98 |
{ |
|
99 |
var tran = BeginTransaction(); |
|
100 | ||
101 |
string SQL = "INSERT INTO MEMBER (ID,DEPARTMENT,NAME,POSITION,EMAIL_ADDRESS,PASSWORD,COMPANY,CREATE_DATETIME,MODIFIED_DATETIME,ISLICENSE) " + |
|
102 |
"VALUES (@ID,@DEPARTMENT,@NAME,@POSITION,@EMAIL_ADDRESS,@PASSWORD,@COMPANY,@CREATE_DATETIME,@MODIFIED_DATETIME,@ISLICENSE)"; |
|
103 | ||
104 | ||
105 |
var parameters = new DynamicParameters(); |
|
106 |
parameters.Add("@ID", member.ID); |
|
107 |
parameters.Add("@DEPARTMENT", member.DEPARTMENT); |
|
108 |
parameters.Add("@NAME", member.NAME); |
|
109 |
parameters.Add("@POSITION", member.POSITION); |
|
110 |
parameters.Add("@EMAIL_ADDRESS", member.EMAIL_ADDRESS); |
|
111 |
parameters.Add("@PASSWORD", member.PASSWORD); |
|
112 |
parameters.Add("@COMPANY", member.COMPANY); |
|
113 |
parameters.Add("@CREATE_DATETIME", member.CREATE_DATETIME); |
|
114 |
parameters.Add("@MODIFIED_DATETIME", member.MODIFIED_DATETIME); |
|
115 |
parameters.Add("@ISLICENSE", member.ISLICENSE); |
|
116 | ||
117 |
var rowsAffected = base.Execute(SQL, parameters, tran); |
|
118 | ||
119 | ||
120 |
if(rowsAffected < 0) |
|
121 |
{ |
|
122 |
result = false; |
|
123 |
} |
|
124 |
else |
|
125 |
{ |
|
126 |
tran.Commit(); |
|
127 |
} |
|
128 |
} |
|
54 | 129 |
} |
55 | 130 |
catch (Exception ex) |
56 | 131 |
{ |
57 | ||
132 |
throw new Exception($"userId : {member.ID}",ex); |
|
58 | 133 |
} |
59 | 134 | |
60 | 135 |
return result; |
61 | 136 |
} |
62 | 137 | |
138 |
public IEnumerable<MEMBER> GetMEMBER(string id) |
|
139 |
{ |
|
140 |
string SQL = "SELECT * FROM MEMBER WHERE ID = @ID"; |
|
141 | ||
142 |
var parameters = new DynamicParameters(); |
|
143 |
parameters.Add("@ID", id); |
|
144 | ||
145 |
return base.Query<MEMBER>(SQL, parameters); |
|
146 |
} |
|
147 | ||
63 | 148 |
public IEnumerable<ConvertDoc> GetConvertDoc(int status,string ProjectNo) |
64 | 149 |
{ |
65 | 150 |
string SQL = "SELECT * FROM CONVERTER_DOC WHERE STATUS = @STATUS and PROJECT_NO = @PROJECT_NO"; |
내보내기 Unified diff