aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/WorksheetExtensions.cs
blob: 51ce13aff20d12e50e4e8c551aca9ed88f7dc307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
        }
    }
}