Исправление для загрузки данных напарника

This commit is contained in:
prodigygirl 2023-05-19 10:53:52 +04:00
parent 461afbc1f3
commit 4cfd604ab7
3 changed files with 9 additions and 8 deletions

View File

@ -4,10 +4,10 @@ using System.Xml.Linq;
namespace HospitalDatabaseImplement namespace HospitalDatabaseImplement
{ {
public class LoaderFromXML public class LoaderFromXML
{ {
private static readonly string PatientFileName = "XMLData\\Patient.xml"; private static readonly string PatientFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Patient.xml");
private static readonly string TreatmentFileName = "XMLData\\Treatment.xml"; private static readonly string TreatmentFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Treatment.xml");
private static readonly string ProcedureFileName = "XMLData\\Procedure.xml"; private static readonly string ProcedureFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Procedure.xml");
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction) private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
{ {

View File

@ -5,6 +5,7 @@ using HospitalBusinessLogic.OfficePackage.Implements;
using HospitalContracts.BindingModels; using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts; using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.StorageContracts; using HospitalContracts.StorageContracts;
using HospitalDatabaseImplement;
using HospitalDatabaseImplement.Implements; using HospitalDatabaseImplement.Implements;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
@ -64,7 +65,10 @@ mailSender?.MailConfig(new MailConfigBindingModel
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
}); });
// çàãðóçêà äàííûõ "íàïàðíèêà"
LoaderFromXML.LoadProcedures();
LoaderFromXML.LoadTreatments();
LoaderFromXML.LoadPatients();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {

View File

@ -27,7 +27,4 @@ app.MapControllerRoute(
name: "default", name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}"); pattern: "{controller=Home}/{action=Index}/{id?}");
LoaderFromXML.LoadProcedures();
LoaderFromXML.LoadTreatments();
LoaderFromXML.LoadPatients();
app.Run(); app.Run();