diff --git a/src/AddIn/AddIn.cs b/src/AddIn/AddIn.cs index b532bfb..035e50f 100644 --- a/src/AddIn/AddIn.cs +++ b/src/AddIn/AddIn.cs @@ -7,15 +7,6 @@ using System.Runtime.Caching; namespace RehauSku { - enum ResponseOrder - { - Default, - Relevance, - Name, - Price, - Series - } - class AddIn : IExcelAddIn { public static HttpClient httpClient; diff --git a/src/AddIn/Functions.cs b/src/AddIn/Functions.cs index 867e246..efdec66 100644 --- a/src/AddIn/Functions.cs +++ b/src/AddIn/Functions.cs @@ -56,9 +56,7 @@ namespace RehauSku [ExcelFunction(Description = "Получение корректного артикула из строки")] public static object GETRAUSKU([ExcelArgument(Name = "\"Строка\"", Description = "строка, содержащая актикул")] string line) { - RauSku rausku; - - if (RauSku.TryParse(line, out rausku)) + if (RauSku.TryParse(line, out RauSku rausku)) { return rausku.ToString(); } diff --git a/src/AddIn/RegistryUtil.cs b/src/AddIn/RegistryUtil.cs index a13e941..54e071e 100644 --- a/src/AddIn/RegistryUtil.cs +++ b/src/AddIn/RegistryUtil.cs @@ -9,14 +9,12 @@ namespace RehauSku static class RegistryUtil { private static string priceListPath; - private static int? storeResponseOrder; private static RegistryKey RootKey { get; set; } public static void Initialize() { RootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist"); priceListPath = RootKey.GetValue("PriceListPath") as string; - storeResponseOrder = RootKey.GetValue("StoreResponseOrder") as int?; } public static void Uninitialize() @@ -71,23 +69,5 @@ namespace RehauSku { return Path.GetFileName(priceListPath); } - - public static ResponseOrder StoreResponseOrder - { - get - { - if (storeResponseOrder == null) - { - RootKey.SetValue("StoreResponseOrder", (int)ResponseOrder.Default); - storeResponseOrder = (int)ResponseOrder.Default; - return (ResponseOrder)storeResponseOrder.Value; - } - - else - { - return (ResponseOrder)storeResponseOrder.Value; - } - } - } } } diff --git a/src/Assistant/HttpClientUtil.cs b/src/Assistant/HttpClientUtil.cs index 316ea07..a5a961e 100644 --- a/src/Assistant/HttpClientUtil.cs +++ b/src/Assistant/HttpClientUtil.cs @@ -27,25 +27,7 @@ namespace RehauSku.Assistant baseUri.Path = "/catalogsearch/result/index/"; string cleanedRequest = request.CleanRequest(); - - switch (RegistryUtil.StoreResponseOrder) - { - case ResponseOrder.Relevance: - baseUri.Query = "dir=asc&order=relevance&q=" + cleanedRequest; - break; - case ResponseOrder.Name: - baseUri.Query = "dir=asc&order=name&q=" + cleanedRequest; - break; - case ResponseOrder.Price: - baseUri.Query = "dir=asc&order=price&q=" + cleanedRequest; - break; - case ResponseOrder.Series: - baseUri.Query = "dir=asc&order=sch_product_series&q=" + cleanedRequest; - break; - default: - baseUri.Query = "q=" + cleanedRequest; - break; - } + baseUri.Query = "q=" + cleanedRequest; return baseUri.Uri; } diff --git a/src/PriceListTools/ExportTool.cs b/src/PriceListTools/ExportTool.cs index 8566513..4e51563 100644 --- a/src/PriceListTools/ExportTool.cs +++ b/src/PriceListTools/ExportTool.cs @@ -56,9 +56,7 @@ namespace RehauSku.PriceListTools { object current = cells[row, column]; - RauSku rauSku; - - if (RauSku.TryParse(current.ToString(), out rauSku)) + if (RauSku.TryParse(current.ToString(), out RauSku rauSku)) { sku = rauSku.ToString(); }