From 3feab7cf5f8755b4c05a6d57aece037947b16273 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Sat, 12 Feb 2022 16:53:34 +0300 Subject: Extract PriceListHeaders class --- src/AddIn/EventsUtil.cs | 2 +- src/AddIn/WorksheetExtensions.cs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/AddIn') diff --git a/src/AddIn/EventsUtil.cs b/src/AddIn/EventsUtil.cs index 102e12e..bc8d1d3 100644 --- a/src/AddIn/EventsUtil.cs +++ b/src/AddIn/EventsUtil.cs @@ -4,7 +4,7 @@ namespace RehauSku { internal static class EventsUtil { - private static Application Excel = AddIn.Excel; + private static readonly Application Excel = AddIn.Excel; public static void Initialize() { diff --git a/src/AddIn/WorksheetExtensions.cs b/src/AddIn/WorksheetExtensions.cs index cffa55c..7880b66 100644 --- a/src/AddIn/WorksheetExtensions.cs +++ b/src/AddIn/WorksheetExtensions.cs @@ -1,15 +1,11 @@ using Microsoft.Office.Interop.Excel; +using RehauSku.PriceListTools; using System.Linq; namespace RehauSku { public static class WorksheetExtensions { - private static string amountHeader = "Кол-во"; - private static string skuHeader = "Актуальный материал"; - private static string groupHeader = "Программа"; - private static string nameHeader = "Наименование"; - public static bool IsRehauSource(this Worksheet worksheet) { Range amountCell; @@ -19,10 +15,10 @@ namespace RehauSku Range[] cells = new[] { - amountCell = worksheet.Cells.Find(amountHeader), - skuCell = worksheet.Cells.Find(skuHeader), - groupCell = worksheet.Cells.Find(groupHeader), - nameCell = worksheet.Cells.Find(nameHeader) + amountCell = worksheet.Cells.Find(PriceListHeaders.Amount), + skuCell = worksheet.Cells.Find(PriceListHeaders.Sku), + groupCell = worksheet.Cells.Find(PriceListHeaders.Group), + nameCell = worksheet.Cells.Find(PriceListHeaders.Name) }; return cells.All(x => x != null); -- cgit v1.2.3 From 7144be9b9cae5fed0fcfde2e37512ab4397c6763 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 14 Feb 2022 10:34:26 +0300 Subject: Update EventsUtil to shortened button ids --- src/AddIn/EventsUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/AddIn') diff --git a/src/AddIn/EventsUtil.cs b/src/AddIn/EventsUtil.cs index bc8d1d3..c10a69a 100644 --- a/src/AddIn/EventsUtil.cs +++ b/src/AddIn/EventsUtil.cs @@ -22,12 +22,12 @@ namespace RehauSku private static void RefreshConvertButton(object sh) { - Interface.RibbonController.RefreshControl("convertPrice"); + Interface.RibbonController.RefreshControl("convert"); } private static void RefreshExportButton(object sh, Range target) { - Interface.RibbonController.RefreshControl("exportToPrice"); + Interface.RibbonController.RefreshControl("export"); } } } -- cgit v1.2.3 From 070733036b67e1b11132503d68a5e5d361cacc18 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 14 Feb 2022 11:06:40 +0300 Subject: getLabel implemetation for pricelist button --- src/AddIn/RegistryUtil.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/AddIn') diff --git a/src/AddIn/RegistryUtil.cs b/src/AddIn/RegistryUtil.cs index 5fe2eea..a13e941 100644 --- a/src/AddIn/RegistryUtil.cs +++ b/src/AddIn/RegistryUtil.cs @@ -63,9 +63,15 @@ namespace RehauSku { priceListPath = value; RootKey.SetValue("PriceListPath", value); + RibbonController.RefreshControl("setPriceList"); } } + public static string GetPriceListName() + { + return Path.GetFileName(priceListPath); + } + public static ResponseOrder StoreResponseOrder { get -- cgit v1.2.3