так.... ура
good connect хвхыхф база данных подключена, данные считались, добавила недоработанную форму специализаций
This commit is contained in:
parent
d4065f61d0
commit
4d034f1fb7
@ -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
|
||||
|
@ -14,4 +14,8 @@
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BeautySalonDBModels\BeautySalonDatabase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
1
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
1
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
@ -53,6 +53,7 @@
|
||||
добавитьСпециализациюToolStripMenuItem.Name = "добавитьСпециализациюToolStripMenuItem";
|
||||
добавитьСпециализациюToolStripMenuItem.Size = new Size(206, 24);
|
||||
добавитьСпециализациюToolStripMenuItem.Text = "Добавить специализацию";
|
||||
добавитьСпециализациюToolStripMenuItem.Click += добавитьСпециализациюToolStripMenuItem_Click;
|
||||
//
|
||||
// добавитьToolStripMenuItem
|
||||
//
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
63
BeautySalon/BeautySalon/FormSpecialisations.Designer.cs
generated
Normal file
63
BeautySalon/BeautySalon/FormSpecialisations.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
namespace BeautySalon
|
||||
{
|
||||
partial class FormSpecialisations
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
39
BeautySalon/BeautySalon/FormSpecialisations.cs
Normal file
39
BeautySalon/BeautySalon/FormSpecialisations.cs
Normal file
@ -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<Specialisation> specialisationDB;
|
||||
public FormSpecialisations(AbstractWorkWithStorage<Specialisation> 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();
|
||||
}
|
||||
}
|
||||
}
|
120
BeautySalon/BeautySalon/FormSpecialisations.resx
Normal file
120
BeautySalon/BeautySalon/FormSpecialisations.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -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<IComponentStorage, ComponentStorage>();
|
||||
services.AddSingleton<AbstractWorkWithStorage<Specialisation>, SpecialisationDB>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormHello>();
|
||||
services.AddTransient<FormSpecialisations>();
|
||||
}
|
||||
}
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Npgsql" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
public class ChequeDB : AbstractWorkWithStorage<Cheque>
|
||||
public class ChequeDatabase : AbstractWorkWithStorage<Cheque>
|
||||
{
|
||||
public override void Add(Cheque cheque)
|
||||
{
|
@ -3,7 +3,7 @@ using Npgsql;
|
||||
|
||||
namespace BeautySalonDBModels.Implements
|
||||
{
|
||||
public class ClientDB : AbstractWorkWithStorage<Client>
|
||||
public class ClientDatabase : AbstractWorkWithStorage<Client>
|
||||
{
|
||||
public override void Add(Client client)
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user