aboutsummaryrefslogtreecommitdiff
path: root/src/Ribbon
diff options
context:
space:
mode:
authorSerghei Cebotari <51533848+schebotar@users.noreply.github.com>2022-01-09 15:48:16 +0300
committerGitHub <noreply@github.com>2022-01-09 15:48:16 +0300
commitbca7f64880bdbcade4a613c8223f82353a326b44 (patch)
treed14ea8875b8b348c1f3e03256ec304ea992d635f /src/Ribbon
parent72908aaaf7da74fe1b3de4d939faaf829d4a80e2 (diff)
parent846547d6d905e0dbee73cd9c62760ea43bb88134 (diff)
Merge pull request #11 from schebotar/dev
Dev
Diffstat (limited to 'src/Ribbon')
-rw-r--r--src/Ribbon/RibbonController.cs60
1 files changed, 44 insertions, 16 deletions
diff --git a/src/Ribbon/RibbonController.cs b/src/Ribbon/RibbonController.cs
index df6f327..ed59541 100644
--- a/src/Ribbon/RibbonController.cs
+++ b/src/Ribbon/RibbonController.cs
@@ -3,6 +3,7 @@ using System.Windows.Forms;
using ExcelDna.Integration.CustomUI;
using RehauSku.PriceListTools;
using RehauSku.Forms;
+using System;
namespace RehauSku.Ribbon
{
@@ -17,11 +18,14 @@ namespace RehauSku.Ribbon
<tabs>
<tab id='rau' label='REHAU'>
<group id='priceList' label='Прайс-лист'>
- <button id='exportToPrice' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnExportPressed'/>
- <button id='mergeFiles' label='Объединить' size='normal' imageMso='Copy' onAction='OnMergePressed'/>
+ <button id='exportToPrice' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnExportPressed'/>
+ <menu id='conjoinMenu' label='Объединить' imageMso='Copy'>
+ <button id='mergeFiles' label='Сложить' onAction='OnMergePressed'/>
+ <button id='combineFiles' label='По колонкам' onAction='OnCombinePressed'/>
+ </menu>
</group>
<group id='rausettings' label='Настройки'>
- <button id='setPriceList' label='Файл прайс-листа' size='normal' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/>
+ <button id='setPriceList' label='Файл прайс-листа' size='large' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/>
</group>
</tab>
</tabs>
@@ -29,35 +33,59 @@ namespace RehauSku.Ribbon
</customUI>";
}
+ // <dropDown id = 'dd1' label = 'Drop dynamic' getItemCount = 'fncGetItemCountDrop' getItemLabel = 'fncGetItemLabelDrop' onAction = 'fncOnActionDrop'/>
+
public void OnMergePressed(IRibbonControl control)
{
using (MergeTool mergeTool = new MergeTool())
{
string[] files = Dialog.GetMultiplyFiles();
- mergeTool.AddSkuAmountToDict(files);
- string exportFile = PriceListUtil.CreateNewExportFile();
- mergeTool.ExportToNewFile(exportFile);
+ if (files.Length != 0)
+ {
+ mergeTool.GetSource(files);
+ string exportFile = RegistryUtil.PriceListPath;
+ mergeTool.OpenNewPrice(exportFile);
+ mergeTool.FillPriceList();
+ }
}
}
- public void OnExportPressed(IRibbonControl control)
+ public void OnCombinePressed(IRibbonControl control)
{
- using (ExportTool exportTool = new ExportTool())
+ using (CombineTool combineTool = new CombineTool())
{
- if (!exportTool.IsRangeValid())
+ string[] files = Dialog.GetMultiplyFiles();
+ if (files.Length != 0)
{
- MessageBox.Show("Выделен неверный диапазон!",
- "Неверный диапазон",
- MessageBoxButtons.OK,
- MessageBoxIcon.Information);
- return;
+ combineTool.GetSource(files);
+ string exportFile = RegistryUtil.PriceListPath;
+ combineTool.OpenNewPrice(exportFile);
+ combineTool.FillPriceList();
}
+ }
+ }
- else
+ public void OnExportPressed(IRibbonControl control)
+ {
+ try
+ {
+ using (ExportTool exportTool = new ExportTool())
{
- exportTool.ExportToNewFile();
+ exportTool.GetSource();
+ string exportFile = RegistryUtil.PriceListPath;
+ exportTool.OpenNewPrice(exportFile);
+ exportTool.FillPriceList();
}
}
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message,
+ "Ошибка",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ return;
+ }
+
}
public void OnSetPricePressed(IRibbonControl control)