Change internal Product class to nuget library
This commit is contained in:
parent
8e820c4cd9
commit
13996f0381
@ -14,7 +14,7 @@ public class RhSolutionsFunction
|
|||||||
{
|
{
|
||||||
IDatabaseClient databaseClient = RhSolutionsAddIn.ServiceProvider.GetService<IDatabaseClient>();
|
IDatabaseClient databaseClient = RhSolutionsAddIn.ServiceProvider.GetService<IDatabaseClient>();
|
||||||
|
|
||||||
Sku.TryParse(line, out var skus);
|
ProductSku.TryParse(line, out var skus);
|
||||||
|
|
||||||
if (ExcelAsyncUtil.Run("Database request", line, delegate
|
if (ExcelAsyncUtil.Run("Database request", line, delegate
|
||||||
{
|
{
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace RhSolutions.Models
|
|
||||||
{
|
|
||||||
public class Product
|
|
||||||
{
|
|
||||||
public string ProductLine { get; set; }
|
|
||||||
public string ProductSku { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
if (obj as Product == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Product other = obj as Product;
|
|
||||||
|
|
||||||
return ProductLine == other.ProductLine &&
|
|
||||||
ProductSku == other.ProductSku &&
|
|
||||||
Name == other.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
string[] properties = new[]
|
|
||||||
{
|
|
||||||
ProductLine,
|
|
||||||
ProductSku,
|
|
||||||
Name
|
|
||||||
};
|
|
||||||
|
|
||||||
return string.Concat(properties.Where(p => p != null)).GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -36,7 +36,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||||
<PackageReference Include="netDxf" Version="2022.11.2" />
|
<PackageReference Include="netDxf" Version="2022.11.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="RhSolutions.Sku" Version="0.1.1" />
|
<PackageReference Include="RhSolutions.Sku" Version="0.1.5" />
|
||||||
<PackageReference Include="System.Buffers" Version="4.5.1" />
|
<PackageReference Include="System.Buffers" Version="4.5.1" />
|
||||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
|
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -19,7 +19,7 @@ public class RhDatabaseClient : IDatabaseClient
|
|||||||
{
|
{
|
||||||
string request;
|
string request;
|
||||||
|
|
||||||
if (Sku.TryParse(line, out var skus))
|
if (ProductSku.TryParse(line, out var skus))
|
||||||
{
|
{
|
||||||
request = @"https://rh.cebotari.ru/api/products/" + skus.FirstOrDefault().ToString();
|
request = @"https://rh.cebotari.ru/api/products/" + skus.FirstOrDefault().ToString();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class RhExcelReader : IExcelReader, IDisposable
|
|||||||
{
|
{
|
||||||
object currentCell = cells[row, column];
|
object currentCell = cells[row, column];
|
||||||
|
|
||||||
if (Sku.TryParse(currentCell.ToString(), out var validSku))
|
if (ProductSku.TryParse(currentCell.ToString(), out var validSku))
|
||||||
{
|
{
|
||||||
currentSku = validSku.FirstOrDefault().ToString() ?? null;
|
currentSku = validSku.FirstOrDefault().ToString() ?? null;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class RhExcelReader : IExcelReader, IDisposable
|
|||||||
if (programLine == null || name == null || sku == null)
|
if (programLine == null || name == null || sku == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Sku.TryParse(sku.ToString(), out _))
|
if (!ProductSku.TryParse(sku.ToString(), out _))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Product p = new()
|
Product p = new()
|
||||||
|
Loading…
Reference in New Issue
Block a user