diff --git a/BeautySalon/BeautySalon.sln b/BeautySalon/BeautySalon.sln
index 509795c..62b1889 100644
--- a/BeautySalon/BeautySalon.sln
+++ b/BeautySalon/BeautySalon.sln
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySalon", "BeautySalon\BeautySalon.csproj", "{1F929511-ADDE-4469-80EE-564D8A9C4F13}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalonDBModels", "BeautySalonDBModels\BeautySalonDBModels.csproj", "{1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySalonDatabase", "BeautySalonDBModels\BeautySalonDatabase.csproj", "{1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/BeautySalon/BeautySalon/BeautySalon.csproj b/BeautySalon/BeautySalon/BeautySalon.csproj
index 783d4c0..7831d65 100644
--- a/BeautySalon/BeautySalon/BeautySalon.csproj
+++ b/BeautySalon/BeautySalon/BeautySalon.csproj
@@ -14,4 +14,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/BeautySalon/BeautySalon/FormMain.Designer.cs b/BeautySalon/BeautySalon/FormMain.Designer.cs
index 80c077f..b71b340 100644
--- a/BeautySalon/BeautySalon/FormMain.Designer.cs
+++ b/BeautySalon/BeautySalon/FormMain.Designer.cs
@@ -53,6 +53,7 @@
добавитьСпециализациюToolStripMenuItem.Name = "добавитьСпециализациюToolStripMenuItem";
добавитьСпециализациюToolStripMenuItem.Size = new Size(206, 24);
добавитьСпециализациюToolStripMenuItem.Text = "Добавить специализацию";
+ добавитьСпециализациюToolStripMenuItem.Click += добавитьСпециализациюToolStripMenuItem_Click;
//
// добавитьToolStripMenuItem
//
diff --git a/BeautySalon/BeautySalon/FormMain.cs b/BeautySalon/BeautySalon/FormMain.cs
index a944140..d457213 100644
--- a/BeautySalon/BeautySalon/FormMain.cs
+++ b/BeautySalon/BeautySalon/FormMain.cs
@@ -1,4 +1,6 @@
-using System;
+using BeautySalonDBModels;
+using BeautySalonDBModels.Implements;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -12,6 +14,7 @@ namespace BeautySalon
{
public partial class FormMain : Form
{
+
public FormMain()
{
InitializeComponent();
@@ -21,5 +24,14 @@ namespace BeautySalon
{
}
+
+ private void добавитьСпециализациюToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSpecialisations));
+ if (service is FormSpecialisations form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs
new file mode 100644
index 0000000..97ddf69
--- /dev/null
+++ b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs
@@ -0,0 +1,63 @@
+namespace BeautySalon
+{
+ partial class FormSpecialisations
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.BackgroundColor = SystemColors.ActiveCaption;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Dock = DockStyle.Left;
+ dataGridView.Location = new Point(0, 0);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.Size = new Size(417, 450);
+ dataGridView.TabIndex = 0;
+ //
+ // FormSpecialisations
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(678, 450);
+ Controls.Add(dataGridView);
+ Name = "FormSpecialisations";
+ Text = "Специализации";
+ Load += FormSpecialisations_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/BeautySalon/FormSpecialisations.cs b/BeautySalon/BeautySalon/FormSpecialisations.cs
new file mode 100644
index 0000000..12d3ba2
--- /dev/null
+++ b/BeautySalon/BeautySalon/FormSpecialisations.cs
@@ -0,0 +1,39 @@
+using BeautySalonDBModels;
+using BeautySalonDBModels.Implements;
+using BeautySalonDBModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BeautySalon
+{
+ public partial class FormSpecialisations : Form
+ {
+ private readonly AbstractWorkWithStorage specialisationDB;
+ public FormSpecialisations(AbstractWorkWithStorage specialisationDB)
+ {
+ this.specialisationDB = specialisationDB;
+ InitializeComponent();
+ }
+
+ private void LoadData()
+ {
+ var list = specialisationDB.GetObjects();
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ }
+ }
+
+ private void FormSpecialisations_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/BeautySalon/BeautySalon/FormSpecialisations.resx b/BeautySalon/BeautySalon/FormSpecialisations.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/BeautySalon/BeautySalon/FormSpecialisations.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/BeautySalon/BeautySalon/Program.cs b/BeautySalon/BeautySalon/Program.cs
index cffe55f..67b3dce 100644
--- a/BeautySalon/BeautySalon/Program.cs
+++ b/BeautySalon/BeautySalon/Program.cs
@@ -1,3 +1,6 @@
+using BeautySalonDBModels;
+using BeautySalonDBModels.Implements;
+using BeautySalonDBModels.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
@@ -35,8 +38,10 @@ namespace BeautySalon
option.AddNLog("nlog.config");
});
////services.AddTransient();
+ services.AddSingleton, SpecialisationDB>();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/BeautySalon/BeautySalonDBModels/AbstractWorkWithStorage.cs b/BeautySalon/BeautySalonDBModels/AbstractWorkWithStorage.cs
index 21e9a2b..646a1cd 100644
--- a/BeautySalon/BeautySalonDBModels/AbstractWorkWithStorage.cs
+++ b/BeautySalon/BeautySalonDBModels/AbstractWorkWithStorage.cs
@@ -13,7 +13,7 @@ namespace BeautySalonDBModels
public NpgsqlConnection GetConnection()
{
- return new NpgsqlConnection("Host=localhost;Port=5555;Username=elina;Database=beauty_salon;Password=elina");
+ return new NpgsqlConnection("Host=127.0.0.1;Port=5555;Username=elina;Database=beauty_salon;Password=elina");
}
}
}
diff --git a/BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj b/BeautySalon/BeautySalonDBModels/BeautySalonDatabase.csproj
similarity index 80%
rename from BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj
rename to BeautySalon/BeautySalonDBModels/BeautySalonDatabase.csproj
index 5318b80..0b5195a 100644
--- a/BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj
+++ b/BeautySalon/BeautySalonDBModels/BeautySalonDatabase.csproj
@@ -8,6 +8,7 @@
+
diff --git a/BeautySalon/BeautySalonDBModels/Implements/ChequeDB.cs b/BeautySalon/BeautySalonDBModels/Implements/ChequeDatabase.cs
similarity index 97%
rename from BeautySalon/BeautySalonDBModels/Implements/ChequeDB.cs
rename to BeautySalon/BeautySalonDBModels/Implements/ChequeDatabase.cs
index 0d141a8..5a4299e 100644
--- a/BeautySalon/BeautySalonDBModels/Implements/ChequeDB.cs
+++ b/BeautySalon/BeautySalonDBModels/Implements/ChequeDatabase.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace BeautySalonDBModels.Implements
{
- public class ChequeDB : AbstractWorkWithStorage
+ public class ChequeDatabase : AbstractWorkWithStorage
{
public override void Add(Cheque cheque)
{
diff --git a/BeautySalon/BeautySalonDBModels/Implements/ClientDB.cs b/BeautySalon/BeautySalonDBModels/Implements/ClientDatabase.cs
similarity index 97%
rename from BeautySalon/BeautySalonDBModels/Implements/ClientDB.cs
rename to BeautySalon/BeautySalonDBModels/Implements/ClientDatabase.cs
index d8cd2c4..1abd9eb 100644
--- a/BeautySalon/BeautySalonDBModels/Implements/ClientDB.cs
+++ b/BeautySalon/BeautySalonDBModels/Implements/ClientDatabase.cs
@@ -3,7 +3,7 @@ using Npgsql;
namespace BeautySalonDBModels.Implements
{
- public class ClientDB : AbstractWorkWithStorage
+ public class ClientDatabase : AbstractWorkWithStorage
{
public override void Add(Client client)
{