Refactoring

This commit is contained in:
Sergey Chebotar 2021-12-10 13:56:28 +03:00
parent 5a641d83d8
commit b7c65d64e9
4 changed files with 11 additions and 8 deletions

View File

@ -17,8 +17,8 @@ namespace RehauSku
public class AddIn : IExcelAddIn public class AddIn : IExcelAddIn
{ {
public static readonly HttpClient httpClient = new HttpClient(); public static readonly HttpClient httpClient = new HttpClient();
public static ResponseOrder responseOrder; public static ResponseOrder StoreResponse { get; set; }
public static string priceListPath; public static string PriceListPath { get; set; }
public void AutoOpen() public void AutoOpen()
{ {
@ -46,8 +46,8 @@ namespace RehauSku
.OpenSubKey("REHAU") .OpenSubKey("REHAU")
.OpenSubKey("SkuAssist"); .OpenSubKey("SkuAssist");
responseOrder = (ResponseOrder)addInKeys.GetValue("ResponseOrder"); StoreResponse = (ResponseOrder)addInKeys.GetValue("ResponseOrder");
priceListPath = (string)addInKeys.GetValue("PriceListPath"); PriceListPath = (string)addInKeys.GetValue("PriceListPath");
} }
} }
} }

View File

@ -36,7 +36,7 @@ namespace RehauSku.Assistant
baseUri.Path = "/catalogsearch/result/index/"; baseUri.Path = "/catalogsearch/result/index/";
string cleanedRequest = request.CleanRequest(); string cleanedRequest = request.CleanRequest();
switch (AddIn.responseOrder) switch (AddIn.StoreResponse)
{ {
case ResponseOrder.Relevance: case ResponseOrder.Relevance:
baseUri.Query = "dir=asc&order=relevance&q=" + cleanedRequest; baseUri.Query = "dir=asc&order=relevance&q=" + cleanedRequest;

View File

@ -76,7 +76,7 @@ namespace RehauSku.DataExport
public void FillPriceList() public void FillPriceList()
{ {
string exportFile = _GetExportFullPath(); string exportFile = _GetExportFullPath();
File.Copy(AddIn.priceListPath, exportFile, true); File.Copy(AddIn.PriceListPath, exportFile, true);
Workbook wb = xlApp.Workbooks.Open(exportFile); Workbook wb = xlApp.Workbooks.Open(exportFile);
Worksheet ws = wb.ActiveSheet; Worksheet ws = wb.ActiveSheet;
@ -94,7 +94,7 @@ namespace RehauSku.DataExport
private string _GetExportFullPath() private string _GetExportFullPath()
{ {
string fileExtension = Path.GetExtension(AddIn.priceListPath); string fileExtension = Path.GetExtension(AddIn.PriceListPath);
return Path.GetTempFileName() + fileExtension; return Path.GetTempFileName() + fileExtension;
} }

View File

@ -34,7 +34,10 @@ namespace RehauSku.Ribbon
{ {
if (!dw.IsRangeValid()) if (!dw.IsRangeValid())
{ {
MessageBox.Show("Выделен неверный диапазон!", "Неверный диапазон", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выделен неверный диапазон!",
"Неверный диапазон",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return; return;
} }