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,37 +119,38 @@ 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)
{
continue;
}
double? value = currentCell as double?; return value != null
&& value != 0
if (value == null || value == 0) && value < maxValue;
{
continue;
}
if (value > maxValue)
{
return false;
}
if (column.Rows.Count == 1)
{
return true;
}
if (++successCounter > 1)
{
return true;
}
} }
else
{
for (int row = 1; row < column.Rows.Count + 1; row++)
{
object currentCell = cells[row, 1];
double? value = currentCell as double?;
if (value == null || value == 0)
{
continue;
}
if (value > maxValue)
{
return false;
}
if (++successCounter > 1)
{
return true;
}
}
return (column.Rows.Count > 1 && successCounter > 0) return (column.Rows.Count > 1 && successCounter > 0)
|| successCounter > 1; || successCounter > 1;
} }