From 138d0b9c7689f71e0a57caed360227c1160f8c5a Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Thu, 23 May 2024 14:58:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B4=D0=B8=D0=B0=D0=B3=D0=BD=D0=BE=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/CourseLogic.cs | 2 +- .../BusinessLogics/DiagnoseLogic.cs | 2 +- .../BusinessLogics/SymptomLogic.cs | 2 +- .../BusinessLogics/UserLogic.cs | 2 +- .../Controllers/DiagnosesController.cs | 30 ++++++ .../PolyclinicWebAppImplementer.csproj | 97 ++++++++++--------- .../PolyclinicWebAppImplementer/Program.cs | 14 +++ .../SiteMenuItems.cs | 28 +++--- .../Views/Diagnoses/Index.cshtml | 48 +++++++++ .../Views/Diagnoses/Index.cshtml.cs | 12 +++ .../Views/Shared/_Layout.cshtml | 4 +- .../log4net.config | 16 +++ 12 files changed, 191 insertions(+), 66 deletions(-) create mode 100644 Polyclinic/PolyclinicWebAppImplementer/Controllers/DiagnosesController.cs create mode 100644 Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml create mode 100644 Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml.cs create mode 100644 Polyclinic/PolyclinicWebAppImplementer/log4net.config diff --git a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs index d78f272..e560476 100644 --- a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs +++ b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs @@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics private ILogger _logger; private ICourseStorage _courseStorage; - public CourseLogic(ILogger logger, ICourseStorage courseStorage) + public CourseLogic(ILogger logger, ICourseStorage courseStorage) { _logger = logger; _courseStorage = courseStorage; diff --git a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/DiagnoseLogic.cs b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/DiagnoseLogic.cs index d2d4e7b..b791a09 100644 --- a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/DiagnoseLogic.cs +++ b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/DiagnoseLogic.cs @@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics private ILogger _logger; private IDiagnoseStorage _diagnoseStorage; - public DiagnoseLogic(ILogger logger, IDiagnoseStorage diagnoseStorage) + public DiagnoseLogic(ILogger logger, IDiagnoseStorage diagnoseStorage) { _logger = logger; _diagnoseStorage = diagnoseStorage; diff --git a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/SymptomLogic.cs b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/SymptomLogic.cs index e7f264f..e97d1de 100644 --- a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/SymptomLogic.cs +++ b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/SymptomLogic.cs @@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics private ILogger _logger; private ISymptomStorage _symptomStorage; - public SymptomLogic(ILogger logger, ISymptomStorage symptomStorage) + public SymptomLogic(ILogger logger, ISymptomStorage symptomStorage) { _logger = logger; _symptomStorage = symptomStorage; diff --git a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs index 735bb03..fd621c4 100644 --- a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs +++ b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs @@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics private ILogger _logger; private IUserStorage _userStorage; - public UserLogic(ILogger logger, IUserStorage userStorage) + public UserLogic(ILogger logger, IUserStorage userStorage) { _logger = logger; _userStorage = userStorage; diff --git a/Polyclinic/PolyclinicWebAppImplementer/Controllers/DiagnosesController.cs b/Polyclinic/PolyclinicWebAppImplementer/Controllers/DiagnosesController.cs new file mode 100644 index 0000000..a332252 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppImplementer/Controllers/DiagnosesController.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Mvc; +using PolyclinicContracts.BusinessLogicsContracts; +using PolyclinicContracts.ViewModels; +using PolyclinicWebAppImplementer.Models; + +namespace PolyclinicWebAppImplementer.Controllers +{ + public class DiagnosesController : Controller + { + private readonly ILogger _logger; + private readonly IDiagnoseLogic _diagnoseLogic; + + public DiagnosesController(ILogger logger, IDiagnoseLogic diagnoseLogic) + { + _logger = logger; + _diagnoseLogic = diagnoseLogic; + } + + [HttpGet] + public IActionResult Index() + { + List diagnoses = _diagnoseLogic.ReadList(null); + if (diagnoses == null) + { + diagnoses = new(); + } + return View(diagnoses); + } + } +} diff --git a/Polyclinic/PolyclinicWebAppImplementer/PolyclinicWebAppImplementer.csproj b/Polyclinic/PolyclinicWebAppImplementer/PolyclinicWebAppImplementer.csproj index d723787..8d1bd75 100644 --- a/Polyclinic/PolyclinicWebAppImplementer/PolyclinicWebAppImplementer.csproj +++ b/Polyclinic/PolyclinicWebAppImplementer/PolyclinicWebAppImplementer.csproj @@ -1,56 +1,61 @@ - - net6.0 - enable - enable - + + net6.0 + enable + enable + - - - true - PreserveNewest - - - true - PreserveNewest - - - true - PreserveNewest - - - true - PreserveNewest - - - true - PreserveNewest - - + + + Always + + + true + PreserveNewest + + + true + PreserveNewest + + + true + PreserveNewest + + + true + PreserveNewest + + + true + PreserveNewest + + - - - + + + - - <_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Home\Diagnoses.cshtml" /> - + + <_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" /> + <_ContentIncludedByDefault Remove="Views\Home\Diagnoses.cshtml" /> + - - - + + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - + + + + diff --git a/Polyclinic/PolyclinicWebAppImplementer/Program.cs b/Polyclinic/PolyclinicWebAppImplementer/Program.cs index 0727468..b57d1ed 100644 --- a/Polyclinic/PolyclinicWebAppImplementer/Program.cs +++ b/Polyclinic/PolyclinicWebAppImplementer/Program.cs @@ -1,7 +1,21 @@ +using PolyclinicBusinessLogic.BusinessLogics; +using PolyclinicContracts.BusinessLogicsContracts; +using PolyclinicContracts.StoragesContracts; +using PolyclinicDatabaseImplement.Implements; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); +builder.Logging.SetMinimumLevel(LogLevel.Trace); +builder.Logging.AddLog4Net("log4net.config"); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); var app = builder.Build(); diff --git a/Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs b/Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs index 18c4257..1426e7c 100644 --- a/Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs +++ b/Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs @@ -2,21 +2,21 @@ { public static class SiteMenuItems { - public static (string Url, string Title) Index = ("", "Главная"); - public static (string Url, string Title) Courses = ("Courses", "Курсы"); - public static (string Url, string Title) Diagnoses = ("Diagnoses", "Болезни"); - public static (string Url, string Title) Symptomes = ("Symptomes", "Симптомы"); - public static (string Url, string Title) Symptom = ("Symptom", "Симптом"); - public static (string Url, string Title) Diagnose = ("Diagnose", "Болезнь"); - public static (string Url, string Title) Course = ("Course", "Курс"); - public static (string Url, string Title) Login = ("Login", "Вход"); - public static (string Url, string Title) Register = ("Register", "Регистрация"); - public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности"); - public static (string Url, string Title) AddRecipeToCourse = ("AddRecipeToCourse", "Привязка рецепта"); - public static (string Url, string Title) MedicamentsByDiagnoses = ("MedicamentsByDiagnoses", "Лекарства по болезням"); - public static (string Url, string Title) DiagnosesReport = ("DiagnosesReport", "Отчет по болезням"); + public static (string Controller, string Action, string Title) Index = ("Home", "", "Главная"); + public static (string Controller, string Action, string Title) Courses = ("Home", "Courses", "Курсы"); + public static (string Controller, string Action, string Title) Diagnoses = ("Diagnoses", "", "Болезни"); + public static (string Controller, string Action, string Title) Symptomes = ("Home", "Symptomes", "Симптомы"); + public static (string Controller, string Action, string Title) Symptom = ("Home", "Symptom", "Симптом"); + public static (string Controller, string Action, string Title) Diagnose = ("Home", "Diagnose", "Болезнь"); + public static (string Controller, string Action, string Title) Course = ("Home", "Course", "Курс"); + public static (string Controller, string Action, string Title) Login = ("Home", "Login", "Вход"); + public static (string Controller, string Action, string Title) Register = ("Home", "Register", "Регистрация"); + public static (string Controller, string Action, string Title) Privacy = ("Home", "Privacy", "Политика приватности"); + public static (string Controller, string Action, string Title) AddRecipeToCourse = ("Home", "AddRecipeToCourse", "Привязка рецепта"); + public static (string Controller, string Action, string Title) MedicamentsByDiagnoses = ("Home", "MedicamentsByDiagnoses", "Лекарства по болезням"); + public static (string Controller, string Action, string Title) DiagnosesReport = ("Home", "DiagnosesReport", "Отчет по болезням"); - public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)> + public static List<(string Controller, string Action, string Title)> MenuItemsOrder = new List<(string Controller, string Action, string Title)> { Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport }; diff --git a/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml b/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml new file mode 100644 index 0000000..16f5ecc --- /dev/null +++ b/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml @@ -0,0 +1,48 @@ +@using PolyclinicContracts.ViewModels +@model List +@{ + ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnoses; +} +
+ + + + + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + } + +
НомерНазваниеНачалоКонецКомментарий
@item.Id@item.Name@item.DateStartDiagnose@item.DateStopDiagnose@item.Comment + + + + + + + + + + +
+
\ No newline at end of file diff --git a/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml.cs b/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml.cs new file mode 100644 index 0000000..12bf410 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppImplementer/Views/Diagnoses/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace PolyclinicWebAppImplementer.Views.Diagnoses +{ + public class IndexModel : PageModel + { + public void OnGet() + { + } + } +} diff --git a/Polyclinic/PolyclinicWebAppImplementer/Views/Shared/_Layout.cshtml b/Polyclinic/PolyclinicWebAppImplementer/Views/Shared/_Layout.cshtml index 8a92d6d..75744fe 100644 --- a/Polyclinic/PolyclinicWebAppImplementer/Views/Shared/_Layout.cshtml +++ b/Polyclinic/PolyclinicWebAppImplementer/Views/Shared/_Layout.cshtml @@ -35,8 +35,8 @@