laba 6
This commit is contained in:
parent
62aaba8e53
commit
6b6526b2c8
@ -25,7 +25,22 @@ namespace LawFirmView
|
|||||||
_logicO = logicO;
|
_logicO = logicO;
|
||||||
_clientLogic = clientLogic;
|
_clientLogic = clientLogic;
|
||||||
_list = logicD.ReadList(null);
|
_list = logicD.ReadList(null);
|
||||||
}
|
if (_list != null)
|
||||||
|
{
|
||||||
|
comboBoxDocument.DisplayMember = "PastryName";
|
||||||
|
comboBoxDocument.ValueMember = "Id";
|
||||||
|
comboBoxDocument.DataSource = _list;
|
||||||
|
comboBoxDocument.SelectedItem = null;
|
||||||
|
}
|
||||||
|
var clients = _clientLogic.ReadList(null);
|
||||||
|
if (clients != null)
|
||||||
|
{
|
||||||
|
comboBoxClient.DisplayMember = "clientFIO";
|
||||||
|
comboBoxClient.ValueMember = "Id";
|
||||||
|
comboBoxClient.DataSource = clients;
|
||||||
|
comboBoxClient.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка документов для заказа");
|
_logger.LogInformation("Загрузка документов для заказа");
|
||||||
|
173
LawFirm/LawFirm/FormImplementer.Designer.cs
generated
Normal file
173
LawFirm/LawFirm/FormImplementer.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
textBoxFio = new TextBox();
|
||||||
|
textBoxPassword = new TextBox();
|
||||||
|
numericUpDownWorkExperience = new NumericUpDown();
|
||||||
|
numericUpDownQualification = new NumericUpDown();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWorkExperience).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownQualification).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(79, 12);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(37, 15);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "ФИО:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(69, 41);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(52, 15);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Пароль:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(78, 68);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(38, 15);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "Стаж:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(25, 97);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(91, 15);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "Квалификация:";
|
||||||
|
//
|
||||||
|
// textBoxFio
|
||||||
|
//
|
||||||
|
textBoxFio.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
textBoxFio.Location = new Point(127, 9);
|
||||||
|
textBoxFio.Name = "textBoxFio";
|
||||||
|
textBoxFio.Size = new Size(271, 23);
|
||||||
|
textBoxFio.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// textBoxPassword
|
||||||
|
//
|
||||||
|
textBoxPassword.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
textBoxPassword.Location = new Point(127, 38);
|
||||||
|
textBoxPassword.Name = "textBoxPassword";
|
||||||
|
textBoxPassword.PasswordChar = '*';
|
||||||
|
textBoxPassword.Size = new Size(271, 23);
|
||||||
|
textBoxPassword.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// numericUpDownWorkExperience
|
||||||
|
//
|
||||||
|
numericUpDownWorkExperience.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
numericUpDownWorkExperience.Location = new Point(127, 66);
|
||||||
|
numericUpDownWorkExperience.Name = "numericUpDownWorkExperience";
|
||||||
|
numericUpDownWorkExperience.Size = new Size(271, 23);
|
||||||
|
numericUpDownWorkExperience.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// numericUpDownQualification
|
||||||
|
//
|
||||||
|
numericUpDownQualification.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
numericUpDownQualification.Location = new Point(127, 95);
|
||||||
|
numericUpDownQualification.Name = "numericUpDownQualification";
|
||||||
|
numericUpDownQualification.Size = new Size(271, 23);
|
||||||
|
numericUpDownQualification.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonCancel.Location = new Point(309, 138);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(89, 33);
|
||||||
|
buttonCancel.TabIndex = 8;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonSave.Location = new Point(214, 138);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(89, 33);
|
||||||
|
buttonSave.TabIndex = 9;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// FormImplementer
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(410, 183);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(numericUpDownQualification);
|
||||||
|
Controls.Add(numericUpDownWorkExperience);
|
||||||
|
Controls.Add(textBoxPassword);
|
||||||
|
Controls.Add(textBoxFio);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Name = "FormImplementer";
|
||||||
|
Text = "Добавление / Редактирование исполнителя";
|
||||||
|
Load += FormImplementer_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWorkExperience).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownQualification).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Label label4;
|
||||||
|
private TextBox textBoxFio;
|
||||||
|
private TextBox textBoxPassword;
|
||||||
|
private NumericUpDown numericUpDownWorkExperience;
|
||||||
|
private NumericUpDown numericUpDownQualification;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
}
|
||||||
|
}
|
97
LawFirm/LawFirm/FormImplementer.cs
Normal file
97
LawFirm/LawFirm/FormImplementer.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicsContracts;
|
||||||
|
using LawFirmContracts.SearchModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
textBoxFio.Text = view.ImplementerFIO;
|
||||||
|
textBoxPassword.Text = view.Password;
|
||||||
|
numericUpDownQualification.Value = view.Qualification;
|
||||||
|
numericUpDownWorkExperience.Value = view.WorkExperience;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения исполнителя");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxPassword.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните пароль", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxFio.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните фио", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение исполнителя");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ImplementerBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ImplementerFIO = textBoxFio.Text,
|
||||||
|
Password = textBoxPassword.Text,
|
||||||
|
Qualification = (int)numericUpDownQualification.Value,
|
||||||
|
WorkExperience = (int)numericUpDownWorkExperience.Value,
|
||||||
|
};
|
||||||
|
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
LawFirm/LawFirm/FormImplementer.resx
Normal file
60
LawFirm/LawFirm/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>
|
420
LawFirm/LawFirm/FormMain.Designer.cs
generated
420
LawFirm/LawFirm/FormMain.Designer.cs
generated
@ -1,222 +1,214 @@
|
|||||||
namespace LawFirmView
|
namespace LawFirmView
|
||||||
{
|
{
|
||||||
partial class FormMain
|
partial class FormMain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
menuStrip = new MenuStrip();
|
menuStrip = new MenuStrip();
|
||||||
toolStripMenuItem = new ToolStripMenuItem();
|
toolStripMenuItem = new ToolStripMenuItem();
|
||||||
BlanksToolStripMenuItem = new ToolStripMenuItem();
|
BlanksToolStripMenuItem = new ToolStripMenuItem();
|
||||||
DocumentsToolStripMenuItem = new ToolStripMenuItem();
|
DocumentsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ReportsToolStripMenuItem = new ToolStripMenuItem();
|
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ListOfDocumentsToolStripMenuItem = new ToolStripMenuItem();
|
ImplementersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
FormsForDocumentsToolStripMenuItem = new ToolStripMenuItem();
|
ReportsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
OrderListToolStripMenuItem = new ToolStripMenuItem();
|
ListOfDocumentsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
FormsForDocumentsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonCreateOrder = new Button();
|
OrderListToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonTakeOrderInWork = new Button();
|
StartWorksToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonOrderReady = new Button();
|
dataGridView = new DataGridView();
|
||||||
buttonIssuedOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonUpdate = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
buttonUpdate = new Button();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, ReportsToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, ReportsToolStripMenuItem, StartWorksToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Size = new Size(929, 28);
|
menuStrip.Size = new Size(929, 28);
|
||||||
menuStrip.TabIndex = 0;
|
menuStrip.TabIndex = 0;
|
||||||
menuStrip.Text = "Справочники";
|
menuStrip.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// toolStripMenuItem
|
// toolStripMenuItem
|
||||||
//
|
//
|
||||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { BlanksToolStripMenuItem, DocumentsToolStripMenuItem, ClientsToolStripMenuItem });
|
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { BlanksToolStripMenuItem, DocumentsToolStripMenuItem, ClientsToolStripMenuItem, ImplementersToolStripMenuItem });
|
||||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
toolStripMenuItem.Name = "toolStripMenuItem";
|
||||||
toolStripMenuItem.Size = new Size(117, 24);
|
toolStripMenuItem.Size = new Size(117, 24);
|
||||||
toolStripMenuItem.Text = "Справочники";
|
toolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// BlanksToolStripMenuItem
|
// BlanksToolStripMenuItem
|
||||||
//
|
//
|
||||||
BlanksToolStripMenuItem.Name = "BlanksToolStripMenuItem";
|
BlanksToolStripMenuItem.Name = "BlanksToolStripMenuItem";
|
||||||
BlanksToolStripMenuItem.Size = new Size(224, 26);
|
BlanksToolStripMenuItem.Size = new Size(185, 26);
|
||||||
BlanksToolStripMenuItem.Text = "Бланки";
|
BlanksToolStripMenuItem.Text = "Бланки";
|
||||||
BlanksToolStripMenuItem.Click += BlanksToolStripMenuItem_Click;
|
BlanksToolStripMenuItem.Click += BlanksToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// DocumentsToolStripMenuItem
|
// DocumentsToolStripMenuItem
|
||||||
//
|
//
|
||||||
DocumentsToolStripMenuItem.Name = "DocumentsToolStripMenuItem";
|
DocumentsToolStripMenuItem.Name = "DocumentsToolStripMenuItem";
|
||||||
DocumentsToolStripMenuItem.Size = new Size(224, 26);
|
DocumentsToolStripMenuItem.Size = new Size(185, 26);
|
||||||
DocumentsToolStripMenuItem.Text = "Документы";
|
DocumentsToolStripMenuItem.Text = "Документы";
|
||||||
DocumentsToolStripMenuItem.Click += DocumentsToolStripMenuItem_Click;
|
DocumentsToolStripMenuItem.Click += DocumentsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ReportsToolStripMenuItem
|
// ClientsToolStripMenuItem
|
||||||
//
|
//
|
||||||
ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ListOfDocumentsToolStripMenuItem, FormsForDocumentsToolStripMenuItem, OrderListToolStripMenuItem });
|
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||||
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
|
ClientsToolStripMenuItem.Size = new Size(185, 26);
|
||||||
ReportsToolStripMenuItem.Size = new Size(73, 24);
|
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||||
ReportsToolStripMenuItem.Text = "Отчеты";
|
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ListOfDocumentsToolStripMenuItem
|
// ImplementersToolStripMenuItem
|
||||||
//
|
//
|
||||||
ListOfDocumentsToolStripMenuItem.Name = "ListOfDocumentsToolStripMenuItem";
|
ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
|
||||||
ListOfDocumentsToolStripMenuItem.Size = new Size(252, 26);
|
ImplementersToolStripMenuItem.Size = new Size(185, 26);
|
||||||
ListOfDocumentsToolStripMenuItem.Text = "Список документов";
|
ImplementersToolStripMenuItem.Text = "Исполнители";
|
||||||
ListOfDocumentsToolStripMenuItem.Click += ListOfDocumentsToolStripMenuItem_Click;
|
ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// FormsForDocumentsToolStripMenuItem
|
// ReportsToolStripMenuItem
|
||||||
//
|
//
|
||||||
FormsForDocumentsToolStripMenuItem.Name = "FormsForDocumentsToolStripMenuItem";
|
ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ListOfDocumentsToolStripMenuItem, FormsForDocumentsToolStripMenuItem, OrderListToolStripMenuItem });
|
||||||
FormsForDocumentsToolStripMenuItem.Size = new Size(252, 26);
|
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
|
||||||
FormsForDocumentsToolStripMenuItem.Text = "Бланки по документам";
|
ReportsToolStripMenuItem.Size = new Size(73, 24);
|
||||||
FormsForDocumentsToolStripMenuItem.Click += FormsForDocumentsToolStripMenuItem_Click;
|
ReportsToolStripMenuItem.Text = "Отчеты";
|
||||||
//
|
//
|
||||||
// OrderListToolStripMenuItem
|
// ListOfDocumentsToolStripMenuItem
|
||||||
//
|
//
|
||||||
OrderListToolStripMenuItem.Name = "OrderListToolStripMenuItem";
|
ListOfDocumentsToolStripMenuItem.Name = "ListOfDocumentsToolStripMenuItem";
|
||||||
OrderListToolStripMenuItem.Size = new Size(252, 26);
|
ListOfDocumentsToolStripMenuItem.Size = new Size(252, 26);
|
||||||
OrderListToolStripMenuItem.Text = "Список заказов";
|
ListOfDocumentsToolStripMenuItem.Text = "Список документов";
|
||||||
OrderListToolStripMenuItem.Click += OrderListToolStripMenuItem_Click;
|
ListOfDocumentsToolStripMenuItem.Click += ListOfDocumentsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// FormsForDocumentsToolStripMenuItem
|
||||||
//
|
//
|
||||||
dataGridView.AllowUserToAddRows = false;
|
FormsForDocumentsToolStripMenuItem.Name = "FormsForDocumentsToolStripMenuItem";
|
||||||
dataGridView.AllowUserToDeleteRows = false;
|
FormsForDocumentsToolStripMenuItem.Size = new Size(252, 26);
|
||||||
dataGridView.BackgroundColor = Color.White;
|
FormsForDocumentsToolStripMenuItem.Text = "Бланки по документам";
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
FormsForDocumentsToolStripMenuItem.Click += FormsForDocumentsToolStripMenuItem_Click;
|
||||||
dataGridView.Location = new Point(12, 31);
|
//
|
||||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
// OrderListToolStripMenuItem
|
||||||
dataGridView.Name = "dataGridView";
|
//
|
||||||
dataGridView.ReadOnly = true;
|
OrderListToolStripMenuItem.Name = "OrderListToolStripMenuItem";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
OrderListToolStripMenuItem.Size = new Size(252, 26);
|
||||||
dataGridView.RowTemplate.Height = 29;
|
OrderListToolStripMenuItem.Text = "Список заказов";
|
||||||
dataGridView.Size = new Size(714, 606);
|
OrderListToolStripMenuItem.Click += OrderListToolStripMenuItem_Click;
|
||||||
dataGridView.TabIndex = 1;
|
//
|
||||||
//
|
// StartWorksToolStripMenuItem
|
||||||
// buttonCreateOrder
|
//
|
||||||
//
|
StartWorksToolStripMenuItem.Name = "StartWorksToolStripMenuItem";
|
||||||
buttonCreateOrder.Location = new Point(732, 42);
|
StartWorksToolStripMenuItem.Size = new Size(114, 24);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
StartWorksToolStripMenuItem.Text = "Запуск работ";
|
||||||
buttonCreateOrder.Size = new Size(185, 29);
|
StartWorksToolStripMenuItem.Click += StartWorksToolStripMenuItem_Click;
|
||||||
buttonCreateOrder.TabIndex = 2;
|
//
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
// dataGridView
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
//
|
||||||
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
dataGridView.AllowUserToAddRows = false;
|
||||||
//
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
// buttonTakeOrderInWork
|
dataGridView.BackgroundColor = Color.White;
|
||||||
//
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
buttonTakeOrderInWork.Location = new Point(732, 86);
|
dataGridView.Location = new Point(12, 31);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonTakeOrderInWork.Size = new Size(185, 29);
|
dataGridView.Name = "dataGridView";
|
||||||
buttonTakeOrderInWork.TabIndex = 3;
|
dataGridView.ReadOnly = true;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
dataGridView.RowHeadersWidth = 51;
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
|
dataGridView.Size = new Size(714, 606);
|
||||||
//
|
dataGridView.TabIndex = 1;
|
||||||
// buttonOrderReady
|
//
|
||||||
//
|
// buttonCreateOrder
|
||||||
buttonOrderReady.Location = new Point(732, 132);
|
//
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonCreateOrder.Location = new Point(732, 42);
|
||||||
buttonOrderReady.Size = new Size(185, 29);
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonOrderReady.TabIndex = 4;
|
buttonCreateOrder.Size = new Size(185, 29);
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
buttonCreateOrder.TabIndex = 2;
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonOrderReady.Click += buttonOrderReady_Click;
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
//
|
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
||||||
// buttonIssuedOrder
|
//
|
||||||
//
|
// buttonIssuedOrder
|
||||||
buttonIssuedOrder.Location = new Point(732, 177);
|
//
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Location = new Point(732, 103);
|
||||||
buttonIssuedOrder.Size = new Size(185, 29);
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.TabIndex = 5;
|
buttonIssuedOrder.Size = new Size(185, 29);
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
buttonIssuedOrder.TabIndex = 5;
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
buttonIssuedOrder.Click += buttonIssuedOrder_Click;
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
//
|
buttonIssuedOrder.Click += buttonIssuedOrder_Click;
|
||||||
// buttonUpdate
|
//
|
||||||
//
|
// buttonUpdate
|
||||||
buttonUpdate.Location = new Point(732, 221);
|
//
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
buttonUpdate.Location = new Point(732, 164);
|
||||||
buttonUpdate.Size = new Size(185, 29);
|
buttonUpdate.Name = "buttonUpdate";
|
||||||
buttonUpdate.TabIndex = 6;
|
buttonUpdate.Size = new Size(185, 29);
|
||||||
buttonUpdate.Text = "Обновить список";
|
buttonUpdate.TabIndex = 6;
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
buttonUpdate.Text = "Обновить список";
|
||||||
buttonUpdate.Click += buttonUpdate_Click;
|
buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
//
|
buttonUpdate.Click += buttonUpdate_Click;
|
||||||
// ClientsToolStripMenuItem
|
//
|
||||||
//
|
// FormMain
|
||||||
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
//
|
||||||
ClientsToolStripMenuItem.Size = new Size(224, 26);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
ClientsToolStripMenuItem.Text = "Клиенты";
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
ClientSize = new Size(929, 649);
|
||||||
//
|
Controls.Add(buttonUpdate);
|
||||||
// FormMain
|
Controls.Add(buttonIssuedOrder);
|
||||||
//
|
Controls.Add(buttonCreateOrder);
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
Controls.Add(dataGridView);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
Controls.Add(menuStrip);
|
||||||
ClientSize = new Size(929, 649);
|
MainMenuStrip = menuStrip;
|
||||||
Controls.Add(buttonUpdate);
|
Name = "FormMain";
|
||||||
Controls.Add(buttonIssuedOrder);
|
Text = "Юридическая фирма";
|
||||||
Controls.Add(buttonOrderReady);
|
Load += FormMain_Load;
|
||||||
Controls.Add(buttonTakeOrderInWork);
|
menuStrip.ResumeLayout(false);
|
||||||
Controls.Add(buttonCreateOrder);
|
menuStrip.PerformLayout();
|
||||||
Controls.Add(dataGridView);
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
Controls.Add(menuStrip);
|
ResumeLayout(false);
|
||||||
MainMenuStrip = menuStrip;
|
PerformLayout();
|
||||||
Name = "FormMain";
|
}
|
||||||
Text = "Юридическая фирма";
|
|
||||||
Load += FormMain_Load;
|
|
||||||
menuStrip.ResumeLayout(false);
|
|
||||||
menuStrip.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private MenuStrip menuStrip;
|
private MenuStrip menuStrip;
|
||||||
private ToolStripMenuItem toolStripMenuItem;
|
private ToolStripMenuItem toolStripMenuItem;
|
||||||
private ToolStripMenuItem BlanksToolStripMenuItem;
|
private ToolStripMenuItem BlanksToolStripMenuItem;
|
||||||
private ToolStripMenuItem DocumentsToolStripMenuItem;
|
private ToolStripMenuItem DocumentsToolStripMenuItem;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private Button buttonTakeOrderInWork;
|
private Button buttonIssuedOrder;
|
||||||
private Button buttonOrderReady;
|
private Button buttonUpdate;
|
||||||
private Button buttonIssuedOrder;
|
private ToolStripMenuItem ReportsToolStripMenuItem;
|
||||||
private Button buttonUpdate;
|
private ToolStripMenuItem ListOfDocumentsToolStripMenuItem;
|
||||||
private ToolStripMenuItem ReportsToolStripMenuItem;
|
private ToolStripMenuItem FormsForDocumentsToolStripMenuItem;
|
||||||
private ToolStripMenuItem ListOfDocumentsToolStripMenuItem;
|
private ToolStripMenuItem OrderListToolStripMenuItem;
|
||||||
private ToolStripMenuItem FormsForDocumentsToolStripMenuItem;
|
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||||
private ToolStripMenuItem OrderListToolStripMenuItem;
|
private ToolStripMenuItem StartWorksToolStripMenuItem;
|
||||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
private ToolStripMenuItem ImplementersToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,201 +8,218 @@ using LawFirmContracts.BusinessLogicContracts;
|
|||||||
|
|
||||||
namespace LawFirmView
|
namespace LawFirmView
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
private readonly IWorkProcess _workProcess;
|
||||||
{
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||||
InitializeComponent();
|
{
|
||||||
_logger = logger;
|
InitializeComponent();
|
||||||
_orderLogic = orderLogic;
|
_logger = logger;
|
||||||
_reportLogic = reportLogic;
|
_orderLogic = orderLogic;
|
||||||
}
|
_reportLogic = reportLogic;
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
_workProcess = workProcess;
|
||||||
{
|
}
|
||||||
LoadData();
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
}
|
{
|
||||||
private void LoadData()
|
LoadData();
|
||||||
{
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
private void LoadData()
|
||||||
try
|
{
|
||||||
{
|
_logger.LogInformation("Загрузка заказов");
|
||||||
var list = _orderLogic.ReadList(null);
|
try
|
||||||
if (list != null)
|
{
|
||||||
{
|
var list = _orderLogic.ReadList(null);
|
||||||
dataGridView.DataSource = list;
|
if (list != null)
|
||||||
dataGridView.Columns["DocumentId"].Visible = false;
|
{
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.DataSource = list;
|
||||||
}
|
dataGridView.Columns["DocumentId"].Visible = false;
|
||||||
_logger.LogInformation("Загрузка прошла успешно");
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
}
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
_logger.LogInformation("Загрузка прошла успешно");
|
||||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
}
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
_logger.LogError(ex, "Ошибка загрузки заказов");
|
||||||
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
{
|
}
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
}
|
||||||
if (service is FormCreateOrder form)
|
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
LoadData();
|
if (service is FormCreateOrder form)
|
||||||
}
|
{
|
||||||
}
|
form.ShowDialog();
|
||||||
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
|
LoadData();
|
||||||
{
|
}
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
}
|
||||||
{
|
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
{
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
try
|
{
|
||||||
{
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||||
{
|
try
|
||||||
Id = id,
|
{
|
||||||
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
{
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
Id = id,
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
});
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
if (!operationResult)
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
{
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
});
|
||||||
}
|
if (!operationResult)
|
||||||
LoadData();
|
{
|
||||||
}
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
LoadData();
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
}
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
catch (Exception ex)
|
||||||
MessageBoxIcon.Error);
|
{
|
||||||
}
|
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
}
|
MessageBoxIcon.Error);
|
||||||
private void buttonOrderReady_Click(object sender, EventArgs e)
|
}
|
||||||
{
|
}
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
}
|
||||||
{
|
private void buttonOrderReady_Click(object sender, EventArgs e)
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
{
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
try
|
{
|
||||||
{
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||||
{
|
try
|
||||||
Id = id,
|
{
|
||||||
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
{
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
Id = id,
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
});
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
if (!operationResult)
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
{
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
});
|
||||||
}
|
if (!operationResult)
|
||||||
LoadData();
|
{
|
||||||
}
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
LoadData();
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
}
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
private void buttonIssuedOrder_Click(object sender, EventArgs e)
|
}
|
||||||
{
|
}
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
}
|
||||||
{
|
private void buttonIssuedOrder_Click(object sender, EventArgs e)
|
||||||
int id =
|
{
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
{
|
||||||
try
|
int id =
|
||||||
{
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||||
OrderBindingModel
|
try
|
||||||
{
|
{
|
||||||
Id = id,
|
var operationResult = _orderLogic.DeliveryOrder(new
|
||||||
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
OrderBindingModel
|
||||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
{
|
||||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
Id = id,
|
||||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
});
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
if (!operationResult)
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
{
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString())
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
});
|
||||||
}
|
if (!operationResult)
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
{
|
||||||
LoadData();
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||||
{
|
LoadData();
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
}
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
catch (Exception ex)
|
||||||
MessageBoxIcon.Error);
|
{
|
||||||
}
|
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
}
|
MessageBoxIcon.Error);
|
||||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
}
|
||||||
{
|
}
|
||||||
LoadData();
|
}
|
||||||
}
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||||
private void BlanksToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
||||||
{
|
LoadData();
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormBlanks));
|
}
|
||||||
if (service is FormBlanks form)
|
private void BlanksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormBlanks));
|
||||||
}
|
if (service is FormBlanks form)
|
||||||
}
|
{
|
||||||
private void DocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
form.ShowDialog();
|
||||||
{
|
}
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
|
}
|
||||||
if (service is FormDocuments form)
|
private void DocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
|
||||||
}
|
if (service is FormDocuments form)
|
||||||
}
|
{
|
||||||
private void ListOfDocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
form.ShowDialog();
|
||||||
{
|
}
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
}
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
private void ListOfDocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_reportLogic.SaveDocumentsToWordFile(new ReportBindingModel
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
{
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
FileName = dialog.FileName
|
{
|
||||||
});
|
_reportLogic.SaveDocumentsToWordFile(new ReportBindingModel
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
{
|
||||||
}
|
FileName = dialog.FileName
|
||||||
}
|
});
|
||||||
private void FormsForDocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
{
|
}
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportDocumentBlanks));
|
}
|
||||||
if (service is FormReportDocumentBlanks form)
|
private void FormsForDocumentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportDocumentBlanks));
|
||||||
}
|
if (service is FormReportDocumentBlanks form)
|
||||||
}
|
{
|
||||||
private void OrderListToolStripMenuItem_Click(object sender, EventArgs e)
|
form.ShowDialog();
|
||||||
{
|
}
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrder));
|
}
|
||||||
if (service is FormReportOrder form)
|
private void OrderListToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrder));
|
||||||
}
|
if (service is FormReportOrder form)
|
||||||
}
|
{
|
||||||
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
form.ShowDialog();
|
||||||
{
|
}
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormViewClients));
|
}
|
||||||
if (service is FormViewClients form)
|
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
var service = Program.ServiceProvider?.GetService(typeof(FormViewClients));
|
||||||
}
|
if (service is FormViewClients form)
|
||||||
}
|
{
|
||||||
}
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void StartWorksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormViewImplementers));
|
||||||
|
if (service is FormViewImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
126
LawFirm/LawFirm/FormViewImplementers.Designer.cs
generated
Normal file
126
LawFirm/LawFirm/FormViewImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
partial class FormViewImplementers
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
buttonRef = new Button();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonRef
|
||||||
|
//
|
||||||
|
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonRef.Location = new Point(447, 279);
|
||||||
|
buttonRef.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonRef.Name = "buttonRef";
|
||||||
|
buttonRef.Size = new Size(103, 49);
|
||||||
|
buttonRef.TabIndex = 9;
|
||||||
|
buttonRef.Text = "Обновить";
|
||||||
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
buttonRef.Click += ButtonRef_Click;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonDel.Location = new Point(447, 211);
|
||||||
|
buttonDel.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(103, 44);
|
||||||
|
buttonDel.TabIndex = 8;
|
||||||
|
buttonDel.Text = "Удалить";
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonUpd.Location = new Point(447, 145);
|
||||||
|
buttonUpd.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(103, 45);
|
||||||
|
buttonUpd.TabIndex = 7;
|
||||||
|
buttonUpd.Text = "Изменить";
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonAdd.Location = new Point(447, 85);
|
||||||
|
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(103, 40);
|
||||||
|
buttonAdd.TabIndex = 6;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
dataGridView.BackgroundColor = Color.White;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(14, 16);
|
||||||
|
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 25;
|
||||||
|
dataGridView.Size = new Size(392, 403);
|
||||||
|
dataGridView.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// FormViewImplementers
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(585, 425);
|
||||||
|
Controls.Add(buttonRef);
|
||||||
|
Controls.Add(buttonDel);
|
||||||
|
Controls.Add(buttonUpd);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
|
Name = "FormViewImplementers";
|
||||||
|
Text = "Просмотр списка исполнителей";
|
||||||
|
Load += FormViewImplementers_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonRef;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
110
LawFirm/LawFirm/FormViewImplementers.cs
Normal file
110
LawFirm/LawFirm/FormViewImplementers.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.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 LawFirmView
|
||||||
|
{
|
||||||
|
public partial class FormViewImplementers : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
public FormViewImplementers(ILogger<FormViewImplementers> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
private void FormViewImplementers_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;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAdd_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 ButtonUpd_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 ButtonDel_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 ButtonRef_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
LawFirm/LawFirm/FormViewImplementers.resx
Normal file
120
LawFirm/LawFirm/FormViewImplementers.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>
|
@ -40,14 +40,17 @@ namespace LawFirmView
|
|||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IDocumentStorage, DocumentStorage>();
|
services.AddTransient<IDocumentStorage, DocumentStorage>();
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
|
||||||
services.AddTransient<IBlankLogic, BlankLogic>();
|
services.AddTransient<IBlankLogic, BlankLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IDocumentLogic, DocumentLogic>();
|
services.AddTransient<IDocumentLogic, DocumentLogic>();
|
||||||
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<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
|
|
||||||
@ -61,6 +64,8 @@ namespace LawFirmView
|
|||||||
services.AddTransient<FormReportDocumentBlanks>();
|
services.AddTransient<FormReportDocumentBlanks>();
|
||||||
services.AddTransient<FormReportOrder>();
|
services.AddTransient<FormReportOrder>();
|
||||||
services.AddTransient<FormViewClients>();
|
services.AddTransient<FormViewClients>();
|
||||||
}
|
services.AddTransient<FormViewImplementers>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
102
LawFirm/LawFirmRestApi/Controllers/ImplementerController.cs
Normal file
102
LawFirm/LawFirmRestApi/Controllers/ImplementerController.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicsContracts;
|
||||||
|
using LawFirmContracts.SearchModels;
|
||||||
|
using LawFirmContracts.ViewModels;
|
||||||
|
using LawFirmDataModels.Enums;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace LawFirmRestApi.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ImplementerController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IOrderLogic _order;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
public ImplementerController(IOrderLogic order, IImplementerLogic logic,
|
||||||
|
ILogger<ImplementerController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_order = order;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public ImplementerViewModel? Login(string login, string password)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _logic.ReadElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = login,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка авторизации сотрудника");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public List<OrderViewModel>? GetNewOrders()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadList(new OrderSearchModel
|
||||||
|
{
|
||||||
|
OrderStatus = OrderStatus.Принят
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения новых заказов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public OrderViewModel? GetImplementerOrder(int implementerId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementerId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения текущего заказа исполнителя");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void TakeOrderInWork(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.TakeOrderInWork(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка перевода заказа с №{Id} в работу",
|
||||||
|
model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void FinishOrder(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.FinishOrder(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа с№{ Id}", model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user