Доделал1
This commit is contained in:
parent
95899c05ee
commit
8b341f85a1
@ -15,7 +15,6 @@ namespace MotorPlantBusinessLogic
|
||||
{
|
||||
public class ReportLogic : IReportLogic
|
||||
{
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
private readonly IEngineStorage _EngineStorage;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
@ -24,7 +23,6 @@ namespace MotorPlantBusinessLogic
|
||||
public ReportLogic(IEngineStorage EngineStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_EngineStorage = EngineStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
@ -32,13 +30,25 @@ namespace MotorPlantBusinessLogic
|
||||
}
|
||||
public List<ReportEngineComponentViewModel> GetEngineComponents()
|
||||
{
|
||||
return _EngineStorage.GetFullList().Select(x => new ReportEngineComponentViewModel
|
||||
{
|
||||
EngineName = x.EngineName,
|
||||
Components = x.EngineComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
||||
TotalCount = x.EngineComponents.Select(x => x.Value.Item2).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
var Engines = _EngineStorage.GetFullList();
|
||||
var list = new List<ReportEngineComponentViewModel>();
|
||||
foreach (var Engine in Engines)
|
||||
{
|
||||
var record = new ReportEngineComponentViewModel
|
||||
{
|
||||
EngineName = Engine.EngineName,
|
||||
Components = new List<(string Component, int Count)>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var component in Engine.EngineComponents)
|
||||
{
|
||||
record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
|
||||
record.TotalCount += component.Value.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||
|
Loading…
Reference in New Issue
Block a user