Формы
This commit is contained in:
parent
d8cc35c627
commit
8fda3c5c07
@ -0,0 +1,122 @@
|
|||||||
|
using AutomobilePlantContracts.BindingModels;
|
||||||
|
using AutomobilePlantContracts.BusinessLogicsContracts;
|
||||||
|
using AutomobilePlantContracts.SearchModel;
|
||||||
|
using AutomobilePlantContracts.StoragesContracts;
|
||||||
|
using AutomobilePlantContracts.ViewModel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AutomobilePlantBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ImplementerLogic : IImplementerLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerStorage _implementerStorage;
|
||||||
|
public ImplementerLogic(ILogger<ImplementerLogic> logger, IImplementerStorage
|
||||||
|
implementerStorage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_implementerStorage = implementerStorage;
|
||||||
|
}
|
||||||
|
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. ImplementerName:{ImplementerFIO}.Id:{ Id}", model?.ImplementerFIO, model?.Id);
|
||||||
|
var list = model == null ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public ImplementerViewModel? ReadElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. ImplementerName:{ImplementerFIO}. Id:{ Id}", model.ImplementerFIO, model.Id);
|
||||||
|
var element = _implementerStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadElement element not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
public bool Create(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||||
|
if (_implementerStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Delete operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private void CheckModel(ImplementerBindingModel model, bool withParams =
|
||||||
|
true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет имени исполнителя", nameof(model.ImplementerFIO));
|
||||||
|
}
|
||||||
|
if (model.WorkExperience <0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет стажа исполнителя", nameof(model.WorkExperience));
|
||||||
|
}
|
||||||
|
if (model.Qualification < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет квалификации исполнителя", nameof(model.Qualification));
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.Password))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет пароля клиента", nameof(model.Password));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Implementer. ImplementerName:{ImplementerName}. Id: { Id}", model.ImplementerFIO, model.Id);
|
||||||
|
var element = _implementerStorage.GetElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = model.ImplementerFIO
|
||||||
|
});
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Исполнитель с таким логином уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
170
AutomobilePlant/AutomobilePlant/FormImplementer.Designer.cs
generated
Normal file
170
AutomobilePlant/AutomobilePlant/FormImplementer.Designer.cs
generated
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
namespace AutomobilePlant
|
||||||
|
{
|
||||||
|
partial class FormImplementer
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
this.ImplementerNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.ImplementerNameTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.PasswordLabel = new System.Windows.Forms.Label();
|
||||||
|
this.PasswordTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.WorkExLabel = new System.Windows.Forms.Label();
|
||||||
|
this.WorkExtextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.QualificationLabel = new System.Windows.Forms.Label();
|
||||||
|
this.QualificationtextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ImplementerNameLabel
|
||||||
|
//
|
||||||
|
this.ImplementerNameLabel.AutoSize = true;
|
||||||
|
this.ImplementerNameLabel.Location = new System.Drawing.Point(46, 19);
|
||||||
|
this.ImplementerNameLabel.Name = "ImplementerNameLabel";
|
||||||
|
this.ImplementerNameLabel.Size = new System.Drawing.Size(45, 20);
|
||||||
|
this.ImplementerNameLabel.TabIndex = 0;
|
||||||
|
this.ImplementerNameLabel.Text = "ФИО:";
|
||||||
|
//
|
||||||
|
// ImplementerNameTextBox
|
||||||
|
//
|
||||||
|
this.ImplementerNameTextBox.Location = new System.Drawing.Point(103, 16);
|
||||||
|
this.ImplementerNameTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ImplementerNameTextBox.Name = "ImplementerNameTextBox";
|
||||||
|
this.ImplementerNameTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.ImplementerNameTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// PasswordLabel
|
||||||
|
//
|
||||||
|
this.PasswordLabel.AutoSize = true;
|
||||||
|
this.PasswordLabel.Location = new System.Drawing.Point(46, 72);
|
||||||
|
this.PasswordLabel.Name = "PasswordLabel";
|
||||||
|
this.PasswordLabel.Size = new System.Drawing.Size(73, 20);
|
||||||
|
this.PasswordLabel.TabIndex = 3;
|
||||||
|
this.PasswordLabel.Text = "Пароль: ";
|
||||||
|
//
|
||||||
|
// PasswordTextBox
|
||||||
|
//
|
||||||
|
this.PasswordTextBox.Location = new System.Drawing.Point(103, 68);
|
||||||
|
this.PasswordTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.PasswordTextBox.Name = "PasswordTextBox";
|
||||||
|
this.PasswordTextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.PasswordTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
this.SaveButton.Location = new System.Drawing.Point(151, 206);
|
||||||
|
this.SaveButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.SaveButton.Name = "SaveButton";
|
||||||
|
this.SaveButton.Size = new System.Drawing.Size(95, 31);
|
||||||
|
this.SaveButton.TabIndex = 5;
|
||||||
|
this.SaveButton.Text = "Сохранить";
|
||||||
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(265, 206);
|
||||||
|
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(86, 31);
|
||||||
|
this.ButtonCancel.TabIndex = 6;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// WorkExLabel
|
||||||
|
//
|
||||||
|
this.WorkExLabel.AutoSize = true;
|
||||||
|
this.WorkExLabel.Location = new System.Drawing.Point(29, 131);
|
||||||
|
this.WorkExLabel.Name = "WorkExLabel";
|
||||||
|
this.WorkExLabel.Size = new System.Drawing.Size(46, 20);
|
||||||
|
this.WorkExLabel.TabIndex = 7;
|
||||||
|
this.WorkExLabel.Text = "Стаж:";
|
||||||
|
//
|
||||||
|
// WorkExtextBox
|
||||||
|
//
|
||||||
|
this.WorkExtextBox.Location = new System.Drawing.Point(103, 124);
|
||||||
|
this.WorkExtextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.WorkExtextBox.Name = "WorkExtextBox";
|
||||||
|
this.WorkExtextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.WorkExtextBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// QualificationLabel
|
||||||
|
//
|
||||||
|
this.QualificationLabel.AutoSize = true;
|
||||||
|
this.QualificationLabel.Location = new System.Drawing.Point(12, 174);
|
||||||
|
this.QualificationLabel.Name = "QualificationLabel";
|
||||||
|
this.QualificationLabel.Size = new System.Drawing.Size(114, 20);
|
||||||
|
this.QualificationLabel.TabIndex = 9;
|
||||||
|
this.QualificationLabel.Text = "Квалификация:";
|
||||||
|
//
|
||||||
|
// QualificationtextBox
|
||||||
|
//
|
||||||
|
this.QualificationtextBox.Location = new System.Drawing.Point(132, 171);
|
||||||
|
this.QualificationtextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.QualificationtextBox.Name = "QualificationtextBox";
|
||||||
|
this.QualificationtextBox.Size = new System.Drawing.Size(238, 27);
|
||||||
|
this.QualificationtextBox.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// FormImplementer
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(418, 262);
|
||||||
|
this.Controls.Add(this.QualificationtextBox);
|
||||||
|
this.Controls.Add(this.QualificationLabel);
|
||||||
|
this.Controls.Add(this.WorkExtextBox);
|
||||||
|
this.Controls.Add(this.WorkExLabel);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
|
this.Controls.Add(this.PasswordTextBox);
|
||||||
|
this.Controls.Add(this.PasswordLabel);
|
||||||
|
this.Controls.Add(this.ImplementerNameTextBox);
|
||||||
|
this.Controls.Add(this.ImplementerNameLabel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormImplementer";
|
||||||
|
this.Text = "Исполнитель";
|
||||||
|
this.Load += new System.EventHandler(this.FormImplementer_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label ImplementerNameLabel;
|
||||||
|
private TextBox ImplementerNameTextBox;
|
||||||
|
private Label PasswordLabel;
|
||||||
|
private TextBox PasswordTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label WorkExLabel;
|
||||||
|
private TextBox WorkExtextBox;
|
||||||
|
private Label QualificationLabel;
|
||||||
|
private TextBox QualificationtextBox;
|
||||||
|
}
|
||||||
|
}
|
121
AutomobilePlant/AutomobilePlant/FormImplementer.cs
Normal file
121
AutomobilePlant/AutomobilePlant/FormImplementer.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using AutomobilePlantContracts.BindingModels;
|
||||||
|
using AutomobilePlantContracts.BusinessLogicsContracts;
|
||||||
|
using AutomobilePlantContracts.SearchModel;
|
||||||
|
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 AutomobilePlant
|
||||||
|
{
|
||||||
|
public partial class FormImplementer : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение исполнителя");
|
||||||
|
|
||||||
|
var view = _logic.ReadElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
ImplementerNameTextBox.Text = view.ImplementerFIO;
|
||||||
|
PasswordTextBox.Text = view.Password.ToString();
|
||||||
|
WorkExtextBox.Text = view.WorkExperience.ToString();
|
||||||
|
QualificationtextBox.Text = view.Qualification.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(ImplementerNameTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(PasswordTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(WorkExtextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните стаж", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(QualificationtextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните квалификацию", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение исполнителя");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ImplementerBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ImplementerFIO = ImplementerNameTextBox.Text,
|
||||||
|
Password = PasswordTextBox.Text,
|
||||||
|
WorkExperience=Convert.ToInt32(WorkExtextBox.Text),
|
||||||
|
Qualification=Convert.ToInt32(QualificationtextBox.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 ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
AutomobilePlant/AutomobilePlant/FormImplementer.resx
Normal file
60
AutomobilePlant/AutomobilePlant/FormImplementer.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<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>
|
121
AutomobilePlant/AutomobilePlant/FormImplementers.Designer.cs
generated
Normal file
121
AutomobilePlant/AutomobilePlant/FormImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
namespace AutomobilePlant
|
||||||
|
{
|
||||||
|
partial class FormImplementers
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.AddButton = new System.Windows.Forms.Button();
|
||||||
|
this.ChangeButton = new System.Windows.Forms.Button();
|
||||||
|
this.DeleteButton = new System.Windows.Forms.Button();
|
||||||
|
this.UpdateButton = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// DataGridView
|
||||||
|
//
|
||||||
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.DataGridView.Location = new System.Drawing.Point(2, 0);
|
||||||
|
this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DataGridView.Name = "DataGridView";
|
||||||
|
this.DataGridView.RowHeadersWidth = 51;
|
||||||
|
this.DataGridView.RowTemplate.Height = 25;
|
||||||
|
this.DataGridView.Size = new System.Drawing.Size(630, 735);
|
||||||
|
this.DataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AddButton
|
||||||
|
//
|
||||||
|
this.AddButton.Location = new System.Drawing.Point(653, 35);
|
||||||
|
this.AddButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.AddButton.Name = "AddButton";
|
||||||
|
this.AddButton.Size = new System.Drawing.Size(162, 60);
|
||||||
|
this.AddButton.TabIndex = 1;
|
||||||
|
this.AddButton.Text = "Добавить";
|
||||||
|
this.AddButton.UseVisualStyleBackColor = true;
|
||||||
|
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||||
|
//
|
||||||
|
// ChangeButton
|
||||||
|
//
|
||||||
|
this.ChangeButton.Location = new System.Drawing.Point(653, 124);
|
||||||
|
this.ChangeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ChangeButton.Name = "ChangeButton";
|
||||||
|
this.ChangeButton.Size = new System.Drawing.Size(162, 60);
|
||||||
|
this.ChangeButton.TabIndex = 2;
|
||||||
|
this.ChangeButton.Text = "Изменить";
|
||||||
|
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||||
|
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||||
|
//
|
||||||
|
// DeleteButton
|
||||||
|
//
|
||||||
|
this.DeleteButton.Location = new System.Drawing.Point(653, 216);
|
||||||
|
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.DeleteButton.Name = "DeleteButton";
|
||||||
|
this.DeleteButton.Size = new System.Drawing.Size(162, 60);
|
||||||
|
this.DeleteButton.TabIndex = 3;
|
||||||
|
this.DeleteButton.Text = "Удалить";
|
||||||
|
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||||
|
//
|
||||||
|
// UpdateButton
|
||||||
|
//
|
||||||
|
this.UpdateButton.Location = new System.Drawing.Point(653, 307);
|
||||||
|
this.UpdateButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.UpdateButton.Name = "UpdateButton";
|
||||||
|
this.UpdateButton.Size = new System.Drawing.Size(162, 60);
|
||||||
|
this.UpdateButton.TabIndex = 4;
|
||||||
|
this.UpdateButton.Text = "Обновить";
|
||||||
|
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||||
|
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||||
|
//
|
||||||
|
// FormImplementers
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(829, 736);
|
||||||
|
this.Controls.Add(this.UpdateButton);
|
||||||
|
this.Controls.Add(this.DeleteButton);
|
||||||
|
this.Controls.Add(this.ChangeButton);
|
||||||
|
this.Controls.Add(this.AddButton);
|
||||||
|
this.Controls.Add(this.DataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormImplementers";
|
||||||
|
this.Text = "Исполнители";
|
||||||
|
this.Load += new System.EventHandler(this.FormImplementers_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView DataGridView;
|
||||||
|
private Button AddButton;
|
||||||
|
private Button ChangeButton;
|
||||||
|
private Button DeleteButton;
|
||||||
|
private Button UpdateButton;
|
||||||
|
}
|
||||||
|
}
|
116
AutomobilePlant/AutomobilePlant/FormImplementers.cs
Normal file
116
AutomobilePlant/AutomobilePlant/FormImplementers.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using AutomobilePlantContracts.BindingModels;
|
||||||
|
using AutomobilePlantContracts.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 AutomobilePlant
|
||||||
|
{
|
||||||
|
public partial class FormImplementers : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic
|
||||||
|
logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void FormImplementers_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
DataGridView.DataSource = list;
|
||||||
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
|
DataGridView.Columns["ImplementerFIO"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service =
|
||||||
|
Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
|
if (service is FormImplementer form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChangeButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service =
|
||||||
|
Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
|
if (service is FormImplementer form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id =
|
||||||
|
Convert.ToInt32(DataGridView.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 UpdateButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
AutomobilePlant/AutomobilePlant/FormImplementers.resx
Normal file
60
AutomobilePlant/AutomobilePlant/FormImplementers.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<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>
|
68
AutomobilePlant/AutomobilePlant/FormMain.Designer.cs
generated
68
AutomobilePlant/AutomobilePlant/FormMain.Designer.cs
generated
@ -36,13 +36,13 @@
|
|||||||
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.componentCarsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.componentCarsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.начатьРаботуToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.CreateOrderButton = new System.Windows.Forms.Button();
|
this.CreateOrderButton = new System.Windows.Forms.Button();
|
||||||
this.TakeOrderInWorkButton = new System.Windows.Forms.Button();
|
|
||||||
this.OrderReadyButton = new System.Windows.Forms.Button();
|
|
||||||
this.IssuedOrderButton = new System.Windows.Forms.Button();
|
this.IssuedOrderButton = new System.Windows.Forms.Button();
|
||||||
this.UpdateListButton = new System.Windows.Forms.Button();
|
this.UpdateListButton = new System.Windows.Forms.Button();
|
||||||
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.MenuStrip.SuspendLayout();
|
this.MenuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -53,7 +53,9 @@
|
|||||||
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.СправочникиToolStripMenuItem,
|
this.СправочникиToolStripMenuItem,
|
||||||
this.отчетыToolStripMenuItem,
|
this.отчетыToolStripMenuItem,
|
||||||
this.клиентыToolStripMenuItem});
|
this.клиентыToolStripMenuItem,
|
||||||
|
this.исполнителиToolStripMenuItem,
|
||||||
|
this.начатьРаботуToolStripMenuItem});
|
||||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
this.MenuStrip.Name = "MenuStrip";
|
this.MenuStrip.Name = "MenuStrip";
|
||||||
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
|
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
|
||||||
@ -115,6 +117,27 @@
|
|||||||
this.ordersToolStripMenuItem.Text = "Список заказов";
|
this.ordersToolStripMenuItem.Text = "Список заказов";
|
||||||
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// клиентыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
|
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(83, 24);
|
||||||
|
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
|
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// исполнителиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||||
|
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(116, 24);
|
||||||
|
this.исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||||
|
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// начатьРаботуToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.начатьРаботуToolStripMenuItem.Name = "начатьРаботуToolStripMenuItem";
|
||||||
|
this.начатьРаботуToolStripMenuItem.Size = new System.Drawing.Size(124, 24);
|
||||||
|
this.начатьРаботуToolStripMenuItem.Text = "Начать работу";
|
||||||
|
this.начатьРаботуToolStripMenuItem.Click += new System.EventHandler(this.начатьРаботуToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// DataGridView
|
// DataGridView
|
||||||
//
|
//
|
||||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
@ -128,7 +151,7 @@
|
|||||||
//
|
//
|
||||||
// CreateOrderButton
|
// CreateOrderButton
|
||||||
//
|
//
|
||||||
this.CreateOrderButton.Location = new System.Drawing.Point(832, 37);
|
this.CreateOrderButton.Location = new System.Drawing.Point(831, 199);
|
||||||
this.CreateOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.CreateOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.CreateOrderButton.Name = "CreateOrderButton";
|
this.CreateOrderButton.Name = "CreateOrderButton";
|
||||||
this.CreateOrderButton.Size = new System.Drawing.Size(143, 44);
|
this.CreateOrderButton.Size = new System.Drawing.Size(143, 44);
|
||||||
@ -137,28 +160,6 @@
|
|||||||
this.CreateOrderButton.UseVisualStyleBackColor = true;
|
this.CreateOrderButton.UseVisualStyleBackColor = true;
|
||||||
this.CreateOrderButton.Click += new System.EventHandler(this.CreateOrderButton_Click);
|
this.CreateOrderButton.Click += new System.EventHandler(this.CreateOrderButton_Click);
|
||||||
//
|
//
|
||||||
// TakeOrderInWorkButton
|
|
||||||
//
|
|
||||||
this.TakeOrderInWorkButton.Location = new System.Drawing.Point(832, 111);
|
|
||||||
this.TakeOrderInWorkButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.TakeOrderInWorkButton.Name = "TakeOrderInWorkButton";
|
|
||||||
this.TakeOrderInWorkButton.Size = new System.Drawing.Size(143, 52);
|
|
||||||
this.TakeOrderInWorkButton.TabIndex = 3;
|
|
||||||
this.TakeOrderInWorkButton.Text = "Отдать на выполнение";
|
|
||||||
this.TakeOrderInWorkButton.UseVisualStyleBackColor = true;
|
|
||||||
this.TakeOrderInWorkButton.Click += new System.EventHandler(this.TakeOrderInWorkButton_Click);
|
|
||||||
//
|
|
||||||
// OrderReadyButton
|
|
||||||
//
|
|
||||||
this.OrderReadyButton.Location = new System.Drawing.Point(832, 195);
|
|
||||||
this.OrderReadyButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.OrderReadyButton.Name = "OrderReadyButton";
|
|
||||||
this.OrderReadyButton.Size = new System.Drawing.Size(143, 44);
|
|
||||||
this.OrderReadyButton.TabIndex = 4;
|
|
||||||
this.OrderReadyButton.Text = "Заказ готов";
|
|
||||||
this.OrderReadyButton.UseVisualStyleBackColor = true;
|
|
||||||
this.OrderReadyButton.Click += new System.EventHandler(this.OrderReadyButton_Click);
|
|
||||||
//
|
|
||||||
// IssuedOrderButton
|
// IssuedOrderButton
|
||||||
//
|
//
|
||||||
this.IssuedOrderButton.Location = new System.Drawing.Point(832, 272);
|
this.IssuedOrderButton.Location = new System.Drawing.Point(832, 272);
|
||||||
@ -181,13 +182,6 @@
|
|||||||
this.UpdateListButton.UseVisualStyleBackColor = true;
|
this.UpdateListButton.UseVisualStyleBackColor = true;
|
||||||
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
||||||
//
|
//
|
||||||
// клиентыToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
|
||||||
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(83, 24);
|
|
||||||
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
|
||||||
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
@ -195,8 +189,6 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(989, 600);
|
this.ClientSize = new System.Drawing.Size(989, 600);
|
||||||
this.Controls.Add(this.UpdateListButton);
|
this.Controls.Add(this.UpdateListButton);
|
||||||
this.Controls.Add(this.IssuedOrderButton);
|
this.Controls.Add(this.IssuedOrderButton);
|
||||||
this.Controls.Add(this.OrderReadyButton);
|
|
||||||
this.Controls.Add(this.TakeOrderInWorkButton);
|
|
||||||
this.Controls.Add(this.CreateOrderButton);
|
this.Controls.Add(this.CreateOrderButton);
|
||||||
this.Controls.Add(this.DataGridView);
|
this.Controls.Add(this.DataGridView);
|
||||||
this.Controls.Add(this.MenuStrip);
|
this.Controls.Add(this.MenuStrip);
|
||||||
@ -221,8 +213,6 @@
|
|||||||
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
||||||
private DataGridView DataGridView;
|
private DataGridView DataGridView;
|
||||||
private Button CreateOrderButton;
|
private Button CreateOrderButton;
|
||||||
private Button TakeOrderInWorkButton;
|
|
||||||
private Button OrderReadyButton;
|
|
||||||
private Button IssuedOrderButton;
|
private Button IssuedOrderButton;
|
||||||
private Button UpdateListButton;
|
private Button UpdateListButton;
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||||
@ -230,5 +220,7 @@
|
|||||||
private ToolStripMenuItem componentCarsToolStripMenuItem;
|
private ToolStripMenuItem componentCarsToolStripMenuItem;
|
||||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem начатьРаботуToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,13 +21,15 @@ namespace AutomobilePlant
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
|
private readonly IWorkProcess _workProcess;
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
|
_workProcess = workProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -48,6 +50,7 @@ namespace AutomobilePlant
|
|||||||
DataGridView.DataSource = list;
|
DataGridView.DataSource = list;
|
||||||
DataGridView.Columns["CarId"].Visible = false;
|
DataGridView.Columns["CarId"].Visible = false;
|
||||||
DataGridView.Columns["ClientId"].Visible = false;
|
DataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
DataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
@ -237,5 +240,21 @@ namespace AutomobilePlant
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
|
if (service is FormImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void начатьРаботуToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,15 @@ namespace AutomobilePlant
|
|||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<ICarStorage, CarStorage>();
|
services.AddTransient<ICarStorage, CarStorage>();
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<ICarLogic, CarLogic>();
|
services.AddTransient<ICarLogic, CarLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
|
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
@ -62,6 +65,8 @@ namespace AutomobilePlant
|
|||||||
services.AddTransient<FormReportCarComponents>();
|
services.AddTransient<FormReportCarComponents>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormClients>();
|
services.AddTransient<FormClients>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
|
services.AddTransient<FormImplementers>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user