개정판 b1591ae6
issue #0000
저장수정 - 되는지 모름
Change-Id: I6b5f4412c72dcf593eee783e400c6b25372b94d1
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs | ||
---|---|---|
255 | 255 |
{ |
256 | 256 |
doc.RegisteredUser = userId; |
257 | 257 |
query = $@" |
258 |
declare @tbdoc table(docid varchar(36)) |
|
258 | 259 |
insert into dbo.Documents |
259 | 260 |
( |
260 | 261 |
DocID |
... | ... | |
302 | 303 |
,DTIsRegSystem |
303 | 304 |
,DTRemarks |
304 | 305 |
) |
306 |
output inserted.DocID into @tbdoc |
|
305 | 307 |
values |
306 | 308 |
( |
307 | 309 |
lower(newid()) |
... | ... | |
348 | 350 |
,@DTIsImport |
349 | 351 |
,@DTIsRegSystem |
350 | 352 |
,@DTRemarks |
351 |
);"; |
|
353 |
) |
|
354 |
|
|
355 |
if @@rowcount > 0 |
|
356 |
begin |
|
357 |
select docid from @tbdoc |
|
358 |
end |
|
359 |
else |
|
360 |
begin |
|
361 |
select '' |
|
362 |
end;"; |
|
352 | 363 |
} |
353 | 364 |
else |
354 | 365 |
{ |
... | ... | |
398 | 409 |
,DTIsImport=@DTIsImport |
399 | 410 |
,DTIsRegSystem=@DTIsRegSystem |
400 | 411 |
,DTRemarks=@DTRemarks |
401 |
where DocID=@DocID;"; |
|
412 |
where DocID=@DocID |
|
413 |
|
|
414 |
if @@rowcount > 0 |
|
415 |
begin |
|
416 |
select @DocID |
|
417 |
end |
|
418 |
else |
|
419 |
begin |
|
420 |
select '' |
|
421 |
end;"; |
|
422 |
} |
|
423 |
string refID = base.QueryFirstOrDefault<string>(query, doc, transaction); |
|
424 |
|
|
425 |
if (doc.AttFiles != null && doc.AttFiles.Count > 0) |
|
426 |
{ |
|
427 |
string attDelIDList = string.Join("','", doc.AttFiles.Where(x => !string.IsNullOrEmpty(x.FileID)).Select(x => x.FileID).ToList()); |
|
428 |
|
|
429 |
if (!string.IsNullOrEmpty(refID) && attDelIDList.Length > 0) |
|
430 |
{ |
|
431 |
query = $@" |
|
432 |
delete from dbo.AttachFIles |
|
433 |
where RefID=@RefID and FileID in ('{attDelIDList}');"; |
|
434 |
base.Execute(query, new { RefID = refID }, transaction); |
|
435 |
} |
|
436 |
|
|
437 |
foreach (AttFileInfo attFile in doc.AttFiles) |
|
438 |
{ |
|
439 |
attFile.RefID = refID; |
|
440 |
attFile.Creator = userId; |
|
441 |
|
|
442 |
query = $@" |
|
443 |
insert into dbo.AttachFIles (FileID,RefID,Category,FileType,FileName,FilePath,FileExtension,FileData,Creator) |
|
444 |
values |
|
445 |
( |
|
446 |
lower(newid()) |
|
447 |
,@RefID |
|
448 |
,@Category |
|
449 |
,@FileType |
|
450 |
,@FileName |
|
451 |
,@FilePath |
|
452 |
,@FileExtension |
|
453 |
,@FileData |
|
454 |
,@Creator |
|
455 |
)"; |
|
456 |
|
|
457 |
base.Execute(query, attFile, transaction); |
|
458 |
} |
|
402 | 459 |
} |
403 |
base.Execute(query, doc, transaction); |
|
404 | 460 |
} |
405 | 461 |
|
406 | 462 |
transaction.Commit(); |
내보내기 Unified diff