Refactoring

This commit is contained in:
Sergey Chebotar 2023-05-30 09:01:49 +03:00
parent 51636ca61a
commit f6534fc8c7

View File

@ -1,5 +1,4 @@
using Microsoft.Office.Interop.Excel; using System.IO;
using System.IO;
namespace RhSolutions.Services; namespace RhSolutions.Services;
@ -95,7 +94,7 @@ public class GuessReader : IReader
continue; continue;
} }
if (ProductSku.TryParse(currentCell.ToString(), out IEnumerable<ProductSku> skus)) if (ProductSku.TryParse(currentCell.ToString(), out _))
{ {
successCounter++; successCounter++;
} }
@ -120,14 +119,20 @@ public class GuessReader : IReader
return false; return false;
} }
for (int row = 1; row < column.Rows.Count + 1; row++) if (column.Rows.Count == 1)
{ {
object currentCell = column.Rows.Count == 1 ? cells : cells[row, 1]; double? value = cells as double?;
if (currentCell == null)
{ return value != null
continue; && value != 0
&& value < maxValue;
} }
else
{
for (int row = 1; row < column.Rows.Count + 1; row++)
{
object currentCell = cells[row, 1];
double? value = currentCell as double?; double? value = currentCell as double?;
if (value == null || value == 0) if (value == null || value == 0)
@ -140,11 +145,6 @@ public class GuessReader : IReader
return false; return false;
} }
if (column.Rows.Count == 1)
{
return true;
}
if (++successCounter > 1) if (++successCounter > 1)
{ {
return true; return true;