Changeset 6f203af for FarmatikoServices/Services/ProcessJSONService.cs
- Timestamp:
- 10/28/20 22:06:48 (4 years ago)
- Branches:
- master
- Children:
- 993189e
- Parents:
- 1454207
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/ProcessJSONService.cs
r1454207 r6f203af 29 29 public async Task<Medicine> ReadPharmaciesFromExcel() 30 30 { 31 var client = new WebClient();32 string Path = client.DownloadString(@"C:\Users\dslez\Desktop\apteki-fzo.xlsx");33 using (var package = new ExcelPackage(new FileInfo(Path)))34 {35 var Sheet = package.Workbook.Worksheets[1];36 for (int i = 2; i < Sheet.Dimension.End.Row; ++i)37 {38 Pharmacy pharmacy = new Pharmacy()31 try 32 { 33 var client = new WebClient(); 34 string Path = client.DownloadString(@"C:\Users\dslez\Desktop\apteki-fzo.xlsx"); 35 using (var package = new ExcelPackage(new FileInfo(Path))) 36 { 37 var Sheet = package.Workbook.Worksheets[1]; 38 for (int i = 2; i < Sheet.Dimension.End.Row; ++i) 39 39 { 40 Name = Sheet.Cells[i, 2].Value.ToString(), 41 Address = Sheet.Cells[i, 3].Value.ToString(), 42 Location = Sheet.Cells[i, 4].Value.ToString(), 43 WorkAllTime = false 44 }; 45 await _service.AddPharmacy(pharmacy); 46 } 40 Pharmacy pharmacy = new Pharmacy() 41 { 42 Name = Sheet.Cells[i, 2].Value.ToString(), 43 Address = Sheet.Cells[i, 3].Value.ToString(), 44 Location = Sheet.Cells[i, 4].Value.ToString(), 45 WorkAllTime = false 46 }; 47 await _service.AddPharmacy(pharmacy); 48 } 49 } 50 51 } 52 catch(Exception e) 53 { 54 _logger.LogInformation(e.Message); 55 throw new Exception("Cannot process Medicines from Excel."); 47 56 } 48 57 return null;
Note:
See TracChangeset
for help on using the changeset viewer.