프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / ID2.Manager / ID2.Manager.Dapper / Repository / DocumentRepository.cs @ b1591ae6

이력 | 보기 | 이력해설 | 다운로드 (20.1 KB)

1 5898479a yoush97
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
7 54977253 yoush97
using System.Data;
8
9 5898479a yoush97
using ID2.Manager.Data.Models;
10
11 8e373ccf yoush97
using Dapper;
12 08499f5f taeseongkim
using System.ComponentModel;
13
using System.Reflection;
14 8e373ccf yoush97
15 5898479a yoush97
namespace ID2.Manager.Dapper.Repository
16
{
17
    public class DocumentRepository : BaseRepository
18
    {
19
        public DocumentRepository(string connectionStr) : base(connectionStr) { }
20
21 a4a166e2 yoush97
        public IEnumerable<Documents> GetAllDocuments(string projectGroupID)
22 5898479a yoush97
        {
23 a4a166e2 yoush97
            var dynamicParameters = new DynamicParameters();
24
            StringBuilder sbWhere = new StringBuilder();
25
            var parameters = new Dictionary<string, object>();
26
            if (!string.IsNullOrEmpty(projectGroupID))
27
            {
28
                sbWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID=@RefGroupID) ");
29
                parameters.Add("RefGroupID", projectGroupID);
30
            }
31
32 82705273 yoush97
            try
33
            {
34
                string query = $@"
35 54977253 yoush97
select   doc.*
36 7066b8a9 yoush97
from     dbo.Documents doc
37 a4a166e2 yoush97
where    doc.IsDeleted=0 {sbWhere}
38 7066b8a9 yoush97
order by doc.Seq;";
39 a4a166e2 yoush97
40
                if (parameters.Count > 0)
41
                {
42
                    dynamicParameters.AddDynamicParams(parameters);
43
                }
44
45
                return Query<Documents>(query, dynamicParameters);
46 82705273 yoush97
            }
47
            catch (Exception ex)
48
            {
49
                throw ex;
50
            }
51 7066b8a9 yoush97
        }
52 08499f5f taeseongkim
        static string GetDescriptionFromAttribute(MemberInfo member)
53
        {
54
            if (member == null) return null;
55
56
            var attrib = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(DescriptionAttribute), false);
57
            return (attrib?.Description ?? member.Name).ToLower();
58
        }
59
60 7066b8a9 yoush97
61 ee82162b yoush97
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem)
62 7066b8a9 yoush97
        {
63 08499f5f taeseongkim
            var map = new CustomPropertyTypeMap(typeof(AttFileInfo), (type, columnName)
64
     => type.GetProperties().FirstOrDefault(prop => GetDescriptionFromAttribute(prop) == columnName.ToLower()));
65
            SqlMapper.SetTypeMap(typeof(AttFileInfo), map);
66
67
68 7066b8a9 yoush97
            var dynamicParameters = new DynamicParameters();
69 54977253 yoush97
            dynamicParameters.Add("Total", dbType: DbType.Int32, direction: ParameterDirection.Output);
70 7066b8a9 yoush97
71 8e373ccf yoush97
            StringBuilder sbWhere = new StringBuilder();
72 bf7d1c08 yoush97
            StringBuilder sbTotalWhere = new StringBuilder();
73 8e373ccf yoush97
            var parameters = new Dictionary<string, object>();
74 36a31d25 yoush97
            if (!string.IsNullOrEmpty(projectCode))
75 8e373ccf yoush97
            {
76 36a31d25 yoush97
                sbWhere.Append(" and doc.RefProjectCode=@RefProjectCode ");
77 bf7d1c08 yoush97
                sbTotalWhere.Append(" and doc.RefProjectCode=@RefProjectCode ");
78 36a31d25 yoush97
                parameters.Add("RefProjectCode", projectCode);
79 8e373ccf yoush97
            }
80
            if (!string.IsNullOrEmpty(personIncharge))
81
            {
82
                sbWhere.Append(" and doc.PersonInCharge=@PersonInCharge ");
83
                parameters.Add("PersonInCharge", personIncharge);
84
            }
85 08ea0584 yoush97
            if (!string.IsNullOrEmpty(jobLevel))
86
            {
87
                sbWhere.Append(" and doc.JobLevel=@JobLevel ");
88
                parameters.Add("JobLevel", jobLevel);
89
            }
90 8e373ccf yoush97
            if (!string.IsNullOrEmpty(documentNo))
91
            {
92
                sbWhere.Append(" and doc.DocumentNo like '%' + @DocumentNo +'%' ");
93
                parameters.Add("DocumentNo", documentNo);
94
            }
95
96 296ffcbd yoush97
            if (!string.IsNullOrEmpty(isToIsDiscussion))
97
            {
98
                sbWhere.Append(" and doc.ToIsDiscussion=@ToIsDiscussion ");
99
                parameters.Add("ToIsDiscussion", isToIsDiscussion);
100
            }
101
102
            if (!string.IsNullOrEmpty(isFrReviewStatus))
103
            {
104
                sbWhere.Append(" and doc.FrReviewStatus=@FrReviewStatus ");
105
                parameters.Add("FrReviewStatus", isFrReviewStatus);
106
            }
107
108 08ea0584 yoush97
            if (!string.IsNullOrEmpty(isID2Work))
109
            {
110
                sbWhere.Append(" and doc.IsID2Work=@IsID2Work ");
111
                parameters.Add("IsID2Work", isID2Work);
112
            }
113
114
            if (!string.IsNullOrEmpty(id2Status))
115
            {
116
                sbWhere.Append(" and doc.ID2Status=@ID2Status ");
117
                parameters.Add("ID2Status", id2Status);
118
            }
119
            if (!string.IsNullOrEmpty(avevaStatus))
120
            {
121
                sbWhere.Append(" and doc.AVEVAStatus=@AVEVAStatus ");
122
                parameters.Add("AVEVAStatus", avevaStatus);
123
            }
124
125
            if (!string.IsNullOrEmpty(prodIsResult))
126
            {
127
                sbWhere.Append(" and doc.ProdIsResult=@ProdIsResult ");
128
                parameters.Add("ProdIsResult", prodIsResult);
129
            }
130
            if (!string.IsNullOrEmpty(clientIsResult))
131
            {
132
                sbWhere.Append(" and doc.ClientIsResult=@ClientIsResult ");
133
                parameters.Add("ClientIsResult", clientIsResult);
134
            }
135 ee82162b yoush97
            if (!string.IsNullOrEmpty(isGateWay))
136
            {
137
                sbWhere.Append(" and doc.DTIsGateWay=@DTIsGateWay ");
138
                parameters.Add("DTIsGateWay", isGateWay);
139
            }
140
            if (!string.IsNullOrEmpty(isRegSystem))
141
            {
142
                sbWhere.Append(" and doc.DTIsRegSystem=@DTIsRegSystem ");
143
                parameters.Add("DTIsRegSystem", isRegSystem);
144
            }
145 08ea0584 yoush97
146 82705273 yoush97
            try
147
            {
148 08499f5f taeseongkim
149
                //files.[FileID],files.[FileID] as AttFileID, files.RefID, files.Category, files.FileType, files.FileName, files.FilePath, files.FileExtension, files.FileData, files.Remark, files.CreatedDate, files.Creator,
150
                    string query = $@"
151 f044f53d taeseongkim
                            select  doc.*, datediff(SECOND, doc.ID2StartDate, doc.ID2EndDate) as ID2JobTime,
152 08499f5f taeseongkim
                            files.[FileID] as FileID, files.*,
153
                            markus.MARKUP_DATA_ID as MARKUP_DATA_ID, markus.*, 
154
                            datediff(SECOND, doc.ID2StartDate, doc.ID2EndDate) as ID2JobTime
155 e458a996 taeseongkim
                            from     dbo.Documents doc
156 08499f5f taeseongkim
	                        LEFT OUTER JOIN AttachFIles files ON doc.DocID = fIles.RefID 
157 e458a996 taeseongkim
                            LEFT OUTER JOIN 
158 08499f5f taeseongkim
                                    (SELECT [MARKUP_DATA_ID]
159
                                           ,[PROJECT_NO] as PROJECT_NO
160 e458a996 taeseongkim
                                          ,[DOCUMENT_ID] as DocumentNo
161 08499f5f taeseongkim
                                          
162 e458a996 taeseongkim
                                          ,[PAGENUMBER]
163
                                          ,[Text] as TEXT
164
                                          ,[CREATE_DATE] as CREATE_DATE
165
                                          ,[NAME] as CREATE_USER
166 08499f5f taeseongkim
                                      FROM ViewMarkupData) markus 
167 e458a996 taeseongkim
                            ON doc.DocumentNo = markus.DocumentNo
168
                            where    doc.IsDeleted=0 {sbWhere}
169
                            order by doc.Seq
170 7066b8a9 yoush97
171 3ccb1a8d yoush97
select @Total=count(*) from dbo.Documents doc where doc.IsDeleted=0 {sbTotalWhere}
172 7066b8a9 yoush97
select @Total;";
173 8e373ccf yoush97
174 82705273 yoush97
                if (parameters.Count > 0)
175
                {
176
                    dynamicParameters.AddDynamicParams(parameters);
177
                }
178 5898479a yoush97
179 e458a996 taeseongkim
                var docDictionary = new Dictionary<string, Documents>();
180
181 08499f5f taeseongkim
                var ret = MultiQuery<Documents, AttFileInfo, MarkupText, Documents>(query,
182
                                (document, attfile, markusText) =>
183 e458a996 taeseongkim
                                {
184
                                    Documents doc;
185
186 08499f5f taeseongkim
                                    if (!docDictionary.TryGetValue(document.DocID, out doc))
187 e458a996 taeseongkim
                                    {
188
                                        doc = document;
189 08499f5f taeseongkim
                                        docDictionary.Add(doc.DocID, doc);
190
                                    }
191
192
                                    if (markusText != null)
193
                                    {
194 e458a996 taeseongkim
                                        doc.Markups = doc.Markups ?? new List<MarkupText>();
195 08499f5f taeseongkim
196
                                        if (!doc.Markups.Any(x => x.MARKUP_DATA_ID == markusText.MARKUP_DATA_ID))
197
                                        {
198
                                            doc.Markups.Add(markusText);
199
                                        }
200
                                    }
201
202
                                    if (attfile != null)
203
                                    {
204
                                        doc.AttFiles = doc.AttFiles ?? new List<AttFileInfo>();
205
                                        System.Diagnostics.Debug.WriteLine(attfile.FileName);
206
                                        if (!doc.AttFiles.Any(x => x.FileID == attfile.FileID))
207
                                        {
208
                                            doc.AttFiles.Add(attfile);
209
                                        }
210 e458a996 taeseongkim
                                    }
211
212
                                    return doc;
213
214 08499f5f taeseongkim
                                }, dynamicParameters, splitOn: "DocID,FileID,MARKUP_DATA_ID").Distinct();
215 7066b8a9 yoush97
216 82705273 yoush97
                int totalCount = dynamicParameters.Get<int>("Total");
217 7066b8a9 yoush97
218 82705273 yoush97
                return (ret, totalCount);
219
            }
220
            catch (Exception ex)
221
            {
222
                throw ex;
223
            }
224 5898479a yoush97
        }
225 482f6326 yoush97
226 54977253 yoush97
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList, string userId)
227 482f6326 yoush97
        {
228
            bool isSuccess = false;
229
230
            try
231
            {
232 d2d4f84b yoush97
                using (var transaction = base.BeginTransaction())
233 482f6326 yoush97
                {
234 709c1971 yoush97
                    string query = string.Empty;
235
236
                    if (delDocList.Count > 0)
237 482f6326 yoush97
                    {
238 709c1971 yoush97
                        string docIDList = string.Join("','", delDocList.Where(x => !string.IsNullOrEmpty(x.DocID)).Select(x => x.DocID).ToList());
239
240
                        if (docIDList.Length > 0)
241
                        {
242 53fde692 yoush97
                            query = $@"
243 74aa670a yoush97
update dbo.Documents
244
set    IsDeleted=1
245 54977253 yoush97
      ,DeletedDate=getdate(),
246
      ,DeletedUser=@DeletedUser
247
where  DocID in ('{docIDList}');";
248
                            base.Execute(query, new { DeletedUser = userId }, transaction);
249 709c1971 yoush97
                        }
250
                    }
251 482f6326 yoush97
252
                    foreach (Documents doc in docList)
253
                    {
254
                        if (string.IsNullOrEmpty(doc.DocID))
255
                        {
256 54977253 yoush97
                            doc.RegisteredUser = userId;
257 482f6326 yoush97
                            query = $@"
258 b1591ae6 yoush97
declare @tbdoc table(docid varchar(36))
259 482f6326 yoush97
insert into dbo.Documents
260
(
261 54977253 yoush97
     DocID
262
    ,DocumentNo
263
    ,RevisonNo
264
    ,RefProjectCode
265
    ,DocFilePath
266
    ,DocFileName
267
    ,JobLevel
268
    ,IsTypical
269
    ,PersonInCharge
270
    ,RegisteredDate
271
    ,RegisteredUser
272
    ,ToIsDiscussion
273
    ,ToRemarks
274
    ,ToCreator
275
    ,ToCapture
276
    ,ToIsMarkup
277
    ,FrReviewStatus
278
    ,FrRemarks
279
    ,FrCreator
280
    ,FrCapture
281
    ,FrIsMarkup
282
    ,IsID2Work
283
    ,ID2Connection
284
    ,ID2StartDate
285
    ,ID2EndDate
286
    ,ID2Status
287
    ,ID2Issues
288
    ,AVEVAConnection
289
    ,AVEVAConvertDate
290
    ,AVEVAReviewDate
291
    ,AVEVAStatus
292
    ,AVEVAIssues
293
    ,ReviewFilePath
294
    ,ReviewFileName
295
    ,ProdReviewer
296
    ,ProdIsResult
297
    ,ProdRemarks
298
    ,ClientReviewer
299
    ,ClientIsResult
300
    ,ClientRemarks
301
    ,DTIsGateWay
302
    ,DTIsImport
303
    ,DTIsRegSystem
304
    ,DTRemarks
305 482f6326 yoush97
)
306 b1591ae6 yoush97
output inserted.DocID into @tbdoc
307 482f6326 yoush97
values 
308
(
309
     lower(newid())
310
    ,@DocumentNo
311
    ,@RevisonNo
312 36a31d25 yoush97
    ,@RefProjectCode
313 482f6326 yoush97
    ,@DocFilePath
314
    ,@DocFileName
315
    ,@JobLevel
316
    ,@IsTypical
317
    ,@PersonInCharge
318 54977253 yoush97
    ,getdate()
319
    ,@RegisteredUser
320 482f6326 yoush97
    ,@ToIsDiscussion
321
    ,@ToRemarks
322
    ,@ToCreator
323 00d11333 yoush97
    ,@ToCapture
324 482f6326 yoush97
    ,@ToIsMarkup
325
    ,@FrReviewStatus
326
    ,@FrRemarks
327
    ,@FrCreator
328 00d11333 yoush97
    ,@FrCapture
329 482f6326 yoush97
    ,@FrIsMarkup
330
    ,@IsID2Work
331
    ,@ID2Connection
332
    ,@ID2StartDate
333
    ,@ID2EndDate
334
    ,@ID2Status
335
    ,@ID2Issues
336
    ,@AVEVAConnection
337
    ,@AVEVAConvertDate
338
    ,@AVEVAReviewDate
339
    ,@AVEVAStatus
340
    ,@AVEVAIssues
341
    ,@ReviewFilePath
342
    ,@ReviewFileName
343
    ,@ProdReviewer
344
    ,@ProdIsResult
345
    ,@ProdRemarks
346
    ,@ClientReviewer
347
    ,@ClientIsResult
348
    ,@ClientRemarks
349
    ,@DTIsGateWay
350
    ,@DTIsImport
351
    ,@DTIsRegSystem
352
    ,@DTRemarks
353 b1591ae6 yoush97
)
354
355
if @@rowcount > 0
356
begin
357
    select docid from @tbdoc
358
end
359
else
360
begin
361
    select ''
362
end;";
363 482f6326 yoush97
                        }
364
                        else
365
                        {
366 54977253 yoush97
                            doc.ModifiedUser = userId;
367 482f6326 yoush97
                            query = $@"
368
update dbo.Documents
369 54977253 yoush97
set    DocumentNo=@DocumentNo
370
      ,RevisonNo=@RevisonNo
371
      ,RefProjectCode=@RefProjectCode
372
      ,DocFilePath=@DocFilePath
373
      ,DocFileName=@DocFileName
374
      ,JobLevel=@JobLevel
375
      ,IsTypical=@IsTypical
376
      ,PersonInCharge=@PersonInCharge
377
      ,ModifiedDate=getdate()
378
      ,ModifiedUser=@ModifiedUser
379
      ,ToIsDiscussion=@ToIsDiscussion
380
      ,ToRemarks=@ToRemarks
381
      ,ToCreator=@ToCreator
382
      ,ToCapture=@ToCapture
383
      ,ToIsMarkup=@ToIsMarkup
384
      ,FrReviewStatus=@FrReviewStatus
385
      ,FrRemarks=@FrRemarks
386
      ,FrCreator=@FrCreator
387
      ,FrCapture=@FrCapture
388
      ,FrIsMarkup=@FrIsMarkup
389
      ,IsID2Work=@IsID2Work
390
      ,ID2Connection=@ID2Connection
391
      ,ID2StartDate=@ID2StartDate
392
      ,ID2EndDate=@ID2EndDate
393
      ,ID2Status=@ID2Status
394
      ,ID2Issues=@ID2Issues
395
      ,AVEVAConnection=@AVEVAConnection
396
      ,AVEVAConvertDate=@AVEVAConvertDate
397
      ,AVEVAReviewDate=@AVEVAReviewDate
398
      ,AVEVAStatus=@AVEVAStatus
399
      ,AVEVAIssues=@AVEVAIssues
400
      ,ReviewFilePath=@ReviewFilePath
401
      ,ReviewFileName=@ReviewFileName
402
      ,ProdReviewer=@ProdReviewer
403
      ,ProdIsResult=@ProdIsResult
404
      ,ProdRemarks=@ProdRemarks
405
      ,ClientReviewer=@ClientReviewer
406
      ,ClientIsResult=@ClientIsResult
407
      ,ClientRemarks=@ClientRemarks
408
      ,DTIsGateWay=@DTIsGateWay
409
      ,DTIsImport=@DTIsImport
410
      ,DTIsRegSystem=@DTIsRegSystem
411
      ,DTRemarks=@DTRemarks
412 b1591ae6 yoush97
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
                            }
459 482f6326 yoush97
                        }
460
                    }
461
462
                    transaction.Commit();
463
                    isSuccess = true;
464
                }
465
            }
466
            catch (Exception ex)
467
            {
468
                throw ex;
469
            }
470
471
            return isSuccess;
472
        }
473 978488b0 yoush97
474
        public Documents SetDocumentDataField(Documents doc, string userId)
475
        {
476
            Documents resultData = null;
477
478
            try
479
            {
480
                using (var transaction = base.BeginTransaction())
481
                {
482
                    string query = string.Empty;
483
484
                    if (!string.IsNullOrEmpty(doc.DocID))
485
                    {
486
                        StringBuilder sbSet = new StringBuilder();
487
                        var parameters = new Dictionary<string, object>();
488
489
                        #region Update 할 목록
490
                        if (doc.ID2StartDate != null)
491
                        {
492 4b8d9ad9 yoush97
                            sbSet.Append(" ,ID2StartDate=(case when ID2StartDate is null then @DateTimeNow else ID2StartDate end) ");
493 978488b0 yoush97
                            parameters.Add("ID2StartDate", doc.ID2StartDate);
494
                        }
495 4b8d9ad9 yoush97
496
                        if (doc.Worker != null)
497
                        {
498
                            sbSet.Append(" ,Worker=@Worker ");
499
                            parameters.Add("Worker", doc.Worker);
500
                        }
501 978488b0 yoush97
                        #endregion
502
503
                        if (parameters.Count > 0)
504
                        {
505
                            sbSet.Append(" ,ModifiedUser=@ModifiedUser ");
506
                            parameters.Add("ModifiedUser", userId);
507
508 54977253 yoush97
                            parameters.Add("DocID", doc.DocID);
509
510 978488b0 yoush97
                            query = $@"
511
declare @DateTimeNow datetime
512
set @DateTimeNow = getdate()
513
514
update dbo.Documents
515
set    ModifiedDate=@DateTimeNow {sbSet}
516
where  [DocID]=@DocID
517
518
if @@rowcount > 0
519
begin
520 c0420a29 yoush97
    select *, datediff(SECOND, ID2StartDate, ID2EndDate) as ID2JobTime from dbo.Documents where DocID=@DocID
521 978488b0 yoush97
end
522
else
523
begin
524 c0420a29 yoush97
    select *, 0 as ID2JobTime from dbo.Documents where 1=2
525 978488b0 yoush97
end;";
526
                            resultData = base.QueryFirstOrDefault<Documents>(query, parameters, transaction);
527
                        }
528
                    }
529
530
                    transaction.Commit();
531
                }
532
            }
533
            catch (Exception ex)
534
            {
535
                throw ex;
536
            }
537
538
            return resultData;
539
        }
540 fe57f64a yoush97
541 54977253 yoush97
        public bool SetDocumentDatasField(List<Documents> docs, string userId)
542
        {
543
            bool isSuccess = false;
544
545
            try
546
            {
547
                using (var transaction = base.BeginTransaction())
548
                {
549
                    foreach (Documents doc in docs)
550
                    {
551
                        string query = string.Empty;
552
553
                        if (!string.IsNullOrEmpty(doc.DocID))
554
                        {
555
                            StringBuilder sbSet = new StringBuilder();
556
                            var parameters = new Dictionary<string, object>();
557
558
                            #region Update 할 목록
559
                            if (doc.ID2EndDate != null)
560
                            {
561
                                sbSet.Append(" ,ID2EndDate=@ID2EndDate ");
562
                                parameters.Add("ID2EndDate", doc.ID2EndDate);
563
                            }
564
                            #endregion
565
566
                            if (parameters.Count > 0)
567
                            {
568
                                sbSet.Append(" ,ModifiedUser=@ModifiedUser ");
569
                                parameters.Add("ModifiedUser", userId);
570
571
                                parameters.Add("DocID", doc.DocID);
572
573
                                query = $@"
574
update dbo.Documents
575
set    ModifiedDate=getdate() {sbSet}
576
where  [DocID]=@DocID;";
577 e458a996 taeseongkim
                                base.Execute(query, parameters, transaction);
578 54977253 yoush97
                            }
579
                        }
580
                    }
581
                    transaction.Commit();
582
                    isSuccess = true;
583
                }
584
            }
585
            catch (Exception ex)
586
            {
587
                throw ex;
588
            }
589
590
            return isSuccess;
591
        }
592
593 fe57f64a yoush97
594
        //ID2
595
        public IEnumerable<ID2Drawings> GetID2DrawingsByProject(ID2ProjectInfo id2Info)
596
        {
597 82705273 yoush97
            try
598
            {
599
                string query = $@"
600 fe57f64a yoush97
select @Name PROJECTNAME
601
      ,dw.[UID], dw.[NAME], left(dw.[NAME], len(dw.[NAME]) - dw.lastidx) DOCNAME
602
      ,case when rtrim(ltrim(isnull(convert(varchar, dw.[DATETIME]),''))) = '' then null else convert(datetime, convert(varchar, dw.[DATETIME])) end [DATETIME]
603
      ,dw.OCCUPIED, dw.[Image]
604
from
605
(
606
    select [UID], [NAME], [DATETIME], OCCUPIED, [Image], charindex('.', reverse([NAME])) lastidx
607
    from   dbo.Drawings
608
) dw;";
609 82705273 yoush97
                return Query<ID2Drawings>(query, id2Info);
610
            }
611
            catch (Exception ex)
612
            {
613
                throw ex;
614
            }
615 fe57f64a yoush97
        }
616 5898479a yoush97
    }
617 d2d4f84b yoush97
}
클립보드 이미지 추가 (최대 크기: 500 MB)