blob: bc11a17b227aa368cf71cfe717a4f0a8e46f8f46 (
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
|
using Microsoft.Office.Interop.Excel;
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 List<PriceListSheet> Sheets { get; private set; }
private const string offerSheetHeader = "КП";
public PriceList(Workbook workbook)
{
Name = workbook.Name;
Sheets = new List<PriceListSheet>();
foreach (Worksheet worksheet in workbook.Sheets)
{
PriceListSheet priceListSheet = new PriceListSheet(worksheet);
if (priceListSheet.FillSkuAmount())
Sheets.Add(priceListSheet);
}
OfferSheet = Sheets.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;
}
}
}
|