чо
This commit is contained in:
parent
381b8c6ec4
commit
dd789b780d
162
ProjectFlowerShop/ImplementerForm.Designer.cs
generated
Normal file
162
ProjectFlowerShop/ImplementerForm.Designer.cs
generated
Normal file
@ -0,0 +1,162 @@
|
||||
namespace ProjectFlowerShop
|
||||
{
|
||||
partial class ImplementerForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
FIOTextBox = new TextBox();
|
||||
PasswordTextBox = new TextBox();
|
||||
QualificationTextBox = new TextBox();
|
||||
WorkExperienceTextBox = new TextBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
SaveButton = new Button();
|
||||
CancelButton = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// FIOTextBox
|
||||
//
|
||||
FIOTextBox.Location = new Point(124, 19);
|
||||
FIOTextBox.Name = "FIOTextBox";
|
||||
FIOTextBox.Size = new Size(411, 27);
|
||||
FIOTextBox.TabIndex = 0;
|
||||
//
|
||||
// PasswordTextBox
|
||||
//
|
||||
PasswordTextBox.Location = new Point(124, 52);
|
||||
PasswordTextBox.Name = "PasswordTextBox";
|
||||
PasswordTextBox.Size = new Size(411, 27);
|
||||
PasswordTextBox.TabIndex = 1;
|
||||
//
|
||||
// QualificationTextBox
|
||||
//
|
||||
QualificationTextBox.Location = new Point(124, 85);
|
||||
QualificationTextBox.Name = "QualificationTextBox";
|
||||
QualificationTextBox.Size = new Size(411, 27);
|
||||
QualificationTextBox.TabIndex = 2;
|
||||
//
|
||||
// WorkExperienceTextBox
|
||||
//
|
||||
WorkExperienceTextBox.Location = new Point(124, 118);
|
||||
WorkExperienceTextBox.Name = "WorkExperienceTextBox";
|
||||
WorkExperienceTextBox.Size = new Size(411, 27);
|
||||
WorkExperienceTextBox.TabIndex = 3;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(9, 19);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(42, 20);
|
||||
label1.TabIndex = 4;
|
||||
label1.Text = "ФИО";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(9, 52);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(62, 20);
|
||||
label2.TabIndex = 5;
|
||||
label2.Text = "Пароль";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(9, 85);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(111, 20);
|
||||
label3.TabIndex = 6;
|
||||
label3.Text = "Квалификация";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(9, 118);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(99, 20);
|
||||
label4.TabIndex = 7;
|
||||
label4.Text = "Стаж работы";
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(341, 151);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(94, 29);
|
||||
SaveButton.TabIndex = 8;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(441, 151);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(94, 29);
|
||||
CancelButton.TabIndex = 9;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += CancelButton_Click;
|
||||
//
|
||||
// ImplementerForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(548, 186);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(WorkExperienceTextBox);
|
||||
Controls.Add(QualificationTextBox);
|
||||
Controls.Add(PasswordTextBox);
|
||||
Controls.Add(FIOTextBox);
|
||||
Name = "ImplementerForm";
|
||||
Text = "Исполнитель";
|
||||
Load += ImplementerForm_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox FIOTextBox;
|
||||
private TextBox PasswordTextBox;
|
||||
private TextBox QualificationTextBox;
|
||||
private TextBox WorkExperienceTextBox;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private Button SaveButton;
|
||||
private Button CancelButton;
|
||||
}
|
||||
}
|
109
ProjectFlowerShop/ImplementerForm.cs
Normal file
109
ProjectFlowerShop/ImplementerForm.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using FlowerShopContracts.BindingModels;
|
||||
using FlowerShopContracts.BusinessLogicsContracts;
|
||||
using FlowerShopContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 ProjectFlowerShop
|
||||
{
|
||||
public partial class ImplementerForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IImplementerLogic _logic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public ImplementerForm(ILogger<ImplementerForm> logger, IImplementerLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void ImplementerForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение исполнителя");
|
||||
var view = _logic.ReadElement(new ImplementerSearchModel
|
||||
{
|
||||
Id =
|
||||
_id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
FIOTextBox.Text = view.ImplementerFIO;
|
||||
PasswordTextBox.Text = view.Password;
|
||||
QualificationTextBox.Text = view.Qualification.ToString();
|
||||
WorkExperienceTextBox.Text = view.WorkExperience.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения исполнителя");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(FIOTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните ФИО", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(PasswordTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните пароль", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение компонента");
|
||||
try
|
||||
{
|
||||
var model = new ImplementerBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ImplementerFIO = FIOTextBox.Text,
|
||||
Password = PasswordTextBox.Text,
|
||||
Qualification = Convert.ToInt32(QualificationTextBox.Text),
|
||||
WorkExperience = Convert.ToInt32(WorkExperienceTextBox.Text),
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
||||
_logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения исполнителя");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectFlowerShop/ImplementerForm.resx
Normal file
120
ProjectFlowerShop/ImplementerForm.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>
|
114
ProjectFlowerShop/ImplementersForm.Designer.cs
generated
Normal file
114
ProjectFlowerShop/ImplementersForm.Designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
||||
namespace ProjectFlowerShop
|
||||
{
|
||||
partial class ImplementersForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridView1 = new DataGridView();
|
||||
CreateButton = new Button();
|
||||
ChangeButton = new Button();
|
||||
DeleteButton = new Button();
|
||||
RefreshButton = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Location = new Point(12, 12);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.RowHeadersWidth = 51;
|
||||
dataGridView1.RowTemplate.Height = 29;
|
||||
dataGridView1.Size = new Size(565, 426);
|
||||
dataGridView1.TabIndex = 0;
|
||||
//
|
||||
// CreateButton
|
||||
//
|
||||
CreateButton.Location = new Point(583, 12);
|
||||
CreateButton.Name = "CreateButton";
|
||||
CreateButton.Size = new Size(205, 29);
|
||||
CreateButton.TabIndex = 1;
|
||||
CreateButton.Text = "Создать";
|
||||
CreateButton.UseVisualStyleBackColor = true;
|
||||
CreateButton.Click += CreateButton_Click;
|
||||
//
|
||||
// ChangeButton
|
||||
//
|
||||
ChangeButton.Location = new Point(583, 47);
|
||||
ChangeButton.Name = "ChangeButton";
|
||||
ChangeButton.Size = new Size(205, 29);
|
||||
ChangeButton.TabIndex = 2;
|
||||
ChangeButton.Text = "Изменить";
|
||||
ChangeButton.UseVisualStyleBackColor = true;
|
||||
ChangeButton.Click += ChangeButton_Click;
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
DeleteButton.Location = new Point(583, 82);
|
||||
DeleteButton.Name = "DeleteButton";
|
||||
DeleteButton.Size = new Size(205, 29);
|
||||
DeleteButton.TabIndex = 3;
|
||||
DeleteButton.Text = "Удалить";
|
||||
DeleteButton.UseVisualStyleBackColor = true;
|
||||
DeleteButton.Click += DeleteButton_Click;
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
RefreshButton.Location = new Point(583, 117);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(205, 29);
|
||||
RefreshButton.TabIndex = 4;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
RefreshButton.Click += RefreshButton_Click;
|
||||
//
|
||||
// ImplementersForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(RefreshButton);
|
||||
Controls.Add(DeleteButton);
|
||||
Controls.Add(ChangeButton);
|
||||
Controls.Add(CreateButton);
|
||||
Controls.Add(dataGridView1);
|
||||
Name = "ImplementersForm";
|
||||
Text = "Исполнители";
|
||||
Load += ImplementersForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView1;
|
||||
private Button CreateButton;
|
||||
private Button ChangeButton;
|
||||
private Button DeleteButton;
|
||||
private Button RefreshButton;
|
||||
}
|
||||
}
|
125
ProjectFlowerShop/ImplementersForm.cs
Normal file
125
ProjectFlowerShop/ImplementersForm.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using FlowerShopContracts.BindingModels;
|
||||
using FlowerShopContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 ProjectFlowerShop
|
||||
{
|
||||
public partial class ImplementersForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IImplementerLogic _logic;
|
||||
public ImplementersForm(ILogger<ImplementersForm> logger, IImplementerLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void ImplementersForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView1.DataSource = list;
|
||||
dataGridView1.Columns["Id"].Visible = false;
|
||||
dataGridView1.Columns["ImplementerFIO"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView1.Columns["Password"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView1.Columns["Qualification"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView1.Columns["WorkExperience"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка компонентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void CreateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ImplementerForm));
|
||||
if (service is ImplementerForm form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView1.SelectedRows.Count == 1)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(ImplementerForm));
|
||||
if (service is ImplementerForm form)
|
||||
{
|
||||
form.Id =
|
||||
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView1.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление компонента");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ImplementerBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления исполнителя");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectFlowerShop/ImplementersForm.resx
Normal file
120
ProjectFlowerShop/ImplementersForm.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>
|
Loading…
Reference in New Issue
Block a user