프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Common / Helpers / ID2Excel.cs @ 4b9f349c

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

1
using ID2.Manager.Data.Models;
2
using System;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Text;
6
using System.Threading.Tasks;
7

    
8
using System.IO;
9
using System.IO.Compression;
10

    
11
using GemBox.Spreadsheet;
12

    
13
namespace ID2.Manager.Common.Helpers
14
{
15
    public class ID2Excel :IDisposable
16
    {
17
        private List<UserInfo> UserlList = new List<UserInfo>();
18

    
19

    
20
        public void Dispose()
21
        {
22
            try
23
            {
24
            }
25
            catch (Exception)
26
            {
27
                throw;
28
            }
29
            finally
30
            {
31
                GC.Collect(2);
32
                GC.Collect(2);
33
            }
34
        }
35

    
36
        public ID2Excel(List<UserInfo> users)
37
        {
38
            UserlList = users;
39
        }
40

    
41
        private UserInfo GetUser(string user)
42
        {
43
            UserInfo userInfo = UserlList.Where(x => x.ID.Equals(user)).FirstOrDefault();
44
            if (userInfo != null) return userInfo;
45

    
46
            userInfo = UserlList.Where(x => x.Name.Equals(user)).FirstOrDefault();
47
            if (userInfo != null) return userInfo;
48

    
49
            return userInfo ?? new UserInfo();
50
        }
51

    
52
        private string GetColumnName(int column)
53
        {
54
            int dividend = column;
55
            string columnName = string.Empty;
56

    
57
            while (dividend > 0)
58
            {
59
                int modulo = (dividend - 1) % 26;
60
                columnName = Convert.ToChar(65 + modulo) + columnName;
61
                dividend = (dividend - modulo) / 26;
62
            }
63

    
64
            return columnName;
65
        }
66

    
67
        private System.Drawing.Image GetImage(string base64String)
68
        {
69
            System.Drawing.Image result = null;
70
            
71
            var str =  CompressHelper.DecompressString(base64String);
72

    
73
            byte[] imageBytes = Convert.FromBase64String(str);
74

    
75
            using (MemoryStream ms = new MemoryStream(imageBytes))
76
            {
77
                result = System.Drawing.Image.FromStream(ms);
78
            }
79

    
80
            return result;
81
        }
82

    
83
        private byte[] ExcelToImageData(string base64String)
84
        {
85
            var str = CompressHelper.DecompressString(base64String);
86

    
87
            return Convert.FromBase64String(str);
88
        }
89

    
90

    
91
        public ImportResult ExcelDataImport(List<ExcelData> ExcelData)
92
        {
93
            ImportResult result = new ImportResult();
94

    
95
            StringBuilder sbErrMsg = new StringBuilder();
96

    
97
            try
98
            {
99
                int rowCount = ExcelData.Max(x=>x.ROW_INDEX);
100
                int columnCount = ExcelData.Max(x => x.COUMMN_INDEX);
101
                int exRow = 9;
102

    
103
                #region Excel 유효성검사
104

    
105
                //Excel 포멧체크
106
                if (rowCount < 10 || columnCount != 48)
107
                {
108
                    result.Error = "Please, check the excel.";
109
                    return result;
110
                }
111

    
112
                #region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical)
113
                ExcelData.Where(col => col.ROW_INDEX > exRow)
114
                        .Where(col => col.COUMMN_INDEX > 7 && col.COUMMN_INDEX < 17 && col.ROW_INDEX > exRow && string.IsNullOrEmpty(col.VALUE))
115
                       .ToList()
116
                       .ForEach(p => sbErrMsg.Append(", " + p.TopLeftCell));
117

    
118
                if (sbErrMsg.Length > 0)
119
                {
120
                    string errMsg = sbErrMsg.ToString().Substring(2);
121
                    if (errMsg.Length > 100)
122
                    {
123
                        errMsg = $"{errMsg.Substring(0, 100)}...";
124
                    }
125

    
126
                    result.Error = $"Please, check null value in excel.\n{errMsg}";
127
                    return result;
128
                }
129
                #endregion
130

    
131
                #region 엑셀 도면명 중복 값 체크
132
                ExcelData.Where(col => col.COUMMN_INDEX == 11 && col.ROW_INDEX > exRow)
133
                        .GroupBy(g => g.ROW_INDEX)
134
                        .Select(p => new
135
                        {
136
                            rowIndex = p.Key,
137
                            docNo = p.Select(x => x.VALUE.ToString()).FirstOrDefault()
138
                        })
139
                        .GroupBy(g => g.docNo)
140
                        .Where(p => p.Count() > 1)
141
                        .Select(p => p.Select(x => x.rowIndex.ToString())
142
                                                                .Aggregate((x, y) => x.ToString() + "," + y.ToString())
143
                                                                .ToString())
144
                        .ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString()));
145

    
146
                if (sbErrMsg.Length > 0)
147
                {
148
                    sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : ");
149
                    string errMsg = sbErrMsg.ToString();
150
                    if (errMsg.Length > 100)
151
                    {
152
                        errMsg = $"{errMsg.Substring(0, 100)}...";
153
                    }
154

    
155
                    result.Error = $"Please, check the duplicate value in excel.\n{errMsg}";
156
                    return result;
157
                }
158
                #endregion
159

    
160
                #endregion
161

    
162
                result.documents = new List<Documents>();
163
                result.Images = new List<System.Drawing.Image>();
164

    
165
                foreach (var row in ExcelData.Where(row => row.ROW_INDEX > exRow).GroupBy(x => x.ROW_INDEX))
166
                {
167
                    var document = new Documents();
168
                    //document.DocID = Guid.NewGuid().ToString();
169

    
170
                    foreach (var cell in row.OrderBy(x=>x.COUMMN_INDEX))
171
                    {
172
                        var value = cell.VALUE.DefalutValue();
173

    
174
                        switch (cell.COUMMN_INDEX)
175
                        {
176
                            case 8:
177
                                document.RefProjectCode = value;
178
                                break;
179
                            case 9:
180
                                document.System = value;
181
                                break;
182
                            case 10:
183
                                document.SubSystemCode = value;
184
                                break;
185
                            case 11:
186
                                document.DocumentNo = value;
187
                                break;
188
                            case 12:
189
                                document.PersonInCharge = this.GetUser(value).ID;
190
                                break;
191
                            case 13:
192
                                document.Worker = this.GetUser(value).ID;
193
                                break;
194
                            case 14:
195
                                document.AVEVAPersonInCharge = this.GetUser(value).ID;
196
                                break;
197
                            case 15:
198
                                document.AVEVAWorker = this.GetUser(value).ID;
199
                                break;
200
                            case 16:
201
                                document.JobLevel = value;
202
                                break;
203
                            case 17:
204
                                document.RevisonNo = value;
205
                                break;
206
                            case 18:
207
                                document.ToIsDiscussion = value;
208
                                break;
209
                            case 19:
210
                                document.ToRemarks = value;
211
                                break;
212
                            case 20:
213
                                document.ToCreator = this.GetUser(value).ID;
214
                                break;
215
                            case 21:
216
                                if (value != null)
217
                                {
218
                                    if (document.AttFiles == null)
219
                                    {
220
                                        document.AttFiles = new List<AttFileInfo>();
221
                                    }
222

    
223
                                    document.AttFiles.Add(new AttFileInfo
224
                                    {
225
                                        FileID = Guid.NewGuid().ToString(),
226
                                        //RefID = document.DocID,
227
                                        Category = "toreview",
228
                                        FileType = "image/png",
229
                                        FileName = "ClipBoard",
230
                                        FilePath = "ClipBoard",
231
                                        FileExtension = ".png",
232
                                        CreatedDate = DateTime.Now,
233
                                        Creator = document.ToCreator,
234
                                        FileData = ExcelToImageData(value)
235

    
236
                                    });
237
                                }
238
                                break;
239
                            case 22:
240
                                document.FrReviewStatus = value;
241
                                break;
242
                            case 23:
243
                                document.FrRemarks = value;
244
                                break;
245
                            case 24:
246
                                document.FrCreator = this.GetUser(value).ID;
247
                                break;
248
                            case 25:
249
                                if (value != null)
250
                                {
251
                                    if (document.AttFiles == null)
252
                                    {
253
                                        document.AttFiles = new List<AttFileInfo>();
254
                                    }
255

    
256
                                    document.AttFiles.Add(new AttFileInfo
257
                                    {
258
                                        FileID = Guid.NewGuid().ToString(),
259
                                        //RefID = document.DocID,
260
                                        Category = "frreview",
261
                                        FileType = "image/png",
262
                                        FileName = "ClipBoard",
263
                                        FilePath = "ClipBoard",
264
                                        FileExtension = ".png",
265
                                        CreatedDate = DateTime.Now,
266
                                        Creator = document.FrCreator,
267
                                        FileData = ExcelToImageData(value)
268

    
269
                                    });
270
                                }
271
                                break;
272
                            case 26:
273
                                document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
274
                                break;
275
                            case 27:
276
                                document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
277
                                break;
278
                            case 28:
279
                                document.ID2Status = value;
280
                                break;
281
                            case 29:
282
                                document.ID2Issues = value;
283
                                break;
284
                            case 30:
285
                                if (value != null)
286
                                {
287
                                    if (document.AttFiles == null)
288
                                    {
289
                                        document.AttFiles = new List<AttFileInfo>();
290
                                    }
291

    
292
                                    document.AttFiles.Add(new AttFileInfo
293
                                    {
294
                                        FileID = Guid.NewGuid().ToString(),
295
                                        //RefID = document.DocID,
296
                                        Category = "id2work",
297
                                        FileType = "image/png",
298
                                        FileName = "ClipBoard",
299
                                        FilePath = "ClipBoard",
300
                                        FileExtension = ".png",
301
                                        CreatedDate = DateTime.Now,
302
                                        Creator = document.FrCreator,
303
                                        FileData = ExcelToImageData(value)
304

    
305
                                    });
306
                                }
307
                                break;
308
                            case 31:
309
                                document.ReplyModifications = value;
310
                                break;
311
                            case 32:
312
                                document.ReplyRequester = value;
313
                                break;
314
                            case 33:
315
                                document.IsConvert = value;
316
                                break;
317
                            case 34:
318
                                document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
319
                                break;
320
                            case 35:
321
                                document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
322
                                break;
323
                            case 36:
324
                                document.AVEVAStatus = value;
325
                                break;
326
                            case 37:
327
                                document.AVEVAIssues = value;
328
                                break;
329
                            case 38:
330
                                document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value);
331
                                break;
332
                            case 39:
333
                                document.ProdReviewer = this.GetUser(value).ID;
334
                                break;
335
                            case 40:
336
                                document.ProdIsResult = value;
337
                                break;
338
                            case 41:
339
                                document.ProdRemarks = value;
340
                                break;
341
                            case 42:
342
                                document.ClientReviewer = this.GetUser(value).ID;
343
                                break;
344
                            case 43:
345
                                document.ClientIsResult = value;
346
                                break;
347
                            case 44:
348
                                document.ClientRemarks = value;
349
                                break;
350
                            case 45:
351
                                document.DTIsGateWay = value;
352
                                break;
353
                            case 46:
354
                                document.DTIsImport = value;
355
                                break;
356
                            case 47:
357
                                document.DTIsRegSystem = value;
358
                                break;
359
                            case 48:
360
                                document.DTRemarks = value;
361
                                break;
362
                        }
363
                    }
364

    
365
                    result.documents.Add(document);
366
                }
367
            }
368
            catch (Exception)
369
            {
370
                throw;
371
            }
372

    
373
            return result;
374
        }
375

    
376

    
377
        public ImportResult GemboxImport(string fileName)
378
        {
379
            ImportResult result = new ImportResult();
380

    
381
            StringBuilder sbErrMsg = new StringBuilder();
382

    
383
            try
384
            {
385
                var exFile = ExcelFile.Load(fileName);
386
                var ws = exFile.Worksheets[0];
387

    
388
                int rowCount = ws.Rows.Count;
389
                int columnCount = ws.CalculateMaxUsedColumns();
390
                int exRow = 8;
391

    
392
                #region Excel 유효성검사
393

    
394
                //Excel 포멧체크
395
                if (rowCount < 10 || columnCount != 48)
396
                {
397
                    result.Error = "Please, check the excel.";
398
                    return result;
399
                }
400

    
401
                #region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical)
402
                ws.Rows.SelectMany(row => row.AllocatedCells)
403
                       .Where(col => col.Column.Index > 7 && col.Column.Index < 17 && col.Row.Index > exRow && col.Value == null)
404
                       .ToList()
405
                       .ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name));
406

    
407
                if (sbErrMsg.Length > 0)
408
                {
409
                    string errMsg = sbErrMsg.ToString().Substring(2);
410
                    if (errMsg.Length > 100)
411
                    {
412
                        errMsg = $"{errMsg.Substring(0, 100)}...";
413
                    }
414

    
415
                    result.Error = $"Please, check null value in excel.\n{errMsg}";
416
                    return result;
417
                }
418
                #endregion
419

    
420
                #region 엑셀 도면명 중복 값 체크
421
                ws.Rows.SelectMany(row => row.AllocatedCells)
422
                                             .Where(col => col.Column.Index == 11 && col.Row.Index > exRow)
423
                                             .GroupBy(g => g.Row.Index)
424
                                             .Select(p => new
425
                                             {
426
                                                 rowIndex = p.Key,
427
                                                 docNo = p.Select(x => x.Value.ToString()).FirstOrDefault()
428
                                             })
429
                                             .GroupBy(g => g.docNo)
430
                                             .Where(p => p.Count() > 1)
431
                                             .Select(p => p.Select(x => (x.rowIndex + 1).ToString())
432
                                                                                        .Aggregate((x, y) => x.ToString() + "," + y.ToString())
433
                                                                                        .ToString())
434
                                             .ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString()));
435
                if (sbErrMsg.Length > 0)
436
                {
437
                    sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : ");
438
                    string errMsg = sbErrMsg.ToString();
439
                    if (errMsg.Length > 100)
440
                    {
441
                        errMsg = $"{errMsg.Substring(0, 100)}...";
442
                    }
443

    
444
                    result.Error = $"Please, check the duplicate value in excel.\n{errMsg}";
445
                    return result;
446
                }
447
                #endregion
448

    
449
                #endregion
450

    
451
                result.documents = new List<Documents>();
452

    
453
                ws.Rows.Where(row => row.Index > exRow)
454
                       .ToList()
455
                       .ForEach(p =>
456
                       {
457
                           try
458
                           {
459
                               result.documents.Add(new Documents()
460
                               {
461
                                   RefProjectCode = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[7].Value.ToString(),
462
                                   System = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(),
463
                                   SubSystemCode = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(),
464
                                   DocumentNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(),
465
                                   PersonInCharge = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[11].Value.ToString()).ID,
466
                                   Worker = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[12].Value.ToString()).ID,
467
                                   AVEVAPersonInCharge = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID,
468
                                   AVEVAWorker = ws.Rows[p.Index].Cells[14].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[14].Value.ToString()).ID,
469
                                   JobLevel = ws.Rows[p.Index].Cells[15].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[15].Value.ToString(),
470
                                   RevisonNo = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(),
471
                                   ToIsDiscussion = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(),
472
                                   ToRemarks = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[18].Value.ToString(),
473
                                   ToCreator = ws.Rows[p.Index].Cells[19].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[19].Value.ToString()).ID,
474
                                   //toreview-20
475
                                   FrReviewStatus = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(),
476
                                   FrRemarks = ws.Rows[p.Index].Cells[22].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[22].Value.ToString(),
477
                                   FrCreator = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[23].Value.ToString()).ID,
478
                                   //frreview-24
479
                                   ID2StartDate = ws.Rows[p.Index].Cells[25].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[25].Value?.ToString()),
480
                                   ID2EndDate = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[26].Value?.ToString()),
481
                                   ID2Status = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(),
482
                                   ID2Issues = ws.Rows[p.Index].Cells[28].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[28].Value.ToString(),
483
                                   //id2work-29
484
                                   ReplyModifications = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[30].Value.ToString(),
485
                                   ReplyRequester = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(),
486
                                   IsConvert = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(),
487
                                   AVEVAConvertDate = ws.Rows[p.Index].Cells[33].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[33].Value.ToString()),
488
                                   AVEVAWorkDate = ws.Rows[p.Index].Cells[34].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[34].Value.ToString()),
489
                                   AVEVAStatus = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[35].Value.ToString(),
490
                                   AVEVAIssues = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(),
491
                                   AVEVAReviewDate = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[37].Value.ToString()),
492
                                   ProdReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID,
493
                                   ProdIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(),
494
                                   ProdRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(),
495
                                   ClientReviewer = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[41].Value.ToString()).ID,
496
                                   ClientIsResult = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(),
497
                                   ClientRemarks = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(),
498
                                   DTIsGateWay = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString(),
499
                                   DTIsImport = ws.Rows[p.Index].Cells[45].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[45].Value.ToString(),
500
                                   DTIsRegSystem = ws.Rows[p.Index].Cells[46].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[46].Value.ToString(),
501
                                   DTRemarks = ws.Rows[p.Index].Cells[47].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[47].Value.ToString()
502

    
503
                                   /*
504
                                   //UID = string.Empty,
505
                                   //Type = this.radTextBoxInsulationType.Text,
506
                                   //TempFrom = ws.Rows[exRow].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value),
507
                                   //TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value),
508
                                   //NPS = ws.Rows[p.Row.Index].Cells[0].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value),
509
                                   //Thickness = p.IsNullOrEmpty() ? 0 : Convert.ToSingle(p.Value)
510

    
511
                                   RefProjectCode = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
512
                                   DocumentNo = ws.Rows[p.Index].Cells[6].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(),
513
                                   PersonInCharge = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID,
514
                                   JobLevel = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(),
515
                                   //IsTypical = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(),
516
                                   RevisonNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(),
517
                                   ToIsDiscussion = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(),
518
                                   ToRemarks = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(),
519
                                   ToCreator = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID,
520
                                   //ToCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
521
                                   //ToIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
522
                                   FrReviewStatus = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(),
523
                                   FrRemarks = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(),
524
                                   FrCreator = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID,
525
                                   //FrCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
526
                                   //FrIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
527
                                   //IsID2Work = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(),
528
                                   //ID2Connection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
529
                                   ID2StartDate = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()),
530
                                   ID2EndDate = ws.Rows[p.Index].Cells[24].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()),
531
                                   //ID2JobTime = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
532
                                   ID2Status = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(),
533
                                   ID2Issues = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(),
534
                                   //AVEVAConnection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
535
                                   AVEVAConvertDate = ws.Rows[p.Index].Cells[29].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()),
536
                                   AVEVAReviewDate = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()),
537
                                   //AVEVAWorkDate 추가필요
538
                                   AVEVAStatus = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(),
539
                                   AVEVAIssues = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(),
540
                                   ProdReviewer = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID,
541
                                   ProdIsResult = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(),
542
                                   ProdRemarks = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(),
543
                                   ClientReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID,
544
                                   ClientIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(),
545
                                   ClientRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(),
546
                                   DTIsGateWay = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(),
547
                                   DTIsImport = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(),
548
                                   DTIsRegSystem = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(),
549
                                   DTRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString()
550
                                   */
551
                               });
552
                            }
553
                           catch (Exception ex)
554
                           {
555
                               throw new Exception($"Excel Import Row :{p.Index} Error.",ex);
556
                           }
557
                       });
558

    
559
            }
560
            catch (Exception)
561
            {
562
                throw;
563
            }
564

    
565
            return result;
566
        }
567
    }
568
}
클립보드 이미지 추가 (최대 크기: 500 MB)