часть реализации
This commit is contained in:
parent
7d1e620601
commit
45d0720932
@ -1,5 +1,7 @@
|
|||||||
using ServiceStationContracts.BindingModels;
|
using ServiceStationContracts.BindingModels;
|
||||||
using ServiceStationContracts.BusinessLogicsContracts;
|
using ServiceStationContracts.BusinessLogicsContracts;
|
||||||
|
using ServiceStationContracts.SearchModels;
|
||||||
|
using ServiceStationContracts.StoragesContracts;
|
||||||
using ServiceStationContracts.ViewModels;
|
using ServiceStationContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -11,13 +13,40 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
public class ExecutorReportLogic : IExecutorReportLogic
|
public class ExecutorReportLogic : IExecutorReportLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly ITechnicalWorkStorage _techWorkStorage;
|
||||||
|
private readonly IRepairStorage _repairStorage;
|
||||||
|
|
||||||
public List<ReportWorksViewModel> GetWorks(List<int> Ids)
|
public List<ReportWorksViewModel> GetWorks(List<int> Ids)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
public List<ReportCarsViewModel> GetCars(ReportBindingModel model)
|
public List<ReportCarsViewModel> GetCars(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
List<ReportCarsViewModel> allList = new List<ReportCarsViewModel>();
|
||||||
|
|
||||||
|
List<TechnicalWorkViewModel> techWorkList = _techWorkStorage.GetFilteredList(new TechnicalWorkSearchModel
|
||||||
|
{
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach(var techWork in techWorkList)
|
||||||
|
{
|
||||||
|
foreach(var car in techWork.TechnicalWorkCars.Values)
|
||||||
|
{
|
||||||
|
allList.Add(new ReportCarsViewModel
|
||||||
|
{
|
||||||
|
CarNumber = car.CarNumber,
|
||||||
|
CarBrand = car.CarBrand,
|
||||||
|
WorkType = techWork.WorkType,
|
||||||
|
TechnicalWorkDate = techWork.DateStartWork,
|
||||||
|
TechnicalWorkPrice = techWork.WorkPrice,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||||
|
@ -10,6 +10,8 @@ namespace ServiceStationContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
|
@ -12,7 +12,7 @@ namespace ServiceStationContracts.ViewModels
|
|||||||
public string CarNumber { get; set; } = string.Empty;
|
public string CarNumber { get; set; } = string.Empty;
|
||||||
public string CarBrand { get; set; } = string.Empty;
|
public string CarBrand { get; set; } = string.Empty;
|
||||||
public string WorkType { get; set; } = string.Empty;
|
public string WorkType { get; set; } = string.Empty;
|
||||||
public DateTime TechnicalWorkDate { get; set; } = DateTime.Now;
|
public DateTime? TechnicalWorkDate { get; set; } = DateTime.Now;
|
||||||
public double TechnicalWorkPrice { get; set; }
|
public double TechnicalWorkPrice { get; set; }
|
||||||
public string RepairName { get; set; } = string.Empty;
|
public string RepairName { get; set; } = string.Empty;
|
||||||
public RepairStatus RepairStatus { get; set; } = RepairStatus.Неизвестен;
|
public RepairStatus RepairStatus { get; set; } = RepairStatus.Неизвестен;
|
||||||
|
@ -36,7 +36,7 @@ namespace ServiceStationDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
using var context = new ServiceStationDatabase();
|
using var context = new ServiceStationDatabase();
|
||||||
|
|
||||||
if(model.DateTo.HasValue && model.DateTo.HasValue)
|
if(model.DateTo.HasValue && model.DateTo.HasValue && model.ExecutorId.HasValue)
|
||||||
{
|
{
|
||||||
return context.TechnicalWorks
|
return context.TechnicalWorks
|
||||||
.Include(x => x.Cars)
|
.Include(x => x.Cars)
|
||||||
|
Loading…
Reference in New Issue
Block a user