hytos / ID2.Manager / ID2.Manager.Common / Helpers / ID2Excel.cs @ dfb9a03c
이력 | 보기 | 이력해설 | 다운로드 (33.9 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 |
readonly Informations informations = Informations.Instance; |
18 |
|
19 |
public void Dispose() |
20 |
{ |
21 |
try |
22 |
{ |
23 |
} |
24 |
catch (Exception) |
25 |
{ |
26 |
throw; |
27 |
} |
28 |
finally |
29 |
{ |
30 |
GC.Collect(2); |
31 |
GC.Collect(2); |
32 |
} |
33 |
} |
34 |
|
35 |
public ID2Excel() { } |
36 |
|
37 |
private ProjectInfo GetProject(string project) |
38 |
{ |
39 |
//List<ProjectInfo> projects = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
40 |
List<ProjectInfo> projects = (from allPrj in informations.ProjectList |
41 |
join actPrj in informations.ActiveProjects on allPrj.GroupID equals actPrj.ProjectID |
42 |
select allPrj).ToList(); |
43 |
|
44 |
ProjectInfo prjInfo = projects.FirstOrDefault(x => x.Code.Equals(project)); |
45 |
if (prjInfo != null) return prjInfo; |
46 |
|
47 |
prjInfo = projects.FirstOrDefault(x => x.Name.Equals(project)); |
48 |
if (prjInfo != null) return prjInfo; |
49 |
|
50 |
return prjInfo ?? new ProjectInfo(); |
51 |
} |
52 |
|
53 |
private UserInfo GetUser(string user) |
54 |
{ |
55 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
56 |
if (userInfo != null) return userInfo; |
57 |
|
58 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
59 |
if (userInfo != null) return userInfo; |
60 |
|
61 |
return userInfo ?? new UserInfo(); |
62 |
} |
63 |
|
64 |
private string GetColumnName(int column) |
65 |
{ |
66 |
int dividend = column; |
67 |
string columnName = string.Empty; |
68 |
|
69 |
while (dividend > 0) |
70 |
{ |
71 |
int modulo = (dividend - 1) % 26; |
72 |
columnName = Convert.ToChar(65 + modulo) + columnName; |
73 |
dividend = (dividend - modulo) / 26; |
74 |
} |
75 |
|
76 |
return columnName; |
77 |
} |
78 |
|
79 |
private System.Drawing.Image GetImage(string base64String) |
80 |
{ |
81 |
System.Drawing.Image result = null; |
82 |
|
83 |
var str = CompressHelper.DecompressString(base64String); |
84 |
|
85 |
byte[] imageBytes = Convert.FromBase64String(str); |
86 |
|
87 |
using (MemoryStream ms = new MemoryStream(imageBytes)) |
88 |
{ |
89 |
result = System.Drawing.Image.FromStream(ms); |
90 |
} |
91 |
|
92 |
return result; |
93 |
} |
94 |
|
95 |
private byte[] ExcelToImageData(string base64String) |
96 |
{ |
97 |
var str = CompressHelper.DecompressString(base64String); |
98 |
|
99 |
return Convert.FromBase64String(str); |
100 |
} |
101 |
|
102 |
|
103 |
public ImportResult ExcelDataImport(List<ExcelData> ExcelData) |
104 |
{ |
105 |
ImportResult result = new ImportResult(); |
106 |
|
107 |
StringBuilder sbErrMsg = new StringBuilder(); |
108 |
|
109 |
try |
110 |
{ |
111 |
int rowCount = ExcelData.Max(x => x.ROW_INDEX); |
112 |
int columnCount = ExcelData.Max(x => x.COUMMN_INDEX); |
113 |
int exRow = 9; |
114 |
|
115 |
#region Excel 유효성검사 |
116 |
|
117 |
//Excel 포멧체크 |
118 |
if (rowCount < 10 || columnCount != 49) |
119 |
{ |
120 |
result.Error = "Please, check the excel."; |
121 |
return result; |
122 |
} |
123 |
|
124 |
#region 엑셀 필수값 체크(9: ID2 Project, 12 : DWG_ID) |
125 |
//ExcelData.Where(col => col.ROW_INDEX > exRow) |
126 |
// .Where(col => col.COUMMN_INDEX > 8 && col.COUMMN_INDEX < 18 && col.ROW_INDEX > exRow && string.IsNullOrEmpty(col.VALUE)) |
127 |
// .ToList() |
128 |
// .ForEach(p => sbErrMsg.Append(", " + p.TopLeftCell)); |
129 |
|
130 |
ExcelData.Where(col => col.ROW_INDEX > exRow) |
131 |
.Where(col => (col.COUMMN_INDEX == 9 || col.COUMMN_INDEX == 12) && string.IsNullOrEmpty(col.VALUE)) |
132 |
.ToList() |
133 |
.ForEach(p => sbErrMsg.Append(", " + p.TopLeftCell)); |
134 |
|
135 |
if (sbErrMsg.Length > 0) |
136 |
{ |
137 |
string errMsg = sbErrMsg.ToString().Substring(2); |
138 |
if (errMsg.Length > 100) |
139 |
{ |
140 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
141 |
} |
142 |
|
143 |
result.Error = $"Please, check null value in excel.\n{errMsg}"; |
144 |
return result; |
145 |
} |
146 |
#endregion |
147 |
|
148 |
#region 엑셀 도면명 중복 값 체크 |
149 |
ExcelData.Where(col => col.COUMMN_INDEX == 12 && col.ROW_INDEX > exRow) |
150 |
.GroupBy(g => g.ROW_INDEX) |
151 |
.Select(p => new |
152 |
{ |
153 |
rowIndex = p.Key, |
154 |
docNo = p.Select(x => x.VALUE.ToString()).FirstOrDefault() |
155 |
}) |
156 |
.GroupBy(g => g.docNo) |
157 |
.Where(p => p.Count() > 1) |
158 |
.Select(p => p.Select(x => x.rowIndex.ToString()) |
159 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
160 |
.ToString()) |
161 |
.ToList() |
162 |
.ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
163 |
|
164 |
if (sbErrMsg.Length > 0) |
165 |
{ |
166 |
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
167 |
string errMsg = sbErrMsg.ToString(); |
168 |
if (errMsg.Length > 100) |
169 |
{ |
170 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
171 |
} |
172 |
|
173 |
result.Error = $"Please, check the duplicate value in excel.\n{errMsg}"; |
174 |
return result; |
175 |
} |
176 |
#endregion |
177 |
|
178 |
#endregion |
179 |
|
180 |
result.documents = new List<Documents>(); |
181 |
result.Images = new List<System.Drawing.Image>(); |
182 |
|
183 |
foreach (var row in ExcelData.Where(row => row.ROW_INDEX > exRow).GroupBy(x => x.ROW_INDEX)) |
184 |
{ |
185 |
var document = new Documents(); |
186 |
//document.DocID = Guid.NewGuid().ToString(); |
187 |
|
188 |
int toreview = 0; |
189 |
int frreview = 0; |
190 |
int id2work = 0; |
191 |
|
192 |
foreach (var cell in row.OrderBy(x => x.COUMMN_INDEX)) |
193 |
{ |
194 |
var value = cell.VALUE.DefalutValue(); |
195 |
|
196 |
switch (cell.COUMMN_INDEX) |
197 |
{ |
198 |
case 9: |
199 |
var prjInfo = this.GetProject(value); |
200 |
//document.RefProjectCode = prjInfo.Code; |
201 |
document.RefProjectCode = string.IsNullOrEmpty(value) ? value : value.Trim(); |
202 |
if (!string.IsNullOrEmpty(document.RefProjectCode)) |
203 |
{ |
204 |
document.Team = prjInfo.Team; |
205 |
} |
206 |
break; |
207 |
case 10: |
208 |
document.System = value; |
209 |
break; |
210 |
case 11: |
211 |
document.SubSystemCode = value; |
212 |
break; |
213 |
case 12: |
214 |
document.DocumentNo = string.IsNullOrEmpty(value) ? value : value.Trim(); |
215 |
break; |
216 |
case 13: |
217 |
document.PersonInCharge = this.GetUser(value).ID; |
218 |
break; |
219 |
case 14: |
220 |
document.Worker = this.GetUser(value).ID; |
221 |
break; |
222 |
case 15: |
223 |
document.AVEVAPersonInCharge = this.GetUser(value).ID; |
224 |
break; |
225 |
case 16: |
226 |
document.AVEVAWorker = this.GetUser(value).ID; |
227 |
break; |
228 |
case 17: |
229 |
document.JobLevel = value; |
230 |
break; |
231 |
case 18: |
232 |
document.RevisonNo = value; |
233 |
break; |
234 |
case 19: |
235 |
document.ToIsDiscussion = value; |
236 |
break; |
237 |
case 20: |
238 |
document.ToRemarks = value; |
239 |
break; |
240 |
case 21: |
241 |
document.ToCreator = this.GetUser(value).ID; |
242 |
break; |
243 |
case 22: |
244 |
if (value != null) |
245 |
{ |
246 |
if (document.AttFiles == null) |
247 |
{ |
248 |
document.AttFiles = new List<AttFileInfo>(); |
249 |
} |
250 |
|
251 |
document.AttFiles.Add(new AttFileInfo |
252 |
{ |
253 |
FileID = Guid.NewGuid().ToString(), |
254 |
//RefID = document.DocID, |
255 |
Category = "toreview", |
256 |
FileType = "image/png", |
257 |
FileName = "ClipBoard", |
258 |
FilePath = "ClipBoard", |
259 |
FileExtension = ".png", |
260 |
CreatedDate = DateTime.Now, |
261 |
Creator = document.ToCreator, |
262 |
FileData = ExcelToImageData(value) |
263 |
|
264 |
}); |
265 |
|
266 |
document.ToCapture = ++toreview; |
267 |
} |
268 |
break; |
269 |
case 23: |
270 |
document.FrReviewStatus = value; |
271 |
break; |
272 |
case 24: |
273 |
document.FrRemarks = value; |
274 |
break; |
275 |
case 25: |
276 |
document.FrCreator = this.GetUser(value).ID; |
277 |
break; |
278 |
case 26: |
279 |
if (value != null) |
280 |
{ |
281 |
if (document.AttFiles == null) |
282 |
{ |
283 |
document.AttFiles = new List<AttFileInfo>(); |
284 |
} |
285 |
|
286 |
document.AttFiles.Add(new AttFileInfo |
287 |
{ |
288 |
FileID = Guid.NewGuid().ToString(), |
289 |
//RefID = document.DocID, |
290 |
Category = "frreview", |
291 |
FileType = "image/png", |
292 |
FileName = "ClipBoard", |
293 |
FilePath = "ClipBoard", |
294 |
FileExtension = ".png", |
295 |
CreatedDate = DateTime.Now, |
296 |
Creator = document.FrCreator, |
297 |
FileData = ExcelToImageData(value) |
298 |
|
299 |
}); |
300 |
|
301 |
document.FrCapture = ++frreview; |
302 |
} |
303 |
break; |
304 |
case 27: |
305 |
document.ID2StartDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
306 |
break; |
307 |
case 28: |
308 |
document.ID2EndDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
309 |
break; |
310 |
case 29: |
311 |
document.ID2Status = value; |
312 |
break; |
313 |
case 30: |
314 |
document.ID2Issues = value; |
315 |
break; |
316 |
case 31: |
317 |
if (value != null) |
318 |
{ |
319 |
if (document.AttFiles == null) |
320 |
{ |
321 |
document.AttFiles = new List<AttFileInfo>(); |
322 |
} |
323 |
|
324 |
document.AttFiles.Add(new AttFileInfo |
325 |
{ |
326 |
FileID = Guid.NewGuid().ToString(), |
327 |
//RefID = document.DocID, |
328 |
Category = "id2work", |
329 |
FileType = "image/png", |
330 |
FileName = "ClipBoard", |
331 |
FilePath = "ClipBoard", |
332 |
FileExtension = ".png", |
333 |
CreatedDate = DateTime.Now, |
334 |
Creator = document.FrCreator, |
335 |
FileData = ExcelToImageData(value) |
336 |
|
337 |
}); |
338 |
|
339 |
document.ID2Capture = ++id2work; |
340 |
} |
341 |
break; |
342 |
case 32: |
343 |
document.ReplyModifications = value; |
344 |
break; |
345 |
case 33: |
346 |
document.ReplyRequester = this.GetUser(value).ID; |
347 |
break; |
348 |
case 34: |
349 |
document.IsConvert = value; |
350 |
break; |
351 |
case 35: |
352 |
document.AVEVAConvertDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
353 |
break; |
354 |
case 36: |
355 |
document.AVEVAWorkDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
356 |
break; |
357 |
case 37: |
358 |
document.AVEVAStatus = value; |
359 |
break; |
360 |
case 38: |
361 |
document.AVEVAIssues = value; |
362 |
break; |
363 |
case 39: |
364 |
document.AVEVAReviewDate = string.IsNullOrEmpty(value) ? (DateTime?)null : Convert.ToDateTime(value); |
365 |
break; |
366 |
case 40: |
367 |
document.ProdReviewer = this.GetUser(value).ID; |
368 |
break; |
369 |
case 41: |
370 |
document.ProdIsResult = value; |
371 |
break; |
372 |
case 42: |
373 |
document.ProdRemarks = value; |
374 |
break; |
375 |
case 43: |
376 |
document.ClientReviewer = this.GetUser(value).ID; |
377 |
break; |
378 |
case 44: |
379 |
document.ClientIsResult = value; |
380 |
break; |
381 |
case 45: |
382 |
document.ClientRemarks = value; |
383 |
break; |
384 |
case 46: |
385 |
document.DTIsGateWay = value; |
386 |
break; |
387 |
case 47: |
388 |
document.DTIsImport = value; |
389 |
break; |
390 |
case 48: |
391 |
document.DTIsRegSystem = value; |
392 |
break; |
393 |
case 49: |
394 |
document.DTRemarks = value; |
395 |
break; |
396 |
} |
397 |
} |
398 |
|
399 |
result.documents.Add(document); |
400 |
} |
401 |
} |
402 |
catch (Exception) |
403 |
{ |
404 |
throw; |
405 |
} |
406 |
|
407 |
return result; |
408 |
} |
409 |
|
410 |
|
411 |
public ImportResult GemboxImport(string fileName) |
412 |
{ |
413 |
ImportResult result = new ImportResult(); |
414 |
|
415 |
StringBuilder sbErrMsg = new StringBuilder(); |
416 |
|
417 |
try |
418 |
{ |
419 |
var exFile = ExcelFile.Load(fileName); |
420 |
var ws = exFile.Worksheets[0]; |
421 |
|
422 |
int rowCount = ws.Rows.Count; |
423 |
int columnCount = ws.CalculateMaxUsedColumns(); |
424 |
int exRow = 8; |
425 |
|
426 |
#region Excel 유효성검사 |
427 |
|
428 |
//Excel 포멧체크 |
429 |
if (rowCount < 10 || columnCount != 49) |
430 |
{ |
431 |
result.Error = "Please, check the excel."; |
432 |
return result; |
433 |
} |
434 |
|
435 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
436 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
437 |
.Where(col => col.Column.Index > 8 && col.Column.Index < 18 && col.Row.Index > exRow && col.Value == null) |
438 |
.ToList() |
439 |
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
440 |
|
441 |
if (sbErrMsg.Length > 0) |
442 |
{ |
443 |
string errMsg = sbErrMsg.ToString().Substring(2); |
444 |
if (errMsg.Length > 100) |
445 |
{ |
446 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
447 |
} |
448 |
|
449 |
result.Error = $"Please, check null value in excel.\n{errMsg}"; |
450 |
return result; |
451 |
} |
452 |
#endregion |
453 |
|
454 |
#region 엑셀 도면명 중복 값 체크 |
455 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
456 |
.Where(col => col.Column.Index == 12 && col.Row.Index > exRow) |
457 |
.GroupBy(g => g.Row.Index) |
458 |
.Select(p => new |
459 |
{ |
460 |
rowIndex = p.Key, |
461 |
docNo = p.Select(x => x.Value.ToString()).FirstOrDefault() |
462 |
}) |
463 |
.GroupBy(g => g.docNo) |
464 |
.Where(p => p.Count() > 1) |
465 |
.Select(p => p.Select(x => (x.rowIndex + 1).ToString()) |
466 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
467 |
.ToString()) |
468 |
.ToList() |
469 |
.ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
470 |
if (sbErrMsg.Length > 0) |
471 |
{ |
472 |
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
473 |
string errMsg = sbErrMsg.ToString(); |
474 |
if (errMsg.Length > 100) |
475 |
{ |
476 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
477 |
} |
478 |
|
479 |
result.Error = $"Please, check the duplicate value in excel.\n{errMsg}"; |
480 |
return result; |
481 |
} |
482 |
#endregion |
483 |
|
484 |
#endregion |
485 |
|
486 |
result.documents = new List<Documents>(); |
487 |
|
488 |
ws.Rows.Where(row => row.Index > exRow) |
489 |
.ToList() |
490 |
.ForEach(p => |
491 |
{ |
492 |
try |
493 |
{ |
494 |
result.documents.Add(new Documents() |
495 |
{ |
496 |
RefProjectCode = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
497 |
System = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
498 |
SubSystemCode = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
499 |
DocumentNo = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
500 |
PersonInCharge = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[12].Value.ToString()).ID, |
501 |
Worker = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
502 |
AVEVAPersonInCharge = ws.Rows[p.Index].Cells[14].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[14].Value.ToString()).ID, |
503 |
AVEVAWorker = ws.Rows[p.Index].Cells[15].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[15].Value.ToString()).ID, |
504 |
JobLevel = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
505 |
RevisonNo = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
506 |
ToIsDiscussion = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[18].Value.ToString(), |
507 |
ToRemarks = ws.Rows[p.Index].Cells[19].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[19].Value.ToString(), |
508 |
ToCreator = ws.Rows[p.Index].Cells[20].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[20].Value.ToString()).ID, |
509 |
//toreview-21 |
510 |
FrReviewStatus = ws.Rows[p.Index].Cells[22].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[22].Value.ToString(), |
511 |
FrRemarks = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[23].Value.ToString(), |
512 |
FrCreator = ws.Rows[p.Index].Cells[24].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[24].Value.ToString()).ID, |
513 |
//frreview-25 |
514 |
ID2StartDate = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[26].Value?.ToString()), |
515 |
ID2EndDate = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[27].Value?.ToString()), |
516 |
ID2Status = ws.Rows[p.Index].Cells[28].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[28].Value.ToString(), |
517 |
ID2Issues = ws.Rows[p.Index].Cells[29].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[29].Value.ToString(), |
518 |
//id2work-30 |
519 |
ReplyModifications = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
520 |
ReplyRequester = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[32].Value.ToString()).ID, |
521 |
IsConvert = ws.Rows[p.Index].Cells[33].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[33].Value.ToString(), |
522 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[34].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[34].Value.ToString()), |
523 |
AVEVAWorkDate = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[35].Value.ToString()), |
524 |
AVEVAStatus = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
525 |
AVEVAIssues = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
526 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[38].Value.ToString()), |
527 |
ProdReviewer = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[39].Value.ToString()).ID, |
528 |
ProdIsResult = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
529 |
ProdRemarks = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
530 |
ClientReviewer = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[42].Value.ToString()).ID, |
531 |
ClientIsResult = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
532 |
ClientRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString(), |
533 |
DTIsGateWay = ws.Rows[p.Index].Cells[45].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[45].Value.ToString(), |
534 |
DTIsImport = ws.Rows[p.Index].Cells[46].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[46].Value.ToString(), |
535 |
DTIsRegSystem = ws.Rows[p.Index].Cells[47].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[47].Value.ToString(), |
536 |
DTRemarks = ws.Rows[p.Index].Cells[48].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[48].Value.ToString() |
537 |
|
538 |
/* |
539 |
//UID = string.Empty, |
540 |
//Type = this.radTextBoxInsulationType.Text, |
541 |
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
542 |
//TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value), |
543 |
//NPS = ws.Rows[p.Row.Index].Cells[0].IsNullOrEmpty() ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value), |
544 |
//Thickness = p.IsNullOrEmpty() ? 0 : Convert.ToSingle(p.Value) |
545 |
|
546 |
RefProjectCode = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
547 |
DocumentNo = ws.Rows[p.Index].Cells[6].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(), |
548 |
PersonInCharge = ws.Rows[p.Index].Cells[7].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID, |
549 |
JobLevel = ws.Rows[p.Index].Cells[8].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
550 |
//IsTypical = ws.Rows[p.Index].Cells[9].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
551 |
RevisonNo = ws.Rows[p.Index].Cells[10].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
552 |
ToIsDiscussion = ws.Rows[p.Index].Cells[11].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
553 |
ToRemarks = ws.Rows[p.Index].Cells[12].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(), |
554 |
ToCreator = ws.Rows[p.Index].Cells[13].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
555 |
//ToCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
556 |
//ToIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
557 |
FrReviewStatus = ws.Rows[p.Index].Cells[16].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
558 |
FrRemarks = ws.Rows[p.Index].Cells[17].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
559 |
FrCreator = ws.Rows[p.Index].Cells[18].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID, |
560 |
//FrCapture = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
561 |
//FrIsMarkup = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
562 |
//IsID2Work = ws.Rows[p.Index].Cells[21].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
563 |
//ID2Connection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
564 |
ID2StartDate = ws.Rows[p.Index].Cells[23].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()), |
565 |
ID2EndDate = ws.Rows[p.Index].Cells[24].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()), |
566 |
//ID2JobTime = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
567 |
ID2Status = ws.Rows[p.Index].Cells[26].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(), |
568 |
ID2Issues = ws.Rows[p.Index].Cells[27].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
569 |
//AVEVAConnection = ws.Rows[p.Index].Cells[5].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
570 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[29].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()), |
571 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[30].IsNullOrEmpty() ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
572 |
//AVEVAWorkDate 추가필요 |
573 |
AVEVAStatus = ws.Rows[p.Index].Cells[31].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
574 |
AVEVAIssues = ws.Rows[p.Index].Cells[32].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
575 |
ProdReviewer = ws.Rows[p.Index].Cells[35].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID, |
576 |
ProdIsResult = ws.Rows[p.Index].Cells[36].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
577 |
ProdRemarks = ws.Rows[p.Index].Cells[37].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
578 |
ClientReviewer = ws.Rows[p.Index].Cells[38].IsNullOrEmpty() ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
579 |
ClientIsResult = ws.Rows[p.Index].Cells[39].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
580 |
ClientRemarks = ws.Rows[p.Index].Cells[40].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
581 |
DTIsGateWay = ws.Rows[p.Index].Cells[41].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
582 |
DTIsImport = ws.Rows[p.Index].Cells[42].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
583 |
DTIsRegSystem = ws.Rows[p.Index].Cells[43].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
584 |
DTRemarks = ws.Rows[p.Index].Cells[44].IsNullOrEmpty() ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
585 |
*/ |
586 |
}); |
587 |
} |
588 |
catch (Exception ex) |
589 |
{ |
590 |
throw new Exception($"Excel Import Row :{p.Index} Error.", ex); |
591 |
} |
592 |
}); |
593 |
|
594 |
} |
595 |
catch (Exception) |
596 |
{ |
597 |
throw; |
598 |
} |
599 |
|
600 |
return result; |
601 |
} |
602 |
} |
603 |
} |