да, треш... (реализована регистрация и вход организатора на сайт)

This commit is contained in:
AnnZhimol 2023-05-14 17:51:51 +04:00
parent 86c160fb6b
commit 9a06e6dc58
34 changed files with 108175 additions and 208 deletions

View File

@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelRestApi", "HotelRestAp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelHeadwaiterApp", "HostrelHeadwaiterApp\HotelHeadwaiterApp.csproj", "{9F25F6AF-2887-467D-B4F1-E3805772124D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelOrganiserApp", "HotelOrganiserApp\HotelOrganiserApp.csproj", "{F5632E09-E4D1-46D4-B764-C2E19D7F72F0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelOrganiserApp", "HotelOrganiserApp\HotelOrganiserApp.csproj", "{F5632E09-E4D1-46D4-B764-C2E19D7F72F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -43,7 +43,7 @@ namespace HotelBusinessLogic.OfficePackage
{
Texts = new List<(string, WordTextProperties)>
{ (mealPlan.Item1 + " - ", new WordTextProperties { Size = "20", Bold=false}),
(mealPlan.Item2.ToShortDateString(), new WordTextProperties { Size = "20", Bold=false})},
(mealPlan.Item2.ToString(), new WordTextProperties { Size = "20", Bold=false})},
TextProperties = new WordTextProperties
{
Size = "24",

View File

@ -4,5 +4,6 @@
{
public int? Id { get; set; }
public string? MealPlanName { get; set; }
public int? OrganiserId { get; set; }
}
}

View File

@ -4,5 +4,6 @@
{
public int? Id { get; set; }
public string? MemberFIO { get; set; }
public int? OrganiserId { get; set; }
}
}

View File

@ -5,6 +5,7 @@
public int? Id { get; set; }
public string? OrganiserFIO { get; set; }
public string? OrganiserLogin { get; set; }
public string? OrganiserEmail { get; set; }
public string? OrganiserPassword { get; set; }
}
}

View File

@ -49,13 +49,28 @@ namespace HotelDataBaseImplement.Implemets
public List<MealPlanViewModel> GetFilteredList(MealPlanSearchModel model)
{
if (string.IsNullOrEmpty(model.MealPlanName))
if (string.IsNullOrEmpty(model.MealPlanName) && !model.OrganiserId.HasValue)
{
return new();
}
using var context = new HotelDataBase();
if (model.OrganiserId.HasValue)
{
return context.MealPlans
.Include(x => x.Members)
.ThenInclude(x => x.Member)
.ThenInclude(x => x.ConferenceMember)
.ThenInclude(x => x.Conference)
.Include(x => x.Rooms)
.Include(x => x.Organiser)
.Where(x => x.OrganiserId == model.OrganiserId)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
return context.MealPlans
.Include(x => x.Members)
.ThenInclude(x => x.Member)

View File

@ -47,13 +47,27 @@ namespace HotelDataBaseImplement.Implemets
public List<MemberViewModel> GetFilteredList(MemberSearchModel model)
{
if (string.IsNullOrEmpty(model.MemberFIO))
if (string.IsNullOrEmpty(model.MemberFIO) && !model.OrganiserId.HasValue)
{
return new();
}
using var context = new HotelDataBase();
if (model.OrganiserId.HasValue)
{
return context.Members
.Include(x => x.ConferenceMember)
.ThenInclude(x => x.Conference)
.Include(x => x.MealPlanMember)
.ThenInclude(x => x.MealPlan)
.Include(x => x.Organiser)
.Where(x => x.OrganiserId == model.OrganiserId)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
return context.Members
.Include(x => x.ConferenceMember)
.ThenInclude(x => x.Conference)

View File

@ -38,20 +38,20 @@ namespace HotelDataBaseImplement.Implemets
.FirstOrDefault(x => x.Id == model.Id)?
.GetViewModel;
if (!string.IsNullOrEmpty(model.OrganiserLogin) && !string.IsNullOrEmpty(model.OrganiserPassword))
if (!string.IsNullOrEmpty(model.OrganiserEmail) && !string.IsNullOrEmpty(model.OrganiserPassword))
return context.Organisers
.Include(x => x.MealPlans)
.Include(x => x.Members)
.Include(x => x.Conferences)
.FirstOrDefault(x => x.OrganiserLogin.Equals(model.OrganiserLogin) && x.OrganiserPassword.Equals(model.OrganiserPassword))?
.FirstOrDefault(x => x.OrganiserEmail.Equals(model.OrganiserEmail) && x.OrganiserPassword.Equals(model.OrganiserPassword))?
.GetViewModel;
if (!string.IsNullOrEmpty(model.OrganiserLogin))
if (!string.IsNullOrEmpty(model.OrganiserEmail))
return context.Organisers
.Include(x => x.MealPlans)
.Include(x => x.Members)
.Include(x => x.Conferences)
.FirstOrDefault(x => x.OrganiserLogin.Equals(model.OrganiserLogin))?
.FirstOrDefault(x => x.OrganiserEmail.Equals(model.OrganiserEmail))?
.GetViewModel;
return null;

View File

@ -45,6 +45,7 @@ namespace HotelDataBaseImplement.Models
Id = model.Id,
ConferenceName = model.ConferenceName,
StartDate = model.StartDate,
OrganiserId=model.OrganiserId,
Members = model.ConferenceMembers.Select(x => new ConferenceMember
{
Member = context.Members.First(y => y.Id == x.Key),
@ -56,6 +57,7 @@ namespace HotelDataBaseImplement.Models
{
ConferenceName = model.ConferenceName;
StartDate = model.StartDate;
OrganiserId = model.OrganiserId;
}
public ConferenceViewModel GetViewModel => new()
@ -63,6 +65,7 @@ namespace HotelDataBaseImplement.Models
Id = Id,
ConferenceName = ConferenceName,
StartDate = StartDate,
OrganiserId = OrganiserId,
ConferenceMembers = ConferenceMembers
};

View File

@ -46,6 +46,7 @@ namespace HotelDataBaseImplement.Models
Id = model.Id,
MealPlanName = model.MealPlanName,
MealPlanPrice = model.MealPlanPrice,
OrganiserId = model.OrganiserId,
Members = model.MealPlanMembers.Select(x => new MealPlanMember
{
Member = context.Members.First(y => y.Id == x.Key),
@ -57,6 +58,7 @@ namespace HotelDataBaseImplement.Models
{
MealPlanName = model.MealPlanName;
MealPlanPrice = model.MealPlanPrice;
OrganiserId = model.OrganiserId;
}
public MealPlanViewModel GetViewModel => new()
@ -64,6 +66,7 @@ namespace HotelDataBaseImplement.Models
Id = Id,
MealPlanName = MealPlanName,
MealPlanPrice = MealPlanPrice,
OrganiserId=OrganiserId,
MealPlanMembers = MealPlanMembers
};

View File

@ -35,7 +35,8 @@ namespace HotelDataBaseImplement.Models
{
Id = model.Id,
MemberFIO = model.MemberFIO,
Citizenship = model.Citizenship
Citizenship = model.Citizenship,
OrganiserId = model.OrganiserId,
};
}
public static Member Create(MemberViewModel model)
@ -44,7 +45,8 @@ namespace HotelDataBaseImplement.Models
{
Id = model.Id,
MemberFIO = model.MemberFIO,
Citizenship = model.Citizenship
Citizenship = model.Citizenship,
OrganiserId=model.OrganiserId,
};
}
public void Update(MemberBindingModel model)
@ -55,12 +57,14 @@ namespace HotelDataBaseImplement.Models
}
MemberFIO = model.MemberFIO;
Citizenship = model.Citizenship;
OrganiserId = model.OrganiserId;
}
public MemberViewModel GetViewModel => new()
{
Id = Id,
MemberFIO = MemberFIO,
Citizenship = Citizenship
Citizenship = Citizenship,
OrganiserId=OrganiserId
};
}
}

View File

@ -1,6 +1,9 @@
using HotelOrganiserApp.Models;
using HotelContracts.BindingModels;
using HotelContracts.ViewModels;
using HotelOrganiserApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using System.Text;
namespace HotelOrganiserApp.Controllers
{
@ -15,55 +18,104 @@ namespace HotelOrganiserApp.Controllers
public IActionResult Index()
{
if (APIClient.Organiser == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
public IActionResult Register()
[HttpGet]
public IActionResult Privacy()
{
return View();
if (APIClient.Organiser == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Organiser);
}
[HttpPost]
public void Privacy(string login, string email, string password, string fio, string telephone)
{
if (APIClient.Organiser == null)
{
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/organiser/updatedata", new OrganiserBindingModel
{
Id = APIClient.Organiser.Id,
OrganiserFIO = fio,
OrganiserLogin = login,
OrganiserPassword = password,
OrganiserEmail= email,
OrganiserNumber= telephone
});
APIClient.Organiser.OrganiserFIO = fio;
APIClient.Organiser.OrganiserLogin = login;
APIClient.Organiser.OrganiserPassword = password;
APIClient.Organiser.OrganiserEmail = email;
APIClient.Organiser.OrganiserNumber = telephone;
Response.Redirect("Index");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
[HttpGet]
public IActionResult Enter()
{
return View();
}
public IActionResult Report()
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APIClient.Organiser = APIClient.GetRequest<OrganiserViewModel>($"api/organiser/login?login={login}&password={password}");
if (APIClient.Organiser == null)
{
throw new Exception("Неверный логин/пароль");
}
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Register()
{
return View();
}
public IActionResult BindingRoomAndMealPlan()
[HttpPost]
public void Register(string login, string email, string password, string fio, string telephone)
{
return View();
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/organiser/register", new OrganiserBindingModel
{
OrganiserFIO = fio,
OrganiserLogin = login,
OrganiserPassword = password,
OrganiserEmail = email,
OrganiserNumber = telephone
});
Response.Redirect("Enter");
return;
}
public IActionResult FormationDinner()
{
return View();
}
public IActionResult ShapingDinnerIntoRooms()
{
return View();
}
public IActionResult FormationOfDinnerInConferenceBookings()
{
return View();
}
public IActionResult ListOfMealPlans()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@ -6,8 +6,21 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot\css\styles.razor" />
</ItemGroup>
<ItemGroup>
<None Remove="styles.css" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\Images\logo.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="TagHelperPack" Version="0.10.1" />
</ItemGroup>
<ItemGroup>

View File

@ -1,9 +1,12 @@
using HotelOrganiserApp;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
APIClient.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())

View File

@ -1,21 +1,35 @@
@{
ViewData["Title"] = "Enter";
}
<head>
<link rel="stylesheet" href="~/css/entry.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
<h2
class="u-text u-text-custom-color-1 u-text-default u-text-1"
>
Вход
</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
</div>
</form>
<div class="u-form-group u-label-top u-form-group-1">
<label class="u-label u-text-custom-color-1 u-label-1">Электронная почта</label>
<input
type="text"
placeholder="Введите свой логин"
name="login"
class="u-input u-input-rectangle u-input-1"/>
</div>
<div class="u-form-group u-label-top u-form-group-2">
<label class="u-label u-text-custom-color-1 u-label-2">Пароль</label>
<input
type="password"
placeholder="Введите свой пароль"
name="password"
class="u-input u-input-rectangle u-input-2"/>
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Войти" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1"/></div>
</div>
</form>

View File

@ -6,18 +6,44 @@
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Главная страница</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
}
</div>
<head>
<link rel="stylesheet" href="~/css/mainpage.css" asp-append-version="true" />
</head>
<section class="u-clearfix u-section-1" id="sec-83a8">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-expanded-width u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-col">
<div
class="u-container-style u-layout-cell u-size-30 u-layout-cell-1"
>
<div
class="u-container-layout u-valign-bottom u-container-layout-1"
>
<h2
class="u-align-center u-text u-text-custom-color-1 u-text-default u-text-1"
>
Гостиница
</h2>
</div>
</div>
<div
class="u-container-style u-layout-cell u-size-30 u-layout-cell-2"
>
<div
class="u-container-layout u-valign-top u-container-layout-2"
style="padding: 120px"
>
<img
class="u-image u-image-contain u-image-1"
src="~/Images/logo.png"
data-image-width="2388"
data-image-height="1260"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -1,33 +1,59 @@
@{
ViewData["Title"] = "Register";
ViewData["Title"] = "Register";
}
<head>
<link rel="stylesheet" href="~/css/register.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Регистрация </h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" /></div>
</div>
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-4">Электронная почта:</div>
<div class="col-8"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Номер телефона:</div>
<div class="col-8"><input type="text" name="telephone" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Логин</label>
<input
type="text"
placeholder="Введите логин"
name="login"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Электронная почта</label>
<input
type="email"
placeholder="Введите электронную почту"
name="email"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-group u-label-top u-form-group-3">
<label class="u-label u-text-custom-color-1 u-label-3">ФИО</label>
<input
type="text"
placeholder="Введите ФИО"
name="fio"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-group u-label-top u-form-group-4">
<label class="u-label u-text-custom-color-1 u-label-4">Номер телефона</label>
<input
type="text"
name="telephone"
class="u-input u-input-rectangle"
placeholder="Введите номер телефона"/>
</div>
<div class="u-form-group u-label-top u-form-group-5">
<label class="u-label u-text-custom-color-1 u-label-5">Пароль</label>
<input
type="password"
placeholder="Введите пароль"
name="password"
class="u-input u-input-rectangle"/>
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top"
style="padding: 120px">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Зарегистрироваться" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
</form>

View File

@ -7,40 +7,204 @@
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/HotelOrganiserApp.styles.css" asp-append-version="true" />
<script src="~/lib/jquery/dist/jquery.min.js"></script>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Hotel</a>
<i class="fa-brands fa-elementor"></i>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
<div class="navbar-nav">
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="Enter">Аутентификация </a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="Index">Главное меню</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="FormationMember">Участник</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ShapingMemberIntoMealPlans">План питания</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="FormationMembersAndConference">Конференции</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ListOfMembers">Список участников</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="Report">Отчет по участникам</a>
<body class="u-body u-xl-mode" data-lang="ru">
<header class="u-clearfix u-custom-color-4 u-header u-header" id="sec-0855">
<div class="u-clearfix u-sheet u-sheet-1">
<a class="u-image u-logo u-image-1" data-image-width="2388"
data-image-height="1260" asp-area="" asp-controller="Home" asp-action="Index">
<img
src="~/Images/logo.png"
class="u-logo-image u-logo-image-1"
/>
</a>
<nav class="u-menu u-menu-dropdown u-offcanvas u-menu-1">
<div
class="menu-collapse"
style="font-size: 1rem; letter-spacing: 0px"
>
<a
class="u-button-style u-custom-active-color u-custom-left-right-menu-spacing u-custom-padding-bottom u-custom-text-active-color u-custom-text-color u-custom-text-hover-color u-custom-top-bottom-menu-spacing u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="#"
>
<svg class="u-svg-link" viewBox="0 0 24 24">
<use
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="#menu-hamburger"
></use>
</svg>
<svg
class="u-svg-content"
version="1.1"
id="menu-hamburger"
viewBox="0 0 16 16"
x="0px"
y="0px"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<rect y="1" width="16" height="2"></rect>
<rect y="7" width="16" height="2"></rect>
<rect y="13" width="16" height="2"></rect>
</g>
</svg>
</a>
</div>
<div class="u-custom-menu u-nav-container">
<ul class="u-nav u-unstyled u-nav-1">
<li class="u-nav-item">
<a class="u-button-style u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6" style="padding: 10px 20px" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
href="#"
style="padding: 10px 20px"
>Отчеты</a
>
<div class="u-nav-popup">
<ul class="u-h-spacing-20 u-nav u-unstyled u-v-spacing-10">
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (pdf)</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (xls)</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (docx)</a>
</li>
</ul>
</div>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
href="#"
style="padding: 10px 20px"
>Справочники</a
>
<div class="u-nav-popup">
<ul class="u-h-spacing-20 u-nav u-unstyled u-v-spacing-10">
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="ListConferences"
>Конференции</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="ListMealPlans"
>Планы питания</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-custom-color-4 u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6"
asp-area="" asp-controller="Home" asp-action="ListMembers"
>Участники</a>
</li>
</ul>
</div>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6" style="padding: 10px 20px" asp-area="" asp-controller="Home" asp-action="Register">Зарегистрироваться</a>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link u-text-active-custom-color-2 u-text-custom-color-1 u-text-hover-custom-color-6" style="padding: 10px 20px" asp-area="" asp-controller="Home" asp-action="Enter">Войти</a>
</li>
</ul>
</div>
<div class="u-custom-menu u-nav-container-collapse">
<div
class="u-black u-container-style u-inner-container-layout u-opacity u-opacity-95 u-sidenav"
>
<div class="u-inner-container-layout u-sidenav-overflow">
<div class="u-menu-close"></div>
<ul
class="u-align-center u-nav u-popupmenu-items u-unstyled u-nav-4"
>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" asp-area="" asp-controller="Home" asp-action="Index"
>Главная</a>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" href="#">Отчеты</a>
<div class="u-nav-popup">
<ul
class="u-h-spacing-20 u-nav u-unstyled u-v-spacing-10"
>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (pdf)</a>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (xls)</a>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" asp-area="" asp-controller="Home" asp-action="Register"
>Список участников (docx)</a>
</li>
</ul>
</div>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" href="#"
>Справочники</a
>
<div class="u-nav-popup">
<ul
class="u-h-spacing-20 u-nav u-unstyled u-v-spacing-10"
>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link"
asp-area="" asp-controller="Home" asp-action="ListConferences"
>Конференции</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link"
asp-area="" asp-controller="Home" asp-action="ListMealPlans"
>Планы питания</a>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link"
asp-area="" asp-controller="Home" asp-action="ListMembers"
>Участники</a>
</li>
</ul>
</div>
</li>
<li class="u-nav-item">
<a
class="u-button-style u-nav-link"
asp-area="" asp-controller="Home" asp-action="Register"
>Зарегистрироваться</a>
</li>
<li class="u-nav-item">
<a class="u-button-style u-nav-link" asp-area="" asp-controller="Home" asp-action="Entry"
>Войти</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="u-black u-menu-overlay u-opacity u-opacity-70"></div>
</div>
</nav>
</div>
</header>
<div class="container">
<main role="main" class="pb-3">
@ -48,14 +212,15 @@
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
Hotel Kashin Zhimolostnova 2023 - <a asp-area="" asp-controller="Home" asp-action="Index">Главная страница</a>
</div>
<footer class="u-align-center u-clearfix u-custom-color-7 u-footer u-footer" id="sec-8631">
<div class="u-clearfix u-sheet u-valign-middle u-sheet-1">
<p class="u-small-text u-text u-text-custom-color-1 u-text-variant u-text-1">Гостиница "Развитие". 2023 г. </p>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script src="~/js/jquery.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -5,5 +5,6 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"IPAddress": "http://localhost:5079/"
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -0,0 +1,173 @@
.u-section-1 .u-sheet-1 {
min-height: 594px;
}
.u-section-1 .u-layout-wrap-1 {
margin-top: 59px;
margin-bottom: 60px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 400px;
}
.u-section-1 .u-container-layout-1 {
padding: 0;
}
.u-section-1 .u-image-1 {
width: 569px;
height: 300px;
margin: 0 auto;
}
.u-section-1 .u-layout-cell-2 {
min-height: 400px;
}
.u-section-1 .u-container-layout-2 {
padding: 0;
}
.u-section-1 .u-text-1 {
font-weight: 700;
margin: 14px auto 0;
}
.u-section-1 .u-form-1 {
height: 251px;
width: 510px;
margin: 9px 30px 0;
}
.u-section-1 .u-form-group-1 {
margin-left: 0;
}
.u-section-1 .u-label-1 {
font-weight: 700;
}
.u-section-1 .u-input-1 {
font-weight: 700;
margin: 14px 166px 0 auto;
}
.u-section-1 .u-form-group-2 {
margin-left: 0;
}
.u-section-1 .u-label-2 {
font-weight: 700;
}
.u-section-1 .u-input-2 {
font-weight: 700;
margin: 14px 166px 0 auto;
}
.u-section-1 .u-btn-1 {
background-image: none;
}
@media (max-width: 1199px) {
.u-section-1 .u-sheet-1 {
min-height: 524px;
}
.u-section-1 .u-layout-wrap-1 {
position: relative;
}
.u-section-1 .u-layout-cell-1 {
min-height: 330px;
}
.u-section-1 .u-image-1 {
width: 470px;
height: 248px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 330px;
}
.u-section-1 .u-form-1 {
width: 470px;
margin-left: 0;
margin-right: 0;
}
.u-section-1 .u-input-1 {
margin-right: 136px;
}
.u-section-1 .u-input-2 {
margin-right: 136px;
}
}
@media (max-width: 991px) {
.u-section-1 .u-sheet-1 {
min-height: 447px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 253px;
}
.u-section-1 .u-image-1 {
width: 360px;
height: 190px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 100px;
}
.u-section-1 .u-form-1 {
width: 360px;
}
.u-section-1 .u-input-1 {
margin-right: 104px;
}
.u-section-1 .u-input-2 {
margin-right: 104px;
}
}
@media (max-width: 767px) {
.u-section-1 .u-sheet-1 {
min-height: 674px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 380px;
}
.u-section-1 .u-form-1 {
margin-top: 24px;
}
}
@media (max-width: 575px) {
.u-section-1 .u-sheet-1 {
min-height: 533px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 239px;
}
.u-section-1 .u-image-1 {
width: 340px;
height: 179px;
}
.u-section-1 .u-form-1 {
margin-top: 30px;
width: 340px;
}
}

View File

@ -0,0 +1,85 @@
.u-section-1 .u-sheet-1 {
min-height: 476px;
}
.u-section-1 .u-layout-wrap-1 {
margin-top: 35px;
margin-bottom: 60px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 167px;
}
.u-section-1 .u-container-layout-1 {
padding: 30px;
}
.u-section-1 .u-text-1 {
margin: auto auto 0;
}
.u-section-1 .u-layout-cell-2 {
min-height: 279px;
}
.u-section-1 .u-container-layout-2 {
padding: 30px;
}
.u-section-1 .u-image-1 {
width: 323px;
height: 219px;
margin: 0 auto;
}
@media (max-width: 1199px) {
.u-section-1 .u-sheet-1 {
min-height: 400px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 138px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 230px;
}
}
@media (max-width: 991px) {
.u-section-1 .u-layout-cell-1 {
min-height: 100px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 176px;
}
}
@media (max-width: 767px) {
.u-section-1 .u-container-layout-1 {
padding-left: 10px;
padding-right: 10px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 132px;
}
.u-section-1 .u-container-layout-2 {
padding-left: 10px;
padding-right: 10px;
}
}
@media (max-width: 575px) {
.u-section-1 .u-layout-cell-2 {
min-height: 83px;
}
.u-section-1 .u-image-1 {
width: 320px;
height: 217px;
}
}

View File

@ -0,0 +1,147 @@
.u-section-1 .u-sheet-1 {
min-height: 720px;
}
.u-section-1 .u-layout-wrap-1 {
margin-top: 60px;
margin-bottom: 14px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 175px;
}
.u-section-1 .u-container-layout-1 {
padding: 30px;
}
.u-section-1 .u-image-1 {
width: 218px;
height: 115px;
margin: 0 auto;
}
.u-section-1 .u-layout-cell-2 {
min-height: 412px;
}
.u-section-1 .u-container-layout-2 {
padding: 0 30px;
}
.u-section-1 .u-text-1 {
font-weight: 700;
margin: 18px auto 0;
}
.u-section-1 .u-form-1 {
height: 323px;
width: 570px;
margin: 0 auto;
}
.u-section-1 .u-label-1 {
font-weight: 700;
}
.u-section-1 .u-label-2 {
font-weight: 700;
}
.u-section-1 .u-form-group-3 {
margin-left: 0;
}
.u-section-1 .u-label-3 {
font-weight: 700;
}
.u-section-1 .u-form-group-4 {
margin-left: 0;
}
.u-section-1 .u-label-4 {
font-weight: 700;
}
.u-section-1 .u-form-group-5 {
margin-left: 0;
}
.u-section-1 .u-label-5 {
font-weight: 700;
}
.u-section-1 .u-btn-1 {
background-image: none;
}
@media (max-width: 1199px) {
.u-section-1 .u-sheet-1 {
min-height: 650px;
}
.u-section-1 .u-layout-wrap-1 {
position: relative;
}
.u-section-1 .u-layout-cell-1 {
min-height: 144px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 340px;
}
}
@media (max-width: 991px) {
.u-section-1 .u-sheet-1 {
min-height: 546px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 110px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 100px;
}
}
@media (max-width: 767px) {
.u-section-1 .u-sheet-1 {
min-height: 515px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 83px;
}
.u-section-1 .u-container-layout-1 {
padding-left: 10px;
padding-right: 10px;
}
.u-section-1 .u-container-layout-2 {
padding-left: 10px;
padding-right: 10px;
}
.u-section-1 .u-form-1 {
width: 520px;
}
}
@media (max-width: 575px) {
.u-section-1 .u-sheet-1 {
min-height: 480px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 52px;
}
.u-section-1 .u-form-1 {
width: 320px;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
<h3>styles</h3>
@code {
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
using HotelContracts.BindingModels;
using HotelContracts.BusinessLogicsContracts;
using HotelContracts.SearchModels;
using HotelContracts.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.IO.Packaging;
namespace HotelRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class MainController : Controller
{
private readonly ILogger _logger;
private readonly IConferenceLogic _conference;
private readonly IMemberLogic _member;
private readonly IMealPlanLogic _mealPlan;
public MainController(ILogger<MainController> logger, IConferenceLogic conference, IMemberLogic member, IMealPlanLogic mealPlan)
{
_logger = logger;
_conference = conference;
_member = member;
_mealPlan = mealPlan;
}
[HttpGet]
public List<ConferenceViewModel>? GetConferenceList(int organiserId)
{
try
{
return _conference.ReadList(new ConferenceSearchModel
{
OrganiserId = organiserId,
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка конференций");
throw;
}
}
[HttpGet]
public List<MemberViewModel>? GetMemberList(int organiserId)
{
try
{
return _member.ReadList(new MemberSearchModel
{
OrganiserId= organiserId,
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка участников");
throw;
}
}
[HttpGet]
public List<MealPlanViewModel>? GetMealPlanList(int organiserId)
{
try
{
return _mealPlan.ReadList(new MealPlanSearchModel
{
OrganiserId=organiserId,
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка планов питания");
throw;
}
}
[HttpGet]
public MemberViewModel? GetMember(int memberId)
{
try
{
return _member.ReadElement(new MemberSearchModel
{
Id = memberId
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения участника по id={Id}", memberId);
throw;
}
}
[HttpPost]
public void CreateMember(MemberBindingModel model)
{
try
{
_member.Create(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания участника");
throw;
}
}
[HttpPost]
public void CreateConference(ConferenceBindingModel model)
{
try
{
_conference.Create(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания конференции");
throw;
}
}
[HttpPost]
public void CreateMealPlan(MealPlanBindingModel model)
{
try
{
_mealPlan.Create(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания плана питания");
throw;
}
}
}
}

View File

@ -0,0 +1,68 @@
using HotelContracts.BindingModels;
using HotelContracts.BusinessLogicsContracts;
using HotelContracts.SearchModels;
using HotelContracts.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace HotelRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class OrganiserController : Controller
{
private readonly ILogger _logger;
private readonly IOrganiserLogic _logic;
public OrganiserController(IOrganiserLogic logic, ILogger<OrganiserController> logger)
{
_logger = logger;
_logic = logic;
}
[HttpGet]
public OrganiserViewModel? Login(string login, string password)
{
try
{
return _logic.ReadElement(new OrganiserSearchModel
{
OrganiserEmail = login,
OrganiserPassword = password
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка входа в систему");
throw;
}
}
[HttpPost]
public void Register(OrganiserBindingModel model)
{
try
{
_logic.Create(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка регистрации");
throw;
}
}
[HttpPost]
public void UpdateData(OrganiserBindingModel model)
{
try
{
_logic.Update(model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка обновления данных");
throw;
}
}
}
}

View File

@ -1,33 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace HotelRestApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

View File

@ -12,6 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HotelBusinessLogic\HotelBusinessLogic.csproj" />
<ProjectReference Include="..\HotelContracts\HotelContracts.csproj" />
<ProjectReference Include="..\HotelDataBaseImplement\HotelDataBaseImplement.csproj" />
</ItemGroup>

View File

@ -1,40 +1,66 @@
using HotelBusinessLogic.BusinessLogics;
using HotelContracts.BusinessLogicsContracts;
using HotelContracts.StoragesContracts;
using HotelDataBaseImplement.Implemets;
using Microsoft.OpenApi.Models;
//using HotelBusinessLogic.MailWorker;
using HotelContracts.BindingModels;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
// Add services to the container.
builder.Services.AddTransient<IOrganiserStorage, OrganiserStorage>();
builder.Services.AddTransient<IMealPlanStorage, MealPlanStorage>();
builder.Services.AddTransient<IMemberStorage, MemberStorage>();
builder.Services.AddTransient<IConferenceStorage, ConferenceStorage>();
builder.Services.AddTransient<IHeadwaiterStorage, HeadwaiterStorage>();
builder.Services.AddTransient<IDinnerStorage, DinnerStorage>();
builder.Services.AddTransient<IRoomStorage, RoomStorage>();
builder.Services.AddTransient<IConferenceBookingStorage, ConferenceBookingStorage>();
builder.Services.AddTransient<IOrganiserLogic, OrganiserLogic>();
builder.Services.AddTransient<IMealPlanLogic, MealPlanLogic>();
builder.Services.AddTransient<IMemberLogic, MemberLogic>();
builder.Services.AddTransient<IConferenceLogic, ConferenceLogic>();
/*
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
builder.Services.AddControllers();*/
//builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "ConfectoneryRestApi",
Title = "HotelRestApi",
Version = "v1"
});
});
var app = builder.Build();
//var mailSender = app.Services.GetService<AbstractMailWorker>();
//mailSender?.MailConfig(new MailConfigBindingModel
//{
// MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
// MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
// SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
// SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
// PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
// PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
//});
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
"ConfectoneryRestApi v1"));
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "HotelRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
app.Run();

View File

@ -1,13 +0,0 @@
namespace HotelRestApi
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}