Последние доработки
This commit is contained in:
parent
7b9c99f532
commit
033766d524
@ -1,4 +1,5 @@
|
||||
using HotelAdministratorApp.Models;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using HotelAdministratorApp.Models;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
@ -316,6 +317,7 @@ namespace HotelAdministratorApp.Controllers
|
||||
{
|
||||
dinner.Add(din, new DinnerSearchModel { Id = din } as IDinnerModel);
|
||||
}
|
||||
var roomElem = APIClient.GetRequest<RoomViewModel>($"api/main/getroombyid?roomId={room}");
|
||||
APIClient.PostRequest("api/main/updateroom", new RoomBindingModel
|
||||
{
|
||||
Id = room,
|
||||
@ -324,6 +326,7 @@ namespace HotelAdministratorApp.Controllers
|
||||
DateCreate = dateCreate,
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
RoomDinners = dinner,
|
||||
MealPlanId = roomElem?.MealPlanId,
|
||||
});
|
||||
Response.Redirect("Rooms");
|
||||
}
|
||||
@ -435,6 +438,7 @@ namespace HotelAdministratorApp.Controllers
|
||||
{
|
||||
dinner.Add(din, new DinnerSearchModel { Id = din } as IDinnerModel);
|
||||
}
|
||||
var ConfBookElem = APIClient.GetRequest<ConferenceBookingViewModel>($"api/main/GetConferenceBookingById?conferencebookingId={conferencebooking}");
|
||||
APIClient.PostRequest("api/main/updateConferenceBooking", new ConferenceBookingBindingModel
|
||||
{
|
||||
Id = conferencebooking,
|
||||
@ -442,6 +446,7 @@ namespace HotelAdministratorApp.Controllers
|
||||
DateСonference = dateСonference,
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
ConferenceBookingDinners = dinner,
|
||||
ConferenceId = ConfBookElem?.ConferenceId
|
||||
});
|
||||
Response.Redirect("ConferenceBookings");
|
||||
}
|
||||
@ -487,13 +492,17 @@ namespace HotelAdministratorApp.Controllers
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
using var context = new HotelDataBase();
|
||||
var roomElem = APIClient.GetRequest<RoomViewModel>($"api/main/getroombyid?roomId={room}"); //комната со всеми ее атрибутами
|
||||
var dinners = _dinner.ReadList(new DinnerSearchModel { AdministratorId = APIClient.Administrator.Id }); //все обеды у администратора
|
||||
List<int> roomDinnersIds = context.RoomDinners
|
||||
var roomElem = APIClient.GetRequest<RoomViewModel>($"api/main/getroombyid?roomId={room}");
|
||||
List<int> dinners = context.RoomDinners
|
||||
.Where(rd => rd.RoomId == room)
|
||||
.Select(rd => rd.DinnerId)
|
||||
.ToList();
|
||||
|
||||
Dictionary<int, IDinnerModel> dinner = new Dictionary<int, IDinnerModel>();
|
||||
foreach (int din in dinners)
|
||||
{
|
||||
dinner.Add(din, new DinnerSearchModel { Id = din } as IDinnerModel);
|
||||
}
|
||||
APIClient.PostRequest("api/main/updateroom", new RoomBindingModel
|
||||
{
|
||||
Id = room,
|
||||
@ -501,8 +510,8 @@ namespace HotelAdministratorApp.Controllers
|
||||
RoomNumber = roomElem.RoomNumber,
|
||||
DateCreate = roomElem.DateCreate,
|
||||
RoomPrice = roomElem.RoomPrice,
|
||||
/*RoomDinners = roomElemrs,*/
|
||||
AdministratorId = roomElem.AdministratorId,
|
||||
RoomDinners = dinner,
|
||||
AdministratorId = roomElem.AdministratorId,
|
||||
});
|
||||
Response.Redirect("Rooms");
|
||||
}
|
||||
@ -558,16 +567,28 @@ namespace HotelAdministratorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return new PhysicalFileResult("C:\\Users\\sshan\\OneDrive\\Desktop\\reports\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return new PhysicalFileResult("C:\\Users\\sshan\\OneDrive\\Desktop\\reports\\exelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Report()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Report = new List<ReportRoomsConferenceBindingModel>();
|
||||
return View();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace HotelBusinessLogic.BusinessLogic
|
||||
_saveToExcel.CreateReport(new ExcelInfoAdministrator
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список покупок по обедам",
|
||||
Title = "Список планов питания по обедам",
|
||||
MealPlanDinners = GetMealPlanDinners(model)
|
||||
});
|
||||
}
|
||||
@ -45,7 +45,7 @@ namespace HotelBusinessLogic.BusinessLogic
|
||||
_saveToWord.CreateDoc(new WordInfoAdministrator
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список покупок по обедам",
|
||||
Title = "Список планов питания по обедам",
|
||||
MealPlanDinners = GetMealPlanDinners(model)
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,13 @@ namespace HotelBusinessLogic.OfficePackage
|
||||
Text = dinner.MealPlanName,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = dinner.MealPlanPrice.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace HotelBusinessLogic.OfficePackage
|
||||
CreateTable(new List<string> { "4cm", "4cm", "4cm", "4cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Дата", "Название медикамента", "Посещение ", "Лекарство" },
|
||||
Texts = new List<string> { "Дата", "Название обеда", "Комнаты", "Конференции" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
@ -42,7 +42,8 @@ namespace HotelBusinessLogic.OfficePackage
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (dinner.MealPlanName, new WordTextProperties { Size = "20", Bold=false})},
|
||||
{ (dinner.MealPlanName + " - ", new WordTextProperties { Size = "20", Bold=false}),
|
||||
(dinner.MealPlanPrice.ToString(), new WordTextProperties { Size = "20", Bold=false})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
Loading…
Reference in New Issue
Block a user