Refactoring

This commit is contained in:
Sergey Chebotar 2023-04-20 09:39:25 +03:00
parent 6bfd1d981b
commit 663dd39de4
2 changed files with 8 additions and 21 deletions

View File

@ -110,27 +110,14 @@ public class ExcelReader : IReader, IDisposable
object name = worksheet.Cells[row, NameCell.Column].Value2; object name = worksheet.Cells[row, NameCell.Column].Value2;
object sku = worksheet.Cells[row, SkuCell.Column].Value2; object sku = worksheet.Cells[row, SkuCell.Column].Value2;
object measure = worksheet.Cells[row, MeasureCell.Column].Value2; object measure = worksheet.Cells[row, MeasureCell.Column].Value2;
Measure productMeasure; var productMeasure = measure.ToString() switch
switch (measure.ToString())
{ {
case "м": "м" => Measure.M,
productMeasure = Measure.M; "шт" => Measure.P,
break; "м2" => Measure.M2,
case "шт": "кг" => Measure.Kg,
productMeasure = Measure.P; _ => Measure.P,
break; };
case "м2":
productMeasure = Measure.M2;
break;
case "кг":
productMeasure = Measure.Kg;
break;
default:
productMeasure = Measure.P;
break;
}
if (productLine == null || name == null || sku == null) if (productLine == null || name == null || sku == null)
continue; continue;

View File

@ -2,7 +2,7 @@
public class FileDialog : IFileDialog public class FileDialog : IFileDialog
{ {
private Application _application; private readonly Application _application;
public FileDialog(Application application) public FileDialog(Application application)
{ {