Remove Response Order setting

This commit is contained in:
Sergey Chebotar 2022-07-04 09:21:44 +03:00
parent 8155dcce37
commit 10e6a108f9
5 changed files with 3 additions and 54 deletions

View File

@ -7,15 +7,6 @@ using System.Runtime.Caching;
namespace RehauSku
{
enum ResponseOrder
{
Default,
Relevance,
Name,
Price,
Series
}
class AddIn : IExcelAddIn
{
public static HttpClient httpClient;

View File

@ -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();
}

View File

@ -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;
}
}
}
}
}

View File

@ -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;
}
return baseUri.Uri;
}

View File

@ -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();
}