Add Sleeves Calculator service

This commit is contained in:
Sergey Chebotar 2023-06-20 11:50:11 +03:00
parent a9d7ac710e
commit 2c44c5d2df
3 changed files with 20 additions and 0 deletions

View File

@ -25,6 +25,7 @@ public sealed class RhSolutionsAddIn : IExcelAddIn
.AddSingleton<IAddInConfiguration, AddInConfiguration>() .AddSingleton<IAddInConfiguration, AddInConfiguration>()
.AddSingleton<IDatabaseClient, DatabaseClient>() .AddSingleton<IDatabaseClient, DatabaseClient>()
.AddSingleton<ICurrencyClient, CurrencyClient>() .AddSingleton<ICurrencyClient, CurrencyClient>()
.AddSingleton<ISleevesCaluculator, SleevesCalculator>()
.AddTransient<IFileDialog, FileDialog>(); .AddTransient<IFileDialog, FileDialog>();
Services.AddSingleton<WriterFactory>(); Services.AddSingleton<WriterFactory>();

View File

@ -0,0 +1,6 @@
namespace RhSolutions.Services;
public interface ISleevesCaluculator
{
public Dictionary<Product, double> CalculateSleeves(Dictionary<Product, double> products);
}

View File

@ -0,0 +1,13 @@
namespace RhSolutions.Services;
public class SleevesCalculator : ISleevesCaluculator
{
public Dictionary<Product, double> CalculateSleeves(Dictionary<Product, double> products)
{
int counter = products.Where(kvp => kvp.Key.ProductLines.Contains("RAUTITAN")).Count();
return new Dictionary<Product, double>()
{
[new Product("11600011001")] = counter
};
}
}