aboutsummaryrefslogtreecommitdiff
path: root/Source/PriceListTools/MergeTool.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2021-12-26 18:22:32 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2021-12-26 18:22:32 +0300
commit54fc3320e7d64d7903b4d091fe0d5c15df01fd78 (patch)
treeac8b9aa1e883a85339a594b2797ab319cca73c4e /Source/PriceListTools/MergeTool.cs
parent20cfbfcca3a779c04aecdca5e4b465651e2be42a (diff)
Move to /src
Diffstat (limited to 'Source/PriceListTools/MergeTool.cs')
-rw-r--r--Source/PriceListTools/MergeTool.cs88
1 files changed, 0 insertions, 88 deletions
diff --git a/Source/PriceListTools/MergeTool.cs b/Source/PriceListTools/MergeTool.cs
deleted file mode 100644
index 6b0644d..0000000
--- a/Source/PriceListTools/MergeTool.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using ExcelDna.Integration;
-using Microsoft.Office.Interop.Excel;
-using System;
-using System.Collections.Generic;
-
-namespace RehauSku.PriceListTools
-{
- class MergeTool : IDisposable
- {
- private Application ExcelApp;
- private Dictionary<string, double> SkuAmount { get; set; }
-
- public MergeTool()
- {
- this.ExcelApp = (Application)ExcelDnaUtil.Application;
- this.SkuAmount = new Dictionary<string, double>();
- }
-
- public void AddSkuAmountToDict(string[] files)
- {
- ExcelApp.ScreenUpdating = false;
- foreach (string file in files)
- {
- Workbook wb = ExcelApp.Workbooks.Open(file);
-
- try
- {
- PriceList priceList = new PriceList(wb);
- SkuAmount.AddValues(priceList);
- }
-
- catch (Exception ex)
- {
- System.Windows.Forms.MessageBox.Show
- ( $"{wb.Name} не является файлом прайслиста \n\n {ex.Message}",
- "Неверный файл прайс-листа!",
- System.Windows.Forms.MessageBoxButtons.OK,
- System.Windows.Forms.MessageBoxIcon.Error);
- }
-
- finally
- {
- wb.Close();
- }
- }
- ExcelApp.ScreenUpdating = true;
- }
-
- public void ExportToNewFile(string exportFile)
- {
- if (SkuAmount.Count < 1)
- {
- return;
- }
-
- Workbook wb = ExcelApp.Workbooks.Open(exportFile);
- PriceList priceList;
-
- try
- {
- priceList = new PriceList(wb);
- priceList.Fill(SkuAmount);
- }
-
- catch (Exception ex)
- {
- System.Windows.Forms.MessageBox.Show
- ($"{RegistryUtil.PriceListPath} не является файлом прайслиста \n\n {ex.Message}",
- "Неверный файл прайс-листа!",
- System.Windows.Forms.MessageBoxButtons.OK,
- System.Windows.Forms.MessageBoxIcon.Error);
-
- wb.Close();
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
-
- }
- }
-}