aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools/PriceList.cs
blob: b8bd7b7b1cec5594c220666528196d819f54f986 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace RehauSku.PriceListTools
{
    internal class PriceList
    {
        public readonly string Name;
        //public readonly PriceListSheet OfferSheet;
        public PriceListSheet Sheet { get; private set; }

        
        //private const string offerSheetHeader = "КП";

        public PriceList(Workbook workbook)
        {
            Name = workbook.Name;
            Sheet = new PriceListSheet(workbook.ActiveSheet);

            //foreach (Worksheet worksheet in workbook.Sheets)
            //{
            //    try
            //    {
            //        PriceListSheet priceListSheet = new PriceListSheet(worksheet);
            //        //priceListSheet.FillSkuAmount();
            //        Sheets.Add(priceListSheet);
            //    }
            //    catch (Exception ex)
            //    {
            //        throw ex;
            //    }
            //}



            //OfferSheet = Sheet.Where(s => s.Name == offerSheetHeader).FirstOrDefault();
        }

        public static string CreateNewFile()
        {
            string fileExtension = Path.GetExtension(RegistryUtil.PriceListPath);
            string path = Path.GetTempFileName() + fileExtension;

            File.Copy(RegistryUtil.PriceListPath, path);
            return path;
        }
    }
}