так, добавила формы услуг
не работает пока что добавление
This commit is contained in:
parent
bbd7523df4
commit
77a0ad2708
3
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
3
BeautySalon/BeautySalon/FormMain.Designer.cs
generated
@ -74,18 +74,21 @@
|
|||||||
добавитьToolStripMenuItem1.Name = "добавитьToolStripMenuItem1";
|
добавитьToolStripMenuItem1.Name = "добавитьToolStripMenuItem1";
|
||||||
добавитьToolStripMenuItem1.Size = new Size(83, 24);
|
добавитьToolStripMenuItem1.Size = new Size(83, 24);
|
||||||
добавитьToolStripMenuItem1.Text = "Клиенты";
|
добавитьToolStripMenuItem1.Text = "Клиенты";
|
||||||
|
добавитьToolStripMenuItem1.Click += добавитьToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
// создатьПриемToolStripMenuItem
|
// создатьПриемToolStripMenuItem
|
||||||
//
|
//
|
||||||
создатьПриемToolStripMenuItem.Name = "создатьПриемToolStripMenuItem";
|
создатьПриемToolStripMenuItem.Name = "создатьПриемToolStripMenuItem";
|
||||||
создатьПриемToolStripMenuItem.Size = new Size(82, 24);
|
создатьПриемToolStripMenuItem.Size = new Size(82, 24);
|
||||||
создатьПриемToolStripMenuItem.Text = "Приемы";
|
создатьПриемToolStripMenuItem.Text = "Приемы";
|
||||||
|
создатьПриемToolStripMenuItem.Click += создатьПриемToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// посмотретьЧекиToolStripMenuItem
|
// посмотретьЧекиToolStripMenuItem
|
||||||
//
|
//
|
||||||
посмотретьЧекиToolStripMenuItem.Name = "посмотретьЧекиToolStripMenuItem";
|
посмотретьЧекиToolStripMenuItem.Name = "посмотретьЧекиToolStripMenuItem";
|
||||||
посмотретьЧекиToolStripMenuItem.Size = new Size(143, 24);
|
посмотретьЧекиToolStripMenuItem.Size = new Size(143, 24);
|
||||||
посмотретьЧекиToolStripMenuItem.Text = "Посмотреть чеки";
|
посмотретьЧекиToolStripMenuItem.Text = "Посмотреть чеки";
|
||||||
|
посмотретьЧекиToolStripMenuItem.Click += посмотретьЧекиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
|
@ -20,9 +20,19 @@ namespace BeautySalon
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// это для услуг ес че
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
|
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormServices));
|
||||||
|
if (service is FormServices form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void добавитьСпециализациюToolStripMenuItem_Click(object sender, EventArgs e)
|
private void добавитьСпециализациюToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
@ -42,5 +52,37 @@ namespace BeautySalon
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// эт клиенты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void добавитьToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||||
|
if (service is FormClients form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void создатьПриемToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReceptions));
|
||||||
|
if (service is FormReceptions form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void посмотретьЧекиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCheques));
|
||||||
|
if (service is FormCheques form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
using BeautySalonDBModels;
|
using BeautySalonDBModels;
|
||||||
using BeautySalonDBModels.Implements;
|
using BeautySalonDBModels.Implements;
|
||||||
using BeautySalonDBModels.Models;
|
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
|
namespace BeautySalon
|
||||||
{
|
{
|
||||||
|
112
BeautySalon/BeautySalon/FormService.Designer.cs
generated
112
BeautySalon/BeautySalon/FormService.Designer.cs
generated
@ -28,12 +28,116 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
buttonCancel = new Button();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
buttonSave = new Button();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
labelSpecialisation = new Label();
|
||||||
this.Text = "FormService";
|
comboBoxSpecialisation = new ComboBox();
|
||||||
|
FIO = new Label();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
numericUpDownPrice = new NumericUpDown();
|
||||||
|
label = new Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(334, 224);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(133, 44);
|
||||||
|
buttonCancel.TabIndex = 11;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(26, 224);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(133, 44);
|
||||||
|
buttonSave.TabIndex = 10;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += buttonSave_Click;
|
||||||
|
//
|
||||||
|
// labelSpecialisation
|
||||||
|
//
|
||||||
|
labelSpecialisation.AutoSize = true;
|
||||||
|
labelSpecialisation.Location = new Point(26, 83);
|
||||||
|
labelSpecialisation.Name = "labelSpecialisation";
|
||||||
|
labelSpecialisation.Size = new Size(122, 20);
|
||||||
|
labelSpecialisation.TabIndex = 9;
|
||||||
|
labelSpecialisation.Text = "Специализация:";
|
||||||
|
//
|
||||||
|
// comboBoxSpecialisation
|
||||||
|
//
|
||||||
|
comboBoxSpecialisation.FormattingEnabled = true;
|
||||||
|
comboBoxSpecialisation.Location = new Point(177, 80);
|
||||||
|
comboBoxSpecialisation.Name = "comboBoxSpecialisation";
|
||||||
|
comboBoxSpecialisation.Size = new Size(290, 28);
|
||||||
|
comboBoxSpecialisation.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FIO
|
||||||
|
//
|
||||||
|
FIO.AutoSize = true;
|
||||||
|
FIO.Location = new Point(26, 28);
|
||||||
|
FIO.Name = "FIO";
|
||||||
|
FIO.Size = new Size(57, 20);
|
||||||
|
FIO.TabIndex = 7;
|
||||||
|
FIO.Text = "Услуга:";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(177, 21);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(290, 27);
|
||||||
|
textBoxName.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// numericUpDownPrice
|
||||||
|
//
|
||||||
|
numericUpDownPrice.Location = new Point(177, 140);
|
||||||
|
numericUpDownPrice.Name = "numericUpDownPrice";
|
||||||
|
numericUpDownPrice.Size = new Size(290, 27);
|
||||||
|
numericUpDownPrice.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// label
|
||||||
|
//
|
||||||
|
label.AutoSize = true;
|
||||||
|
label.Location = new Point(26, 147);
|
||||||
|
label.Name = "label";
|
||||||
|
label.Size = new Size(45, 20);
|
||||||
|
label.TabIndex = 13;
|
||||||
|
label.Text = "Цена";
|
||||||
|
//
|
||||||
|
// FormService
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(537, 304);
|
||||||
|
Controls.Add(label);
|
||||||
|
Controls.Add(numericUpDownPrice);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(labelSpecialisation);
|
||||||
|
Controls.Add(comboBoxSpecialisation);
|
||||||
|
Controls.Add(FIO);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Name = "FormService";
|
||||||
|
Text = "FormService";
|
||||||
|
Load += FormService_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Label labelSpecialisation;
|
||||||
|
private ComboBox comboBoxSpecialisation;
|
||||||
|
private Label FIO;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private NumericUpDown numericUpDownPrice;
|
||||||
|
private Label label;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,20 +1,91 @@
|
|||||||
using System;
|
using BeautySalonDBModels;
|
||||||
using System.Collections.Generic;
|
using BeautySalonDBModels.Models;
|
||||||
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
|
namespace BeautySalon
|
||||||
{
|
{
|
||||||
public partial class FormService : Form
|
public partial class FormService : Form
|
||||||
{
|
{
|
||||||
public FormService()
|
private int? _id;
|
||||||
|
public int Id
|
||||||
{
|
{
|
||||||
|
set { _id = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly AbstractWorkWithStorage<Specialisation> specialisationStorage;
|
||||||
|
private readonly AbstractWorkWithStorage<Service> serviceStorage;
|
||||||
|
private readonly List<Specialisation> specialisations;
|
||||||
|
|
||||||
|
public FormService(AbstractWorkWithStorage<Service> serviceStorage, AbstractWorkWithStorage<Specialisation> specialisationStorage)
|
||||||
|
{
|
||||||
|
this.serviceStorage = serviceStorage;
|
||||||
|
this.specialisationStorage = specialisationStorage;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
specialisations = specialisationStorage.GetObjects();
|
||||||
|
foreach (Specialisation specialisation in specialisations)
|
||||||
|
{
|
||||||
|
comboBoxSpecialisation.Items.Add(specialisation).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_id != null)
|
||||||
|
{
|
||||||
|
var newService = new Service
|
||||||
|
{
|
||||||
|
ServiceId = _id ?? 0,
|
||||||
|
SpecialisationId = (comboBoxSpecialisation.SelectedItem as Service)!.ServiceId,
|
||||||
|
Price = (int)numericUpDownPrice.Value
|
||||||
|
};
|
||||||
|
serviceStorage.Update(newService);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newService = new Service
|
||||||
|
{
|
||||||
|
SpecialisationId = (comboBoxSpecialisation.SelectedItem as Service)!.ServiceId,
|
||||||
|
Price = (int)numericUpDownPrice.Value
|
||||||
|
};
|
||||||
|
serviceStorage.Add(newService);
|
||||||
|
}
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel; Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormService_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(_id != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var serviceObject = serviceStorage.GetObject(_id.Value);
|
||||||
|
if (serviceObject != null)
|
||||||
|
{
|
||||||
|
comboBoxSpecialisation.SelectedItem = serviceObject;
|
||||||
|
textBoxName.Text = serviceObject.ServiceName;
|
||||||
|
numericUpDownPrice.Value = (decimal)serviceObject.Price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
73
BeautySalon/BeautySalon/FormServices.Designer.cs
generated
73
BeautySalon/BeautySalon/FormServices.Designer.cs
generated
@ -28,12 +28,77 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
dataGridView = new DataGridView();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
buttonDelete = new Button();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
buttonUpdate = new Button();
|
||||||
this.Text = "FormServices";
|
buttonCreate = new Button();
|
||||||
|
((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.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(493, 450);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.Location = new Point(553, 365);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(147, 56);
|
||||||
|
buttonDelete.TabIndex = 9;
|
||||||
|
buttonDelete.Text = "Уничтожить...";
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += buttonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
buttonUpdate.Location = new Point(553, 195);
|
||||||
|
buttonUpdate.Name = "buttonUpdate";
|
||||||
|
buttonUpdate.Size = new Size(147, 56);
|
||||||
|
buttonUpdate.TabIndex = 8;
|
||||||
|
buttonUpdate.Text = "Корректровать";
|
||||||
|
buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpdate.Click += buttonUpdate_Click;
|
||||||
|
//
|
||||||
|
// buttonCreate
|
||||||
|
//
|
||||||
|
buttonCreate.Location = new Point(553, 34);
|
||||||
|
buttonCreate.Name = "buttonCreate";
|
||||||
|
buttonCreate.Size = new Size(147, 56);
|
||||||
|
buttonCreate.TabIndex = 7;
|
||||||
|
buttonCreate.Text = "Добавить";
|
||||||
|
buttonCreate.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreate.Click += buttonCreate_Click;
|
||||||
|
//
|
||||||
|
// FormServices
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(752, 450);
|
||||||
|
Controls.Add(buttonDelete);
|
||||||
|
Controls.Add(buttonUpdate);
|
||||||
|
Controls.Add(buttonCreate);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormServices";
|
||||||
|
Text = "Услуги";
|
||||||
|
Load += FormServices_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonUpdate;
|
||||||
|
private Button buttonCreate;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using BeautySalonDBModels.Models;
|
||||||
|
using BeautySalonDBModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -7,14 +9,88 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using BeautySalonDBModels.Implements;
|
||||||
|
|
||||||
namespace BeautySalon
|
namespace BeautySalon
|
||||||
{
|
{
|
||||||
public partial class FormServices : Form
|
public partial class FormServices : Form
|
||||||
{
|
{
|
||||||
public FormServices()
|
private int? _id;
|
||||||
|
public int Id
|
||||||
{
|
{
|
||||||
|
set { _id = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly AbstractWorkWithStorage<Service> serviceStorage;
|
||||||
|
private readonly AbstractWorkWithStorage<Specialisation> specialisationStorage;
|
||||||
|
public FormServices(AbstractWorkWithStorage<Service> serviceStorage,
|
||||||
|
AbstractWorkWithStorage<Specialisation> specialisationStorage)
|
||||||
|
{
|
||||||
|
this.serviceStorage = serviceStorage;
|
||||||
|
this.specialisationStorage = specialisationStorage;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
List<Service> services = serviceStorage.GetObjects();
|
||||||
|
ServiceDatabase mdb = new ServiceDatabase();
|
||||||
|
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
|
||||||
|
if (dataGridView.ColumnCount == 0)
|
||||||
|
{
|
||||||
|
dataGridView.Columns.Add("ServiceName", "Название");
|
||||||
|
dataGridView.Columns.Add("Specialisation", "Специализация");
|
||||||
|
dataGridView.Columns.Add("Price", "Цена");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Service service in services)
|
||||||
|
{
|
||||||
|
string specialisationName = mdb.GetNameSpecialisation(service);
|
||||||
|
dataGridView.Rows.Add(service.ServiceName, specialisationName, service.Price);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormService));
|
||||||
|
if (service is FormService form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormService));
|
||||||
|
if (service is FormService form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
int rowIndex = dataGridView.CurrentCell.RowIndex;
|
||||||
|
form.Id = (int)dataGridView.Rows[rowIndex].Cells["ServiceId"].Value;
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int rowIndex = dataGridView.CurrentCell.RowIndex;
|
||||||
|
serviceStorage.Remove(rowIndex);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormServices_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
@ -49,10 +49,24 @@ namespace BeautySalon
|
|||||||
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormHello>();
|
services.AddTransient<FormHello>();
|
||||||
|
|
||||||
services.AddTransient<FormSpecialisations>();
|
services.AddTransient<FormSpecialisations>();
|
||||||
services.AddTransient<FormSpecialisation>();
|
services.AddTransient<FormSpecialisation>();
|
||||||
|
|
||||||
services.AddTransient<FormMasters>();
|
services.AddTransient<FormMasters>();
|
||||||
services.AddTransient<FormMaster>();
|
services.AddTransient<FormMaster>();
|
||||||
|
|
||||||
|
services.AddTransient<FormCheques>();
|
||||||
|
services.AddTransient<FormCheque>();
|
||||||
|
|
||||||
|
services.AddTransient<FormReceptions>();
|
||||||
|
services.AddTransient<FormReception>();
|
||||||
|
|
||||||
|
services.AddTransient<FormClients>();
|
||||||
|
services.AddTransient<FormClient>();
|
||||||
|
|
||||||
|
services.AddTransient<FormServices>();
|
||||||
|
services.AddTransient<FormService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -85,5 +85,18 @@ namespace BeautySalonDBModels.Implements
|
|||||||
cmd.Parameters.AddWithValue("@id", service.ServiceId);
|
cmd.Parameters.AddWithValue("@id", service.ServiceId);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetNameSpecialisation(Service service)
|
||||||
|
{
|
||||||
|
SpecialisationDatabase db = new SpecialisationDatabase();
|
||||||
|
int specId = service.SpecialisationId;
|
||||||
|
List<Specialisation> specialisations = db.GetObjects();
|
||||||
|
|
||||||
|
foreach (Specialisation specialisation in specialisations)
|
||||||
|
{
|
||||||
|
if (specialisation.SpecialisationId == specId) return specialisation.Name.ToString();
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user