Remove Response Order setting
This commit is contained in:
parent
8155dcce37
commit
10e6a108f9
@ -7,15 +7,6 @@ using System.Runtime.Caching;
|
|||||||
|
|
||||||
namespace RehauSku
|
namespace RehauSku
|
||||||
{
|
{
|
||||||
enum ResponseOrder
|
|
||||||
{
|
|
||||||
Default,
|
|
||||||
Relevance,
|
|
||||||
Name,
|
|
||||||
Price,
|
|
||||||
Series
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddIn : IExcelAddIn
|
class AddIn : IExcelAddIn
|
||||||
{
|
{
|
||||||
public static HttpClient httpClient;
|
public static HttpClient httpClient;
|
||||||
|
@ -56,9 +56,7 @@ namespace RehauSku
|
|||||||
[ExcelFunction(Description = "Получение корректного артикула из строки")]
|
[ExcelFunction(Description = "Получение корректного артикула из строки")]
|
||||||
public static object GETRAUSKU([ExcelArgument(Name = "\"Строка\"", Description = "строка, содержащая актикул")] string line)
|
public static object GETRAUSKU([ExcelArgument(Name = "\"Строка\"", Description = "строка, содержащая актикул")] string line)
|
||||||
{
|
{
|
||||||
RauSku rausku;
|
if (RauSku.TryParse(line, out RauSku rausku))
|
||||||
|
|
||||||
if (RauSku.TryParse(line, out rausku))
|
|
||||||
{
|
{
|
||||||
return rausku.ToString();
|
return rausku.ToString();
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,12 @@ namespace RehauSku
|
|||||||
static class RegistryUtil
|
static class RegistryUtil
|
||||||
{
|
{
|
||||||
private static string priceListPath;
|
private static string priceListPath;
|
||||||
private static int? storeResponseOrder;
|
|
||||||
private static RegistryKey RootKey { get; set; }
|
private static RegistryKey RootKey { get; set; }
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
RootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist");
|
RootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist");
|
||||||
priceListPath = RootKey.GetValue("PriceListPath") as string;
|
priceListPath = RootKey.GetValue("PriceListPath") as string;
|
||||||
storeResponseOrder = RootKey.GetValue("StoreResponseOrder") as int?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninitialize()
|
public static void Uninitialize()
|
||||||
@ -71,23 +69,5 @@ namespace RehauSku
|
|||||||
{
|
{
|
||||||
return Path.GetFileName(priceListPath);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,25 +27,7 @@ namespace RehauSku.Assistant
|
|||||||
|
|
||||||
baseUri.Path = "/catalogsearch/result/index/";
|
baseUri.Path = "/catalogsearch/result/index/";
|
||||||
string cleanedRequest = request.CleanRequest();
|
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;
|
baseUri.Query = "q=" + cleanedRequest;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseUri.Uri;
|
return baseUri.Uri;
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,7 @@ namespace RehauSku.PriceListTools
|
|||||||
{
|
{
|
||||||
object current = cells[row, column];
|
object current = cells[row, column];
|
||||||
|
|
||||||
RauSku rauSku;
|
if (RauSku.TryParse(current.ToString(), out RauSku rauSku))
|
||||||
|
|
||||||
if (RauSku.TryParse(current.ToString(), out rauSku))
|
|
||||||
{
|
{
|
||||||
sku = rauSku.ToString();
|
sku = rauSku.ToString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user