개정판 978488b0
issue #0000
최초 ID2Connection 시 ID2 작업 시작일 업데이트
Change-Id: I43a72409c4b904f8db3c50ecf31263d246ae8072
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs | ||
---|---|---|
274 | 274 |
|
275 | 275 |
return isSuccess; |
276 | 276 |
} |
277 |
|
|
278 |
public Documents SetDocumentDataField(Documents doc, string userId) |
|
279 |
{ |
|
280 |
Documents resultData = null; |
|
281 |
|
|
282 |
try |
|
283 |
{ |
|
284 |
using (var transaction = base.BeginTransaction()) |
|
285 |
{ |
|
286 |
string query = string.Empty; |
|
287 |
|
|
288 |
if (!string.IsNullOrEmpty(doc.DocID)) |
|
289 |
{ |
|
290 |
StringBuilder sbSet = new StringBuilder(); |
|
291 |
var parameters = new Dictionary<string, object>(); |
|
292 |
|
|
293 |
#region Update 할 목록 |
|
294 |
if (doc.ID2StartDate != null) |
|
295 |
{ |
|
296 |
sbSet.Append(" ,ID2StartDate=@DateTimeNow "); |
|
297 |
parameters.Add("ID2StartDate", doc.ID2StartDate); |
|
298 |
} |
|
299 |
#endregion |
|
300 |
|
|
301 |
if (parameters.Count > 0) |
|
302 |
{ |
|
303 |
sbSet.Append(" ,DocID=@DocID "); |
|
304 |
parameters.Add("DocID", "sdfsdf"); |
|
305 |
|
|
306 |
sbSet.Append(" ,ModifiedUser=@ModifiedUser "); |
|
307 |
parameters.Add("ModifiedUser", userId); |
|
308 |
|
|
309 |
query = $@" |
|
310 |
declare @DateTimeNow datetime |
|
311 |
set @DateTimeNow = getdate() |
|
312 |
|
|
313 |
update dbo.Documents |
|
314 |
set ModifiedDate=@DateTimeNow {sbSet} |
|
315 |
where [DocID]=@DocID |
|
316 |
|
|
317 |
if @@rowcount > 0 |
|
318 |
begin |
|
319 |
select * from dbo.Documents where DocID=@DocID |
|
320 |
end |
|
321 |
else |
|
322 |
begin |
|
323 |
select * from dbo.Documents where 1=2 |
|
324 |
end;"; |
|
325 |
resultData = base.QueryFirstOrDefault<Documents>(query, parameters, transaction); |
|
326 |
} |
|
327 |
} |
|
328 |
|
|
329 |
transaction.Commit(); |
|
330 |
} |
|
331 |
} |
|
332 |
catch (Exception ex) |
|
333 |
{ |
|
334 |
throw ex; |
|
335 |
} |
|
336 |
|
|
337 |
return resultData; |
|
338 |
} |
|
277 | 339 |
} |
278 | 340 |
} |
내보내기 Unified diff