Создание, добавление, изменение для LogicHeadwaiter (не рабочий LogicHeadwaiter)
This commit is contained in:
parent
98352f0c47
commit
c632a3b75b
118
Hotel/HotelBusinessLogic/BusinessLogics/ReportLogicHeadwaiter.cs
Normal file
118
Hotel/HotelBusinessLogic/BusinessLogics/ReportLogicHeadwaiter.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using HotelBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using HotelBusinessLogic.OfficePackage;
|
||||||
|
using HotelContracts.BindingModels;
|
||||||
|
using HotelContracts.SearchModels;
|
||||||
|
using HotelContracts.StoragesContracts;
|
||||||
|
using HotelContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HotelContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
|
namespace HotelBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ReportLogicHeadwaiter : IReportHeadwaiterLogic
|
||||||
|
{
|
||||||
|
private readonly IRoomStorage _roomStorage;
|
||||||
|
private readonly IDinnerStorage _dinnerStorage;
|
||||||
|
private readonly IMealPlanStorage _mealPlansStorage;
|
||||||
|
private readonly IConferenceBookingStorage _conferenceBookingStorage;
|
||||||
|
private readonly AbstractSaveToExcelHeadwaiter _saveToExcel;
|
||||||
|
private readonly AbstractSaveToWordHeadwaitre _saveToWord;
|
||||||
|
private readonly AbstractSaveToPdfHeadwaiter _saveToPdf;
|
||||||
|
public ReportLogicHeadwaiter(IRoomStorage roomStorage, IDinnerStorage dinnerStorage, IMealPlanStorage mealPlansStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelHeadwaiter saveToExcel, AbstractSaveToWordHeadwaitre saveToWord, AbstractSaveToPdfHeadwaiter saveToPdf)
|
||||||
|
{
|
||||||
|
_roomStorage = roomStorage;
|
||||||
|
_dinnerStorage = dinnerStorage;
|
||||||
|
_mealPlansStorage = mealPlansStorage;
|
||||||
|
_conferenceBookingStorage = conferenceBookingStorage;
|
||||||
|
_saveToExcel = saveToExcel;
|
||||||
|
_saveToWord = saveToWord;
|
||||||
|
_saveToPdf = saveToPdf;
|
||||||
|
}
|
||||||
|
public List<ReportMealPlanDinnerViewModel> GetMealPlanDinner()
|
||||||
|
{
|
||||||
|
var mealPlans = _mealPlansStorage.GetFullList();
|
||||||
|
var dinners = _dinnerStorage.GetFullList();
|
||||||
|
var list = new List<ReportMealPlanDinnerViewModel>();
|
||||||
|
foreach (var dinner in dinners)
|
||||||
|
{
|
||||||
|
var record = new ReportMealPlanDinnerViewModel
|
||||||
|
{
|
||||||
|
DinnerName = dinner.DinnerName,
|
||||||
|
MealPlans = new List<Tuple<string, DateTime>>()
|
||||||
|
};
|
||||||
|
foreach (var mealPlan in mealPlans)
|
||||||
|
{
|
||||||
|
if (mealPlan.MealPlanDinners.ContainsKey(dinner.Id))
|
||||||
|
{
|
||||||
|
record.MealPlans.Add(new Tuple<string, DateTime>(mealPlans.MealPlanName, mealPlans.StartDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportConferenceBindingRoomsViewModel> GetConferenceBindingRooms(ReportHeadwaiterBindingModel model)
|
||||||
|
{
|
||||||
|
var listAll = new List<ReportConferenceBindingRoomsViewModel>();
|
||||||
|
|
||||||
|
var listConferenceBinding = _conferenceBookingStorage.GetFilteredList(new ConferenceBookingSearchModel
|
||||||
|
{
|
||||||
|
HeadwaiterId = model.HeadwaiterId,
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo
|
||||||
|
});
|
||||||
|
|
||||||
|
var listRooms = _roomStorage.GetFilteredList(new RoomSearchModel());
|
||||||
|
|
||||||
|
foreach (var room in listRooms)
|
||||||
|
{
|
||||||
|
listAll.Add(new ReportConferenceBindingRoomsViewModel
|
||||||
|
{
|
||||||
|
RoomName = room.RoomName,
|
||||||
|
RoomPrice = room.RoomPrice,
|
||||||
|
RoomFrame = room.RoomFrame
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return listAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveMealPlanDinnerToExcelFile(ReportHeadwaiterBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfoHeadwaiter
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список изделий",
|
||||||
|
MealPlanDinner = GetMealPlanDinner()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveMealPlanDinnerToWordFile(ReportHeadwaiterBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfoHeadwaiter
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список участников",
|
||||||
|
MealPlanDinner = GetMealPlanDinner()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveConferenceBindingRoomsToPdfFile(ReportHeadwaiterBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfoHeadwaiter
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список участников",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
ConferenceBindingRooms = GetConferenceBindingRooms(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace HotelContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ReportHeadwaiterBindingModel
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
|
public int HeadwaiterId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using HotelContracts.BindingModels;
|
||||||
|
using HotelContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace HotelContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IReportHeadwaiterLogic
|
||||||
|
{
|
||||||
|
List<ReportMealPlanDinnerViewModel> GetMealPlanDinner();
|
||||||
|
List<ReportConferenceBindingRoomsViewModel> GetConferenceBindingRooms(ReportHeadwaiterBindingModel model);
|
||||||
|
void SaveMealPlanDinnerToWordFile(ReportHeadwaiterBindingModel model);
|
||||||
|
void SaveMealPlanDinnerToExcelFile(ReportHeadwaiterBindingModel model);
|
||||||
|
void SaveConferenceBindingRoomsToPdfFile(ReportHeadwaiterBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user