From 4cfd604ab7654d4ef6aced8e2e3c093016070b48 Mon Sep 17 00:00:00 2001 From: prodigygirl Date: Fri, 19 May 2023 10:53:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=B4=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=BD=D0=B0=D0=BF=D0=B0=D1=80=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hospital/HospitalDatabaseImplement/LoaderFromXML.cs | 8 ++++---- Hospital/HospitalRestApi/Program.cs | 6 +++++- Hospital/HospitalWeb/Program.cs | 3 --- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs b/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs index 5a8ca82..7316dce 100644 --- a/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs +++ b/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs @@ -4,10 +4,10 @@ using System.Xml.Linq; namespace HospitalDatabaseImplement { public class LoaderFromXML - { - private static readonly string PatientFileName = "XMLData\\Patient.xml"; - private static readonly string TreatmentFileName = "XMLData\\Treatment.xml"; - private static readonly string ProcedureFileName = "XMLData\\Procedure.xml"; + { + private static readonly string PatientFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Patient.xml"); + private static readonly string TreatmentFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Treatment.xml"); + private static readonly string ProcedureFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Procedure.xml"); private static List? LoadData(string filename, string xmlNodeName, Func selectFunction) { diff --git a/Hospital/HospitalRestApi/Program.cs b/Hospital/HospitalRestApi/Program.cs index d01dde9..c25b7e2 100644 --- a/Hospital/HospitalRestApi/Program.cs +++ b/Hospital/HospitalRestApi/Program.cs @@ -5,6 +5,7 @@ using HospitalBusinessLogic.OfficePackage.Implements; using HospitalContracts.BindingModels; using HospitalContracts.BusinessLogicContracts; using HospitalContracts.StorageContracts; +using HospitalDatabaseImplement; using HospitalDatabaseImplement.Implements; using Microsoft.OpenApi.Models; @@ -64,7 +65,10 @@ mailSender?.MailConfig(new MailConfigBindingModel SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), }); - +// загрузка данных "напарника" +LoaderFromXML.LoadProcedures(); +LoaderFromXML.LoadTreatments(); +LoaderFromXML.LoadPatients(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { diff --git a/Hospital/HospitalWeb/Program.cs b/Hospital/HospitalWeb/Program.cs index 93e7cff..44ee4c6 100644 --- a/Hospital/HospitalWeb/Program.cs +++ b/Hospital/HospitalWeb/Program.cs @@ -27,7 +27,4 @@ app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); -LoaderFromXML.LoadProcedures(); -LoaderFromXML.LoadTreatments(); -LoaderFromXML.LoadPatients(); app.Run();