Вроде как сделали отчеты

This commit is contained in:
Marselchi 2024-04-30 23:42:46 +04:00
parent cfbf6479e5
commit 606f8775ed
8 changed files with 42 additions and 26 deletions

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarCenterContracts.BindingModels
{
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using CarCenterContracts.BindingModels;
using CarCenterContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarCenterContracts.BusinessLogicsContracts
{
public interface IReportLogic
{
List<ReportBundlingViewModel> GetBundligs(ReportBindingModel model);
List<ReportCarViewModel> GetCars(ReportBindingModel model);
List<ReportOrderViewModel> GetOrders(ReportBindingModel model);
List<ReportPresaleViewModel> GetPresales(ReportBindingModel model);
}
}

View File

@ -1,4 +1,5 @@
using System;
using CarCenterDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,7 +10,8 @@ namespace CarCenterContracts.ViewModels
public class ReportBundlingViewModel
{
public int Id { get; set; }
public List<(string, int)> Orders { get; set; } = new();
public List<(string, int)> Features { get; set; } = new();
//Пока не ясно что конкретно передавать в отчет, поэтому передается моделька
public List<IOrderModel> Orders { get; set; } = new();
public List<IFeatureModel> Features { get; set; } = new();
}
}

View File

@ -1,4 +1,5 @@
using System;
using CarCenterDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,6 +10,7 @@ namespace CarCenterContracts.ViewModels
public class ReportCarViewModel
{
public int Id { get; set; }
public List<(string, int)> Presales { get; set; } = new();
//Пока не ясно что конкретно передавать в отчет, поэтому передается моделька
public List<IPresaleModel> Presales { get; set; } = new();
}
}

View File

@ -1,4 +1,5 @@
using System;
using CarCenterDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,7 +10,8 @@ namespace CarCenterContracts.ViewModels
public class ReportOrderViewModel
{
public int Id { get; set; }
public List<(string, int)> Bundlings { get; set; } = new();
public List<(string, int)> Requests { get; set; } = new();
//Пока не ясно что конкретно передавать в отчет, поэтому передается моделька
public List<IBundlingModel> Bundlings { get; set; } = new();
public List<IRequestModel> Requests { get; set; } = new();
}
}

View File

@ -1,4 +1,5 @@
using System;
using CarCenterDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,6 +10,7 @@ namespace CarCenterContracts.ViewModels
public class ReportPresaleViewModel
{
public int Id { get; set; }
public List<(string, int)> Cars { get; set; } = new();
//Пока не ясно что конкретно передавать в отчет, поэтому передается моделька
public List<ICarModel> Cars { get; set; } = new();
}
}

View File

@ -31,6 +31,7 @@ namespace CarCenterDatabaseImplement.Implements
using var context = new CarCenterDatabase();
if (model.DateFrom.HasValue && model.DateTo.HasValue) // Для отчета списка
{
//будет применятся в ReportLogic
return context.Cars
.Include(x => x.Bundlings)
.ThenInclude(x => x.Bundling)

View File

@ -57,6 +57,7 @@ namespace CarCenterDatabaseImplement.Implements
if (model.DateFrom.HasValue && model.DateTo.HasValue) //для списка Сагиров
{
//будет применятся в ReportLogic
return context.Orders
.Include(x => x.Worker)
.Include(x => x.Cars)
@ -73,6 +74,7 @@ namespace CarCenterDatabaseImplement.Implements
}
else if (model.Presales.Count > 0) //для отчета Сагиров
{
//будет применятся в ReportLogic
return context.Orders
.Include(x => x.Worker)
.Include(x => x.Cars)
@ -84,6 +86,7 @@ namespace CarCenterDatabaseImplement.Implements
}
else if (model.Cars.Count > 0) //для отчета Малафеев
{
//будет применятся в ReportLogic
return context.Orders
.Include(x => x.Worker)
.Include(x => x.Cars)