RhSolutions-AddIn/RhSolutions.AddIn/Models/WorksheetExtensions.cs

37 lines
858 B
C#
Raw Normal View History

2023-03-28 10:36:36 +03:00
namespace RhSolutions.Services;
2023-03-28 10:36:36 +03:00
public static class WorksheetExtensions
{
2023-03-28 10:36:36 +03:00
public static bool IsRehauSource(this Worksheet worksheet)
{
2023-03-28 10:36:36 +03:00
Range amountCell;
Range skuCell;
Range groupCell;
Range nameCell;
Range[] cells = new[]
{
2023-03-28 10:36:36 +03:00
amountCell = worksheet.Cells.Find(PriceListHeaders.Amount),
skuCell = worksheet.Cells.Find(PriceListHeaders.Sku),
groupCell = worksheet.Cells.Find(PriceListHeaders.Group),
nameCell = worksheet.Cells.Find(PriceListHeaders.Name)
};
2023-03-28 10:36:36 +03:00
return cells.All(x => x != null);
}
2023-03-28 10:36:36 +03:00
public static void AddValue(this Range range, double value)
{
if (range.Value2 == null)
{
range.Value2 = value;
}
2022-02-08 16:19:49 +03:00
2023-03-28 10:36:36 +03:00
else
2022-02-08 16:19:49 +03:00
{
2023-03-28 10:36:36 +03:00
range.Value2 += value;
2022-02-08 16:19:49 +03:00
}
}
}