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 sku = worksheet.Cells[row, SkuCell.Column].Value2;
object measure = worksheet.Cells[row, MeasureCell.Column].Value2;
Measure productMeasure;
switch (measure.ToString())
var productMeasure = measure.ToString() switch
{
case "м":
productMeasure = Measure.M;
break;
case "шт":
productMeasure = Measure.P;
break;
case "м2":
productMeasure = Measure.M2;
break;
case "кг":
productMeasure = Measure.Kg;
break;
default:
productMeasure = Measure.P;
break;
}
"м" => Measure.M,
"шт" => Measure.P,
"м2" => Measure.M2,
"кг" => Measure.Kg,
_ => Measure.P,
};
if (productLine == null || name == null || sku == null)
continue;

View File

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