diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/IllnessLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/IllnessLogic.cs index d3472df..203843a 100644 --- a/Hospital/HospitalBusinessLogic/BusinessLogics/IllnessLogic.cs +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/IllnessLogic.cs @@ -110,4 +110,3 @@ namespace HospitalBusinessLogic.BusinessLogics } } } -} diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/RecipesLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/RecipesLogic.cs index 7ea0b15..6a442ca 100644 --- a/Hospital/HospitalBusinessLogic/BusinessLogics/RecipesLogic.cs +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/RecipesLogic.cs @@ -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); } } } diff --git a/HospitalContracts/BindingModels/RecipesBindingModel.cs b/HospitalContracts/BindingModels/RecipesBindingModel.cs index b36999a..4ee5fbd 100644 --- a/HospitalContracts/BindingModels/RecipesBindingModel.cs +++ b/HospitalContracts/BindingModels/RecipesBindingModel.cs @@ -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 MedicinesRecipe + public int MedicinesId { get; set; } + public Dictionary SymptomsRecipe { get; set; diff --git a/HospitalContracts/ViewModels/RecipesViewModel.cs b/HospitalContracts/ViewModels/RecipesViewModel.cs index 62e6323..adc81df 100644 --- a/HospitalContracts/ViewModels/RecipesViewModel.cs +++ b/HospitalContracts/ViewModels/RecipesViewModel.cs @@ -17,11 +17,15 @@ namespace HospitalContracts.ViewModels public DateTime Date { get; set; } [DisplayName("Способ приготовления")] public string ModeOfApplication { get; set; } - public Dictionary MedicinesRecipe + [DisplayName("Лекарство")] + public int MedicinesId { get; set; } + [DisplayName("Симптом")] + public Dictionary SymptomsRecipe { get; set; } = new(); + [DisplayName("Процедура")] public Dictionary ProceduresRecipe { get; diff --git a/HospitalDataModels/Models/IRecipesModel.cs b/HospitalDataModels/Models/IRecipesModel.cs index 736f681..14de723 100644 --- a/HospitalDataModels/Models/IRecipesModel.cs +++ b/HospitalDataModels/Models/IRecipesModel.cs @@ -11,7 +11,8 @@ namespace HospitalDataModels.Models string Dose { get; } DateTime Date { get; } string ModeOfApplication { get; } - Dictionary MedicinesRecipe { get; } + int MedicinesId { get; } Dictionary ProceduresRecipe { get; } + Dictionary SymptomsRecipe { get; } } } diff --git a/HospitalDataModels/Models/ISymptomsModel.cs b/HospitalDataModels/Models/ISymptomsModel.cs index b5be64a..d4a1075 100644 --- a/HospitalDataModels/Models/ISymptomsModel.cs +++ b/HospitalDataModels/Models/ISymptomsModel.cs @@ -10,6 +10,5 @@ namespace HospitalDataModels.Models { string SymptomName { get; } string Description { get; } - //Dictionary IllnessSymptoms { get; } } } diff --git a/HospitalView/FormMain.Designer.cs b/HospitalView/FormMain.Designer.cs index a40c51d..ca8e100 100644 --- a/HospitalView/FormMain.Designer.cs +++ b/HospitalView/FormMain.Designer.cs @@ -28,19 +28,68 @@ /// 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; } } \ No newline at end of file diff --git a/HospitalView/FormMain.cs b/HospitalView/FormMain.cs index 492e321..8c48991 100644 --- a/HospitalView/FormMain.cs +++ b/HospitalView/FormMain.cs @@ -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 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(); + } } } } diff --git a/HospitalView/FormMain.resx b/HospitalView/FormMain.resx index f298a7b..81a9e3d 100644 --- a/HospitalView/FormMain.resx +++ b/HospitalView/FormMain.resx @@ -57,4 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/HospitalView/HospitalView.csproj b/HospitalView/HospitalView.csproj index 39d414c..4278680 100644 --- a/HospitalView/HospitalView.csproj +++ b/HospitalView/HospitalView.csproj @@ -9,7 +9,20 @@ + + + + + + Always + + + + + + + diff --git a/HospitalView/Program.cs b/HospitalView/Program.cs index f048a90..946660a 100644 --- a/HospitalView/Program.cs +++ b/HospitalView/Program.cs @@ -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 { - /// - /// The main entry point for the application. - /// + 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()); + } + + private static void ConfigureServices(ServiceCollection services) + { + services.AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + //services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); } } } \ No newline at end of file diff --git a/HospitalView/nlog.config b/HospitalView/nlog.config new file mode 100644 index 0000000..85797a7 --- /dev/null +++ b/HospitalView/nlog.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file