final commit

This commit is contained in:
Salikh 2024-04-06 23:43:11 +04:00
parent 1d07d3d5ac
commit 63f5efce0a
3 changed files with 19 additions and 9 deletions

View File

@ -15,6 +15,8 @@ namespace MotorPlantBusinessLogic.BusinessLogic
{
public class ReportLogic : IReportLogic
{
private readonly IComponentStorage _componentStorage;
private readonly IEngineStorage _engineStorage;
private readonly IOrderStorage _orderStorage;
@ -29,6 +31,7 @@ namespace MotorPlantBusinessLogic.BusinessLogic
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
_engineStorage = engineStorage;
_componentStorage = componentStorage;
_orderStorage = orderStorage;
_saveToExcel = saveToExcel;

View File

@ -31,11 +31,14 @@ namespace MotorPlantFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.Id.HasValue && !model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return new();
}
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
return source.Orders
.Where(x => x.Id == model.Id || (model.DateTo >= x.DateCreate && model.DateFrom <= x.DateCreate))
.Select(x => GetViewModel(x))
.ToList();
}
public List<OrderViewModel> GetFullList()

View File

@ -32,12 +32,16 @@ namespace MotorPlantListImplement.Implements
{
var result = new List<OrderViewModel>();
if (model == null || !model.Id.HasValue)
{
return result;
}
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return result;
}
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
if (order.Id == model.Id || (model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo))
{
result.Add(AttachEngineName(order.GetViewModel));
}