ISEbd-21 Melnikov I. O. Lab Work 04 Advanced #28

Closed
Igor-Melnikov wants to merge 19 commits from lab4adv into lab3adv
Showing only changes of commit bb4806b4d1 - Show all commits

View File

@ -35,7 +35,7 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
/// <returns></returns>
public List<ReportManufactureComponentViewModel> GetManufactureComponent()
{
var components = _componentStorage.GetFullList();
//var components = _componentStorage.GetFullList();
var manufactures = _manufactureStorage.GetFullList();
var list = new List<ReportManufactureComponentViewModel>();
foreach (var manufacture in manufactures)
@ -47,14 +47,15 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
TotalCount = 0,
TotalSum = 0
};
foreach (var component in components)
foreach (var component in manufacture.ManufactureComponents)
{
if (manufacture.ManufactureComponents.ContainsKey(component.Id))
{
record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2));
record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2;
record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2;
}
//record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2));
//record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2;
//record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2;
double componentCost = _componentStorage.GetElement(new() { Id = component.Key })?.Cost ?? 0;
record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2, componentCost));
record.TotalCount += component.Value.Item2;
record.TotalSum += component.Value.Item2 * componentCost;
}
list.Add(record);
}