Еще правлю
This commit is contained in:
parent
98c303acae
commit
99ca054c53
@ -17,15 +17,13 @@ namespace VetClinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly IServiceStorage _serviceStorage;
|
||||
private readonly IMedicineStorage _medicineStorage;
|
||||
private readonly IAnimalStorage _animalStorage;
|
||||
private readonly AbstractSaveToExcelPharmacist _saveToExcel;
|
||||
private readonly AbstractSaveToWordPharmacist _saveToWord;
|
||||
public ReportLogicPharmacist(IServiceStorage serviceStorage, IMedicineStorage medicineStorage, IAnimalStorage animalStorage,
|
||||
public ReportLogicPharmacist(IServiceStorage serviceStorage, IMedicineStorage medicineStorage,
|
||||
AbstractSaveToExcelPharmacist saveToExcel, AbstractSaveToWordPharmacist saveToWord)
|
||||
{
|
||||
_serviceStorage = serviceStorage;
|
||||
_medicineStorage = medicineStorage;
|
||||
_animalStorage = animalStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
}
|
||||
|
@ -6,9 +6,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VetClinicContracts.BindingModels
|
||||
{
|
||||
public class VisistsGuidesBindingModel
|
||||
public class VisitsGuidesBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public List<int> Medicines { get; set; } = new();
|
||||
DateTime DateFrom { get; set; } = DateTime.Now;
|
||||
DateTime DateTo { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
@ -11,6 +11,5 @@ namespace VetClinicContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? MedicineName { get; set; } = string.Empty;
|
||||
public int? PharmacistId { get; set; }
|
||||
public int? ServiceId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,5 @@ namespace VetClinicContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? ServiceName { get; set; } = string.Empty;
|
||||
public int? PharmacistId { get; set; }
|
||||
public int? MedicineId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VetClinicContracts.SearchModels
|
||||
{
|
||||
public class VisitServicesSearchModel
|
||||
public class VisitGuidesSearchModel
|
||||
{
|
||||
public List<int>? medicinesIds { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@ namespace VetClinicContracts.StoragesContracts
|
||||
MedicineViewModel? Insert(MedicineBindingModel model);
|
||||
MedicineViewModel? Update(MedicineBindingModel model);
|
||||
MedicineViewModel? Delete(MedicineBindingModel model);
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<GuidanceViewModel>>>>> GetGuidancesInfo(VisitServicesSearchModel model);
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<VisitViewModel>>>>> GetVisitsInfo(VisitServicesSearchModel model);
|
||||
List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<GuidanceViewModel>>>>> GetGuidancesInfo(VisitGuidesSearchModel model);
|
||||
List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<VisitViewModel>>>>> GetVisitsInfo(VisitGuidesSearchModel model);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace VetClinicContracts.StoragesContracts
|
||||
{
|
||||
List<ServiceViewModel> GetFullList();
|
||||
List<ServiceViewModel> GetFilteredList(ServiceSearchModel model);
|
||||
public List<Tuple<ServiceViewModel, List<Tuple<MedicineViewModel, List<AnimalViewModel>>>>> GetReportInfo(ListAnimalsSearchModel model);
|
||||
List<Tuple<ServiceViewModel, List<Tuple<MedicineViewModel, List<AnimalViewModel>>>>> GetReportInfo(ListAnimalsSearchModel model);
|
||||
ServiceViewModel? GetElement(ServiceSearchModel model);
|
||||
ServiceViewModel? Insert(ServiceBindingModel model);
|
||||
ServiceViewModel? Update(ServiceBindingModel model);
|
||||
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VetClinicContracts.ViewModels;
|
||||
|
||||
namespace VetClinicDataBaseImplement.Implements
|
||||
{
|
||||
public class VisitsGuidesViewModel
|
||||
{
|
||||
public string MedicineName { get; set; } = string.Empty;
|
||||
public List<VisitViewModel> Visits { get; set; } = new();
|
||||
public List<GuidanceViewModel> Guidances { get; set; } = new();
|
||||
public DateTime DateFrom { get; set; } = DateTime.Now;
|
||||
public DateTime DateTo { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
@ -29,11 +29,11 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
.ThenInclude(x => x.Animal).Include(x => x.Services).ThenInclude(x => x.Service)
|
||||
.Where(x => (string.IsNullOrEmpty(model.MedicineName) || x.MedicineName.Contains(model.MedicineName))
|
||||
&& (!model.PharmacistId.HasValue || x.PharmacistId == model.PharmacistId)
|
||||
&& (!model.ServiceId.HasValue || x.Services.Select(x => x.ServiceId).ToList().Contains(model.ServiceId.Value)))
|
||||
)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<GuidanceViewModel>>>>> GetGuidancesInfo(VisitServicesSearchModel model)
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<GuidanceViewModel>>>>> GetGuidancesInfo(VisitGuidesSearchModel model)
|
||||
{
|
||||
if (model.medicinesIds == null)
|
||||
{
|
||||
@ -46,11 +46,11 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
context.ServiceMedicines.Include(service => service.Service)
|
||||
.Include(service => service.Medicine).Where(service => medicine.Id == service.MedicineId).
|
||||
Select(service => new Tuple<ServiceViewModel, List<GuidanceViewModel>>(service.Service.GetViewModel,
|
||||
context.Guidances.Include(x => x.Service).Where(x => x.ServiceId == service.ServiceId).
|
||||
context.Guidances.Include(x => x.Service).Where(x => x.ServiceId == service.ServiceId && x.Date >= model.DateFrom && x.Date <= model.DateTo).
|
||||
Select(x => x.GetViewModel).ToList())).ToList())).ToList();
|
||||
|
||||
}
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<VisitViewModel>>>>> GetVisitsInfo(VisitServicesSearchModel model)
|
||||
public List<Tuple<MedicineViewModel, List<Tuple<ServiceViewModel, List<VisitViewModel>>>>> GetVisitsInfo(VisitGuidesSearchModel model)
|
||||
{
|
||||
if (model.medicinesIds == null)
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
context.ServiceMedicines.Include(service => service.Service)
|
||||
.Include(service => service.Medicine).Where(service => medicine.Id == service.MedicineId).
|
||||
Select(service => new Tuple<ServiceViewModel, List<VisitViewModel>>(service.Service.GetViewModel,
|
||||
context.ServiceVisits.Include(x => x.Visit).Where(x => x.ServiceId == service.ServiceId).
|
||||
context.ServiceVisits.Include(x => x.Visit).Where(x => x.ServiceId == service.ServiceId && x.Visit.DateVisit >= model.DateFrom && x.Visit.DateVisit <= model.DateTo).
|
||||
Select(x => x.Visit.GetViewModel).ToList())).ToList())).ToList();
|
||||
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
.Include(x => x.Medicines)
|
||||
.ThenInclude(x => x.Medicine)
|
||||
.Where(x => (string.IsNullOrEmpty(model.ServiceName) || x.ServiceName.Contains(model.ServiceName))
|
||||
&& (!model.PharmacistId.HasValue || x.PharmacistId == model.PharmacistId)
|
||||
&& (!model.MedicineId.HasValue || x.Medicines.Select(x => x.MedicineId).ToList().Contains(model.MedicineId.Value)))
|
||||
&& (!model.PharmacistId.HasValue || x.PharmacistId == model.PharmacistId))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -10,7 +10,7 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
public class VisitsGuidesViewModel
|
||||
{
|
||||
string MedicineName { get; set; } = string.Empty;
|
||||
List<VisitViewModel> Visits { get; set; }
|
||||
List<GuidanceViewModel> Guidances { get; set; }
|
||||
List<VisitViewModel> Visits { get; set; } = new();
|
||||
List<GuidanceViewModel> Guidances { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user