Change internal Product class to nuget library

This commit is contained in:
Sergey Chebotar 2023-04-20 06:58:27 +03:00
parent 8e820c4cd9
commit 13996f0381
5 changed files with 5 additions and 40 deletions

View File

@ -14,7 +14,7 @@ public class RhSolutionsFunction
{
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
{

View File

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

View File

@ -36,7 +36,7 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="netDxf" Version="2022.11.2" />
<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.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

View File

@ -19,7 +19,7 @@ public class RhDatabaseClient : IDatabaseClient
{
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();
}

View File

@ -38,7 +38,7 @@ public class RhExcelReader : IExcelReader, IDisposable
{
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;
}
@ -112,7 +112,7 @@ public class RhExcelReader : IExcelReader, IDisposable
if (programLine == null || name == null || sku == null)
continue;
if (!Sku.TryParse(sku.ToString(), out _))
if (!ProductSku.TryParse(sku.ToString(), out _))
continue;
Product p = new()