aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2021-12-06 19:49:10 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2021-12-06 19:49:10 +0300
commitfa195001bc1f90c28a08ac05aac0d47344e517a6 (patch)
treeb7b18e8bccbaed10e19bc986d78db7717ead4c74
parentd47e5d5282e89d1fcc69bf3907aa459277fcc104 (diff)
Add DataWriter class
-rw-r--r--Source/DataExport/DataWriter.cs (renamed from Source/DataWriter/DataWriter.cs)22
-rw-r--r--Source/DataExport/RibbonController.cs (renamed from Source/DataWriter/RibbonController.cs)0
2 files changed, 3 insertions, 19 deletions
diff --git a/Source/DataWriter/DataWriter.cs b/Source/DataExport/DataWriter.cs
index 76ed4ff..c024a22 100644
--- a/Source/DataWriter/DataWriter.cs
+++ b/Source/DataExport/DataWriter.cs
@@ -1,12 +1,9 @@
using ExcelDna.Integration;
using Microsoft.Office.Interop.Excel;
-using Rehau.Sku.Assist;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.IO;
-namespace Rehau.Sku
+namespace Rehau.Sku.Assist
{
public class DataWriter : IDisposable
{
@@ -14,12 +11,11 @@ namespace Rehau.Sku
private Dictionary<string, double> SkuAmount { get; set; }
private object[,] SelectedCells { get; set; }
private string FileName { get; set; }
- private string ExportFileName { get; set; }
public DataWriter()
{
this.xlApp = (Application)ExcelDnaUtil.Application;
- this.FileName = this.xlApp.ActiveWorkbook.FullName;
+ this.FileName = AddIn.priceListPath;
GetSelectedCells();
}
@@ -75,21 +71,9 @@ namespace Rehau.Sku
}
}
- public void DownloadPriceList()
- {
- Uri linkToPrice = new Uri(@"https://www.rehau.com/downloads/831332/%D0%BF%D1%80%D0%B0%D0%B9%D1%81-%D0%BB%D0%B8%D1%81%D1%82-%D0%B2%D0%B8%D1%81-exel-2021.xlsm");
-
- if (FileName.Contains(':'))
- ExportFileName = string.Join(".", FileName.Split('.').Select((x, i) => i == 0 ? string.Concat(x, "~") : "xlsm"));
- else
- ExportFileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Прайс-лист REHAU.xlsm";
-
- HttpClientUtil.DownloadFile(linkToPrice, ExportFileName);
- }
-
public void GetPriceListWB()
{
- Workbook wb = xlApp.Workbooks.Open(ExportFileName);
+ Workbook wb = xlApp.Workbooks.Open(FileName);
}
public void Dispose()
diff --git a/Source/DataWriter/RibbonController.cs b/Source/DataExport/RibbonController.cs
index a9eedb5..a9eedb5 100644
--- a/Source/DataWriter/RibbonController.cs
+++ b/Source/DataExport/RibbonController.cs