aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/WorksheetExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/AddIn/WorksheetExtensions.cs')
-rw-r--r--src/AddIn/WorksheetExtensions.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/AddIn/WorksheetExtensions.cs b/src/AddIn/WorksheetExtensions.cs
new file mode 100644
index 0000000..51ce13a
--- /dev/null
+++ b/src/AddIn/WorksheetExtensions.cs
@@ -0,0 +1,32 @@
+using Microsoft.Office.Interop.Excel;
+using System.Linq;
+
+namespace RehauSku
+{
+ public static class WorksheetExtensions
+ {
+ private static string amountHeader = "Кол-во";
+ private static string skuHeader = "Актуальный материал";
+ private static string groupHeader = "Программа";
+ private static string nameHeader = "Наименование";
+
+ public static bool IsRehauSource(this Worksheet worksheet)
+ {
+ Range amountCell;
+ Range skuCell;
+ Range groupCell;
+ Range nameCell;
+
+ Range[] cells = new[]
+ {
+ amountCell = worksheet.Cells.Find(amountHeader),
+ skuCell = worksheet.Cells.Find(skuHeader),
+ groupCell = worksheet.Cells.Find(groupHeader),
+ nameCell = worksheet.Cells.Find(nameHeader)
+ };
+
+ return cells.All(x => x != null);
+ }
+ }
+}
+