Очень дурацкая ошибка :<

This commit is contained in:
Кашин Максим 2023-05-19 16:33:44 +04:00
parent 1fe81f6fd4
commit 0e9c79b9a1
4 changed files with 21 additions and 8 deletions

View File

@ -72,16 +72,13 @@ namespace HotelBusinessLogic.BusinessLogics
{
var listAll = new List<ReportDinnersViewModel>();
var listСonferences = _roomStorage.GetFilteredList(new RoomSearchModel
var listRooms = _roomStorage.GetFilteredList(new RoomSearchModel
{
HeadwaiterId = model.HeadwaiterId,
RoomName = model.RoomName,
DateFrom = model.DateFrom,
DateTo = model.DateTo
});
foreach (var room in listСonferences)
foreach (var room in listRooms)
{
foreach (var m in room.RoomDinners.Values)
{
@ -97,6 +94,8 @@ namespace HotelBusinessLogic.BusinessLogics
var listConferenceBookings = _conferenceBookingStorage.GetFilteredList(new ConferenceBookingSearchModel
{
HeadwaiterId = model.HeadwaiterId,
DateFrom = model.DateFrom,
DateTo = model.DateTo
});
foreach (var conferenceBooking in listConferenceBookings)
@ -143,6 +142,8 @@ namespace HotelBusinessLogic.BusinessLogics
{
FileName = model.FileName,
Title = "Список обедов",
DateFrom = model.DateFrom!.Value,
DateTo = model.DateTo!.Value,
Dinners = GetDinners(model)
});
}

View File

@ -36,7 +36,7 @@ namespace HotelBusinessLogic.OfficePackage
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, dinner.RoomPrice.ToString(), dinner.NameHall, dinner.BookingDate?.ToShortDateString() },
Texts = new List<string> { dinner.DinnerName.ToString(), dinner.RoomName, dinner.RoomPrice.ToString(), dinner.NameHall },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -60,8 +60,20 @@ namespace HotelDataBaseImplement.Implemets
return new();
}
using var context = new HotelDataBase();
if (model.HeadwaiterId.HasValue) {
if (model.DateFrom.HasValue)
{
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
.Where(x => x.BookingDate >= model.DateFrom && x.BookingDate <= model.DateTo && x.HeadwaiterId == model.HeadwaiterId)
.Select(x => x.GetViewModel)
.ToList();
}
else if (model.HeadwaiterId.HasValue) {
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)