개정판 978488b0
issue #0000
최초 ID2Connection 시 ID2 작업 시작일 업데이트
Change-Id: I43a72409c4b904f8db3c50ecf31263d246ae8072
ID2.Manager/ID2.Manager.Controller/Controllers/DocumentController.cs | ||
---|---|---|
26 | 26 |
return rep.SetDocumentData(docList, delDocList); |
27 | 27 |
} |
28 | 28 |
} |
29 |
|
|
30 |
public Documents SetDocumentDataField(Documents doc, string userId) |
|
31 |
{ |
|
32 |
using (DocumentRepository rep = new DocumentRepository(this._DbConnectionStr)) |
|
33 |
{ |
|
34 |
return rep.SetDocumentDataField(doc, userId); |
|
35 |
} |
|
36 |
} |
|
29 | 37 |
} |
30 | 38 |
} |
ID2.Manager/ID2.Manager.Dapper/Repository/BaseRepository.cs | ||
---|---|---|
108 | 108 |
return this._DbConnection.QueryFirst<T>(sql); |
109 | 109 |
} |
110 | 110 |
|
111 |
public T QueryFirstOrDefault<T>(string sql, object param, IDbTransaction dbTran = null) |
|
112 |
{ |
|
113 |
if (this._DbConnection.State != ConnectionState.Open) |
|
114 |
{ |
|
115 |
this._DbConnection.Open(); |
|
116 |
} |
|
117 |
|
|
118 |
return this._DbConnection.QueryFirstOrDefault<T>(sql, param, transaction : dbTran); |
|
119 |
} |
|
120 |
|
|
111 | 121 |
|
112 | 122 |
public IEnumerable<T> Query<T>(string sql, object param) |
113 | 123 |
{ |
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 |
} |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
652 | 652 |
if (e.Row.DataBoundItem is Documents doc) |
653 | 653 |
{ |
654 | 654 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
655 |
|
|
656 |
try |
|
657 |
{ |
|
658 |
if (doc.ID2StartDate != null) |
|
659 |
{ |
|
660 |
var returnDoc = new DocumentController().SetDocumentDataField(new Documents() |
|
661 |
{ |
|
662 |
DocID = doc.DocID, |
|
663 |
ID2StartDate = DateTime.Now |
|
664 |
}, informations.ActiveUser.ID); |
|
665 |
|
|
666 |
if (returnDoc != null) |
|
667 |
{ |
|
668 |
doc.ID2StartDate = returnDoc.ID2StartDate; |
|
669 |
} |
|
670 |
} |
|
671 |
} |
|
672 |
catch { } |
|
655 | 673 |
} |
656 | 674 |
} |
657 | 675 |
catch (Exception ex) |
내보내기 Unified diff