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

View File

@ -31,12 +31,15 @@ namespace MotorPlantFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue || !model.DateTo.HasValue)
{ {
return new(); 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() public List<OrderViewModel> GetFullList()
{ {

View File

@ -35,10 +35,14 @@ namespace MotorPlantListImplement.Implements
{ {
return result; return result;
} }
foreach (var order in _source.Orders) 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)); result.Add(AttachEngineName(order.GetViewModel));
} }
} }