From 20cfbfcca3a779c04aecdca5e4b465651e2be42a Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 24 Dec 2021 17:42:20 +0300 Subject: New release --- Source/PriceListTools/ExportTool.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Source/PriceListTools/ExportTool.cs') diff --git a/Source/PriceListTools/ExportTool.cs b/Source/PriceListTools/ExportTool.cs index 02def5b..0a28bf3 100644 --- a/Source/PriceListTools/ExportTool.cs +++ b/Source/PriceListTools/ExportTool.cs @@ -74,12 +74,30 @@ namespace RehauSku.PriceListTools public void ExportToNewFile() { + if (SkuAmount.Count < 1) + { + return; + } + string exportFile = PriceListUtil.CreateNewExportFile(); Workbook wb = ExcelApp.Workbooks.Open(exportFile); - PriceList priceList = new PriceList(wb); - if (priceList.IsValid()) + try + { + PriceList 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() -- cgit v1.2.3