Изменение моделей рецептов. Исправлена ошибка с с СервисПров
This commit is contained in:
parent
bcaa4adae8
commit
5dc8138d3d
@ -110,4 +110,3 @@ namespace HospitalBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Нет способа приема", nameof(model.ModeOfApplication));
|
||||
}
|
||||
_logger.LogInformation("Recipes. RecipesId:{Id}.Dose:{ Dose}. ModeOfApplication:{ ModeOfApplication}. SymptomsId: { SymptomsId}", model.Id, model.Dose, model.ModeOfApplication);
|
||||
_logger.LogInformation("Recipes.RecipesId:{Id}.Dose:{ Dose}.ModeOfApplication:{ ModeOfApplication}", model.Id, model.Dose, model.ModeOfApplication);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ namespace HospitalContracts.BindingModels
|
||||
public string Dose { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
public string ModeOfApplication { get; set; } = string.Empty;
|
||||
public Dictionary<int, (IMedicinesModel, int)> MedicinesRecipe
|
||||
public int MedicinesId { get; set; }
|
||||
public Dictionary<int, (ISymptomsModel, int)> SymptomsRecipe
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -17,11 +17,15 @@ namespace HospitalContracts.ViewModels
|
||||
public DateTime Date { get; set; }
|
||||
[DisplayName("Способ приготовления")]
|
||||
public string ModeOfApplication { get; set; }
|
||||
public Dictionary<int, (IMedicinesModel, int)> MedicinesRecipe
|
||||
[DisplayName("Лекарство")]
|
||||
public int MedicinesId { get; set; }
|
||||
[DisplayName("Симптом")]
|
||||
public Dictionary<int, (ISymptomsModel, int)> SymptomsRecipe
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
[DisplayName("Процедура")]
|
||||
public Dictionary<int, (IProceduresModel, int)> ProceduresRecipe
|
||||
{
|
||||
get;
|
||||
|
@ -11,7 +11,8 @@ namespace HospitalDataModels.Models
|
||||
string Dose { get; }
|
||||
DateTime Date { get; }
|
||||
string ModeOfApplication { get; }
|
||||
Dictionary<int, (IMedicinesModel, int)> MedicinesRecipe { get; }
|
||||
int MedicinesId { get; }
|
||||
Dictionary<int, (IProceduresModel, int)> ProceduresRecipe { get; }
|
||||
Dictionary<int, (ISymptomsModel, int)> SymptomsRecipe { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,5 @@ namespace HospitalDataModels.Models
|
||||
{
|
||||
string SymptomName { get; }
|
||||
string Description { get; }
|
||||
//Dictionary<int, IIllnessModel> IllnessSymptoms { get; }
|
||||
}
|
||||
}
|
||||
|
49
HospitalView/FormMain.Designer.cs
generated
49
HospitalView/FormMain.Designer.cs
generated
@ -28,19 +28,68 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MedicinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ProceduresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.справочникиToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(1047, 28);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.MedicinesToolStripMenuItem,
|
||||
this.ProceduresToolStripMenuItem});
|
||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// MedicinesToolStripMenuItem
|
||||
//
|
||||
this.MedicinesToolStripMenuItem.Name = "MedicinesToolStripMenuItem";
|
||||
this.MedicinesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.MedicinesToolStripMenuItem.Text = "Лекарства";
|
||||
this.MedicinesToolStripMenuItem.Click += new System.EventHandler(this.MedicinesToolStripMenuItem_Click);
|
||||
//
|
||||
// ProceduresToolStripMenuItem
|
||||
//
|
||||
this.ProceduresToolStripMenuItem.Name = "ProceduresToolStripMenuItem";
|
||||
this.ProceduresToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
this.ProceduresToolStripMenuItem.Text = "Процедуры";
|
||||
this.ProceduresToolStripMenuItem.Click += new System.EventHandler(this.ProceduresToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1047, 369);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Поликлиника \"Будьте больны\"";
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem MedicinesToolStripMenuItem;
|
||||
private ToolStripMenuItem ProceduresToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@ -12,9 +14,36 @@ namespace HospitalView
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public FormMain()
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRecipesLogic _recipesLogic;
|
||||
public FormMain(ILogger<FormMain> logger, IRecipesLogic recipesLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_recipesLogic = recipesLogic;
|
||||
}
|
||||
//private void FormMain_Load(object sender, EventArgs e)
|
||||
//{
|
||||
// LoadData();
|
||||
//}
|
||||
|
||||
private void MedicinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormMedicines));
|
||||
if (service is FormMedicines form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ProceduresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormProcedures));
|
||||
|
||||
if (service is FormProcedures form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,4 +57,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -9,7 +9,20 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="nlog.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="nlog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,17 +1,53 @@
|
||||
using HospitalBusinessLogic.BusinessLogics;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace HospitalView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
//services.AddTransient<IIllnessStorage, IllnessStorage>();
|
||||
//services.AddTransient<ISymptomsStorage, SymptomsStorage>();
|
||||
//services.AddTransient<IMedicinesStorage, MedicinesStorage>();
|
||||
//services.AddTransient<IProceduresStorage, ProceduresStorage>();
|
||||
//services.AddTransient<IRecipesStorage, RecipesStorage>();
|
||||
//services.AddTransient<IKurseStorage, KurseStorage>();
|
||||
services.AddTransient<IIllnessLogic, IllnessLogic>();
|
||||
services.AddTransient<ISymptomsLogic, SymptomsLogic>();
|
||||
services.AddTransient<IMedicinesLogic, MedicinesLogic>();
|
||||
services.AddTransient<IProceduresLogic, ProceduresLogic>();
|
||||
services.AddTransient<IRecipesLogic, RecipesLogic>();
|
||||
services.AddTransient<IKurseLogic, KurseLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormProcedure>();
|
||||
services.AddTransient<FormProcedures>();
|
||||
services.AddTransient<FormMedicine>();
|
||||
services.AddTransient<FormMedicines>();
|
||||
//services.AddTransient<FormGiftComponent>();
|
||||
//services.AddTransient<FormGifts>();
|
||||
}
|
||||
}
|
||||
}
|
15
HospitalView/nlog.config
Normal file
15
HospitalView/nlog.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
autoReload="true" internalLogLevel="Info">
|
||||
|
||||
<targets>
|
||||
<target xsi:type="File" name="tofile" fileName="log-${shortdate}.log" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
</configuration>
|
Loading…
x
Reference in New Issue
Block a user