RhSolutions-AddIn/RhSolutions.AddIn/Models/WorksheetExtensions.cs
2023-04-01 15:24:04 +03:00

41 lines
1002 B
C#

using RhSolutions.AddIn;
namespace RhSolutions.Services;
public static class WorksheetExtensions
{
public static bool IsRehauSource(this Worksheet worksheet)
{
Range amountCell;
Range skuCell;
Range groupCell;
Range nameCell;
var pricelistParameters = RhSolutionsAddIn.Configuration.GetPriceListParameters();
Range[] cells = new[]
{
amountCell = worksheet.Cells.Find(pricelistParameters["Amount"]),
skuCell = worksheet.Cells.Find(pricelistParameters["Sku"]),
groupCell = worksheet.Cells.Find(pricelistParameters["Group"]),
nameCell = worksheet.Cells.Find(pricelistParameters["Name"])
};
return cells.All(x => x != null);
}
public static void AddValue(this Range range, double value)
{
if (range.Value2 == null)
{
range.Value2 = value;
}
else
{
range.Value2 += value;
}
}
}