Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10
This commit is contained in:
commit
92e74d1d7d
@ -66,7 +66,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
if (list == null)
|
||||
{
|
||||
logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
return new List<ProcedureViewModel>();
|
||||
}
|
||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
|
@ -58,14 +58,14 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model)
|
||||
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model = null)
|
||||
{
|
||||
logger.LogInformation("ReadList. Comment:{Comment}. Id:{ Id}", model?.Comment, model?.Id);
|
||||
var list = model == null ? recipeStorage.GetFullList() : recipeStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
return new List<RecipeViewModel>();
|
||||
}
|
||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
|
@ -26,7 +26,7 @@ namespace PolyclinicBusinessLogic.OfficePackage
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{
|
||||
("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц", new WordTextProperties{ Size = "24"}),
|
||||
("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц\t", new WordTextProperties{ Size = "24"}),
|
||||
("Количество дней приёма: " + course.DaysCount.ToString() + " дней", new WordTextProperties{ Size = "24"}),
|
||||
},
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IProcedureLogic
|
||||
{
|
||||
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
|
||||
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model = null);
|
||||
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
|
||||
bool Create(ProcedureBindingModel model);
|
||||
bool Update(ProcedureBindingModel model);
|
||||
|
@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IRecipeLogic
|
||||
{
|
||||
List<RecipeViewModel>? ReadList(RecipeSearchModel? model);
|
||||
List<RecipeViewModel>? ReadList(RecipeSearchModel? model = null);
|
||||
RecipeViewModel? ReadElement(RecipeSearchModel model);
|
||||
bool Create(RecipeBindingModel model);
|
||||
bool Update(RecipeBindingModel model);
|
||||
|
@ -20,6 +20,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
private readonly ISymptomLogic _symptomLogic;
|
||||
private readonly ICourseLogic _courseLogic;
|
||||
private readonly ISuretorReportLogic _suretorReportLogic;
|
||||
private readonly IUserLogic _userLogic;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger,
|
||||
IProcedureLogic procedureLogic,
|
||||
@ -27,7 +28,8 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
IRecipeLogic recipeLogic,
|
||||
ISymptomLogic symptomLogic,
|
||||
ICourseLogic courseLogic,
|
||||
ISuretorReportLogic suretorReportLogic)
|
||||
ISuretorReportLogic suretorReportLogic,
|
||||
IUserLogic userLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_procedureLogic = procedureLogic;
|
||||
@ -36,6 +38,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
_symptomLogic = symptomLogic;
|
||||
_courseLogic = courseLogic;
|
||||
_suretorReportLogic = suretorReportLogic;
|
||||
_userLogic = userLogic;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -48,6 +51,36 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult Register(RegisterModel model)
|
||||
{
|
||||
var errors = new List<string>();
|
||||
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
var userEmail = _userLogic.ReadElement(new UserSearchModel { Email = model.Email });
|
||||
if (userEmail != null) errors.Add("Ýòîò Email óæå çàðåãèñòèðîâàí");
|
||||
if (model.Password != model.ConfirmPassword) errors.Add("Ïàðîëè íå ñîâïàäàþò");
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
model.Errors = errors;
|
||||
model.Email = string.Empty;
|
||||
model.ConfirmPassword = string.Empty;
|
||||
model.FIO = model.FIO;
|
||||
return View(model);
|
||||
}
|
||||
/*var user = new UserViewModel {
|
||||
Email
|
||||
};*/
|
||||
return RedirectToAction("Login");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RECIPES
|
||||
/// </summary>
|
||||
@ -73,7 +106,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
ViewData["Title"] = "Íîâûé ðåöåïò";
|
||||
model = new()
|
||||
{
|
||||
Procedures = _procedureLogic.ReadList(null).Select(x => (x, false)).ToList()
|
||||
Procedures = _procedureLogic.ReadList().Select(x => (x, false)).ToList()
|
||||
};
|
||||
return View("CreateRecipe", model);
|
||||
}
|
||||
@ -89,7 +122,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
RecipeProcedures = selectedProcedures
|
||||
.ToDictionary(
|
||||
x => x,
|
||||
x => allProcedures.First(y => y.Id == x) as IProcedureModel
|
||||
x => allProcedures.Where(y => y.Id == x) as IProcedureModel
|
||||
)
|
||||
};
|
||||
|
||||
@ -101,15 +134,17 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult EditRecipe(int id, RecipeModel model, int[] selectedProcedures)
|
||||
{
|
||||
ViewBag.Courses = _courseLogic.ReadList();
|
||||
|
||||
if (HttpContext.Request.Method == "GET")
|
||||
{
|
||||
var obj = _recipeLogic.ReadElement(new RecipeSearchModel { Id = id });
|
||||
model = new()
|
||||
{
|
||||
RecipeViewModel = obj,
|
||||
Procedures = _procedureLogic.ReadList(null).Select(x => (x, obj.RecipeProcedures.ContainsKey(x.Id))).ToList()
|
||||
Procedures = _procedureLogic.ReadList().Select(x => (x, obj.RecipeProcedures.ContainsKey(x.Id))).ToList()
|
||||
};
|
||||
ViewData["Title"] = "Ðåäàêòèðîâàòü ñèìïòîì";
|
||||
ViewData["Title"] = "Ðåäàêòèðîâàòü ðåöåïò";
|
||||
return View("CreateRecipe", model);
|
||||
}
|
||||
else
|
||||
@ -125,7 +160,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
RecipeProcedures = selectedProcedures
|
||||
.ToDictionary(
|
||||
x => x,
|
||||
x => allProcedures.First(y => y.Id == x) as IProcedureModel
|
||||
x => allProcedures.Where(y => y.Id == x) as IProcedureModel
|
||||
)
|
||||
};
|
||||
_recipeLogic.Update(recipe);
|
||||
@ -314,12 +349,12 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult CreateWordFile(int procedureId, string fileName, string fileFormat)
|
||||
{
|
||||
var procedure = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId});
|
||||
var procedure = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId });
|
||||
ViewBag.Procedures = procedure;
|
||||
|
||||
fileName = fileName + $".{fileFormat}";
|
||||
|
||||
if(procedure == null)
|
||||
if (procedure == null)
|
||||
{
|
||||
return NotFound("Ïðîöåäóðà íå íàéäåíà");
|
||||
}
|
||||
@ -329,11 +364,11 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
FileName = fileName,
|
||||
};
|
||||
|
||||
var procedureSearch = new ProcedureSearchModel { Id = procedureId};
|
||||
var procedureSearch = new ProcedureSearchModel { Id = procedureId };
|
||||
|
||||
if (fileFormat == "docx")
|
||||
{
|
||||
_suretorReportLogic.SaveCoursesByProcedureToWordFile(report,procedureSearch);
|
||||
_suretorReportLogic.SaveCoursesByProcedureToWordFile(report, procedureSearch);
|
||||
}
|
||||
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), fileName);
|
||||
@ -372,21 +407,6 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult Register()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
// êàêèå-òî äåéñòâèÿ ïðè íàæàòèè êíîïêè
|
||||
return View();
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
|
@ -14,10 +14,12 @@ builder.Logging.AddLog4Net("log4net.config");
|
||||
builder.Services.AddTransient<IProcedureLogic, ProcedureLogic>();
|
||||
builder.Services.AddTransient<IMedicamentLogic, MedicamentLogic>();
|
||||
builder.Services.AddTransient<IRecipeLogic, RecipeLogic>();
|
||||
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
||||
|
||||
builder.Services.AddTransient<IProcedureStorage, ProcedureStorage>();
|
||||
builder.Services.AddTransient<IMedicamentStorage, MedicamentStorage>();
|
||||
builder.Services.AddTransient<IRecipeStorage, RecipeStorage>();
|
||||
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToWordCoursesByProcedures, SaveToWordCoursesByProcedure>();
|
||||
builder.Services.AddTransient<ISuretorReportLogic, SuretorReportLogic>();
|
||||
|
@ -1,5 +1,6 @@
|
||||
@using PolyclinicContracts.ViewModels
|
||||
@model RecipeModel
|
||||
<h4>@ViewData["Title"]</h4>
|
||||
|
||||
<div class="text-center mt-3 mb-3">
|
||||
<h2 class="display-4">@ViewData["Title"]</h2>
|
||||
|
@ -1,6 +1,5 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Register;
|
||||
}
|
||||
@model RegisterModel
|
||||
|
||||
<div class="d-flex w-100 h-100 align-content-center justify-content-center align-items-center mt-5 pt-5">
|
||||
<form class="d-flex flex-column border border-success border-3 rounded-3 p-5" id="loginForm" method="post">
|
||||
<h4>Регистрация</h4>
|
||||
@ -8,19 +7,25 @@
|
||||
<label for="fioInput" class="pe-3 w-25">
|
||||
ФИО
|
||||
</label>
|
||||
<input class="w-100" type="text" name="fio" id="fioInput" placeholder="Иванов Иван Иванович" />
|
||||
<input class="w-100" type="text" name="fio" id="fioInput" placeholder="Иванов Иван Иванович" asp-for="FIO" />
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="emailInput" class="pe-3 w-25">
|
||||
Email
|
||||
</label>
|
||||
<input class="w-100" type="email" name="email" id="emailInput" placeholder="mail@example.com" />
|
||||
<input class="w-100" type="email" name="email" id="emailInput" placeholder="mail@example.com" asp-for="Email" />
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="passwordInput" class="pe-3 w-50">
|
||||
Пароль
|
||||
</label>
|
||||
<input class="w-100" type="password" name="password" id="passwordInput" />
|
||||
<input class="w-100" type="password" name="password" id="passwordInput" asp-for="Password" />
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="passwordConfirm" class="pe-3 w-50">
|
||||
Подверждение пароля
|
||||
</label>
|
||||
<input class="w-100" type="password" name="passwordConfirm" id="passwordConfirm" asp-for="ConfirmPassword" />
|
||||
</div>
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Зарегистрироваться
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - PolyclinicWebView - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2024 - Поликлиника "Будьте больны" - <a asp-area="" asp-controller="Home" asp-action="Privacy">Политика конфедициальности</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user