Compare commits
5 Commits
22db07b650
...
a882155736
Author | SHA1 | Date | |
---|---|---|---|
a882155736 | |||
828af603ab | |||
913ea75594 | |||
884a41f3d2 | |||
fce52d33d0 |
3
LawFirm/LawFirm/FormBlank.Designer.cs
generated
3
LawFirm/LawFirm/FormBlank.Designer.cs
generated
@ -76,6 +76,7 @@
|
|||||||
this.buttonSave.TabIndex = 4;
|
this.buttonSave.TabIndex = 4;
|
||||||
this.buttonSave.Text = "Сохранить";
|
this.buttonSave.Text = "Сохранить";
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
@ -85,6 +86,7 @@
|
|||||||
this.buttonCancel.TabIndex = 5;
|
this.buttonCancel.TabIndex = 5;
|
||||||
this.buttonCancel.Text = "Отмена";
|
this.buttonCancel.Text = "Отмена";
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||||
//
|
//
|
||||||
// FormBlank
|
// FormBlank
|
||||||
//
|
//
|
||||||
@ -99,6 +101,7 @@
|
|||||||
this.Controls.Add(this.labelBlankName);
|
this.Controls.Add(this.labelBlankName);
|
||||||
this.Name = "FormBlank";
|
this.Name = "FormBlank";
|
||||||
this.Text = "Бланк";
|
this.Text = "Бланк";
|
||||||
|
this.Load += new System.EventHandler(this.FormBlank_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
@ -26,9 +26,11 @@ namespace LawFirmView
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormComponent_Load(object sender, EventArgs e)
|
private void FormBlank_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_id.HasValue)
|
if (_id.HasValue)
|
||||||
{
|
{
|
||||||
@ -54,12 +56,11 @@ namespace LawFirmView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Заполните название", "Ошибка",
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Сохранение бланка");
|
_logger.LogInformation("Сохранение бланка");
|
||||||
@ -87,7 +88,7 @@ namespace LawFirmView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
private void buttonCancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
Close();
|
Close();
|
||||||
|
1
LawFirm/LawFirm/FormBlanks.Designer.cs
generated
1
LawFirm/LawFirm/FormBlanks.Designer.cs
generated
@ -98,6 +98,7 @@
|
|||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Name = "FormBlanks";
|
this.Name = "FormBlanks";
|
||||||
this.Text = "Бланки";
|
this.Text = "Бланки";
|
||||||
|
this.Load += new System.EventHandler(this.FormBlanks_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace LawFirmView
|
|||||||
_logic = logic;
|
_logic = logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormComponents_Load(object sender, EventArgs e)
|
private void FormBlanks_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
144
LawFirm/LawFirm/FormCreateOrder.Designer.cs
generated
Normal file
144
LawFirm/LawFirm/FormCreateOrder.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
partial class FormCreateOrder
|
||||||
|
{
|
||||||
|
/// <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.labelName = new System.Windows.Forms.Label();
|
||||||
|
this.labelCount = new System.Windows.Forms.Label();
|
||||||
|
this.labelSum = new System.Windows.Forms.Label();
|
||||||
|
this.comboBoxDocument = new System.Windows.Forms.ComboBox();
|
||||||
|
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||||
|
this.textBoxSum = new System.Windows.Forms.TextBox();
|
||||||
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
this.labelName.AutoSize = true;
|
||||||
|
this.labelName.Location = new System.Drawing.Point(30, 20);
|
||||||
|
this.labelName.Name = "labelName";
|
||||||
|
this.labelName.Size = new System.Drawing.Size(79, 20);
|
||||||
|
this.labelName.TabIndex = 0;
|
||||||
|
this.labelName.Text = "Документ:";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
this.labelCount.AutoSize = true;
|
||||||
|
this.labelCount.Location = new System.Drawing.Point(30, 70);
|
||||||
|
this.labelCount.Name = "labelCount";
|
||||||
|
this.labelCount.Size = new System.Drawing.Size(93, 20);
|
||||||
|
this.labelCount.TabIndex = 1;
|
||||||
|
this.labelCount.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// labelSum
|
||||||
|
//
|
||||||
|
this.labelSum.AutoSize = true;
|
||||||
|
this.labelSum.Location = new System.Drawing.Point(30, 119);
|
||||||
|
this.labelSum.Name = "labelSum";
|
||||||
|
this.labelSum.Size = new System.Drawing.Size(58, 20);
|
||||||
|
this.labelSum.TabIndex = 2;
|
||||||
|
this.labelSum.Text = "Сумма:";
|
||||||
|
//
|
||||||
|
// comboBoxDocument
|
||||||
|
//
|
||||||
|
this.comboBoxDocument.FormattingEnabled = true;
|
||||||
|
this.comboBoxDocument.Location = new System.Drawing.Point(171, 20);
|
||||||
|
this.comboBoxDocument.Name = "comboBoxDocument";
|
||||||
|
this.comboBoxDocument.Size = new System.Drawing.Size(262, 28);
|
||||||
|
this.comboBoxDocument.TabIndex = 3;
|
||||||
|
this.comboBoxDocument.SelectedIndexChanged += new System.EventHandler(this.comboBoxDocument_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
this.textBoxCount.Location = new System.Drawing.Point(171, 67);
|
||||||
|
this.textBoxCount.Name = "textBoxCount";
|
||||||
|
this.textBoxCount.Size = new System.Drawing.Size(262, 27);
|
||||||
|
this.textBoxCount.TabIndex = 4;
|
||||||
|
this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged);
|
||||||
|
//
|
||||||
|
// textBoxSum
|
||||||
|
//
|
||||||
|
this.textBoxSum.Location = new System.Drawing.Point(171, 112);
|
||||||
|
this.textBoxSum.Name = "textBoxSum";
|
||||||
|
this.textBoxSum.Size = new System.Drawing.Size(262, 27);
|
||||||
|
this.textBoxSum.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
this.buttonSave.Location = new System.Drawing.Point(239, 164);
|
||||||
|
this.buttonSave.Name = "buttonSave";
|
||||||
|
this.buttonSave.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.buttonSave.TabIndex = 6;
|
||||||
|
this.buttonSave.Text = "Сохранить";
|
||||||
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(339, 164);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
||||||
|
this.buttonCancel.TabIndex = 7;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||||
|
//
|
||||||
|
// FormCreateOrder
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(450, 212);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
|
this.Controls.Add(this.buttonSave);
|
||||||
|
this.Controls.Add(this.textBoxSum);
|
||||||
|
this.Controls.Add(this.textBoxCount);
|
||||||
|
this.Controls.Add(this.comboBoxDocument);
|
||||||
|
this.Controls.Add(this.labelSum);
|
||||||
|
this.Controls.Add(this.labelCount);
|
||||||
|
this.Controls.Add(this.labelName);
|
||||||
|
this.Name = "FormCreateOrder";
|
||||||
|
this.Text = "Создание заказа";
|
||||||
|
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelCount;
|
||||||
|
private Label labelSum;
|
||||||
|
private ComboBox comboBoxDocument;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private TextBox textBoxSum;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
131
LawFirm/LawFirm/FormCreateOrder.cs
Normal file
131
LawFirm/LawFirm/FormCreateOrder.cs
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicContracts;
|
||||||
|
using LawFirmContracts.SearchModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
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 FormCreateOrder : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IDocumentLogic _logicD;
|
||||||
|
private readonly IOrderLogic _logicO;
|
||||||
|
|
||||||
|
public FormCreateOrder(ILogger<FormCreateOrder> logger, IDocumentLogic logicD, IOrderLogic logicO)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicD = logicD;
|
||||||
|
_logicO = logicO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка документов для заказа");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicD.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxDocument.DisplayMember = "DocumentName";
|
||||||
|
comboBoxDocument.ValueMember = "Id";
|
||||||
|
comboBoxDocument.DataSource = list;
|
||||||
|
comboBoxDocument.SelectedItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка документов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalcSum()
|
||||||
|
{
|
||||||
|
if (comboBoxDocument.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(comboBoxDocument.SelectedValue);
|
||||||
|
var product = _logicD.ReadElement(new DocumentSearchModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
int count = Convert.ToInt32(textBoxCount.Text);
|
||||||
|
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString();
|
||||||
|
_logger.LogInformation("Расчет суммы заказа");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBoxCount_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CalcSum();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBoxDocument_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CalcSum();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните поле Количество", "Ошибка",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxDocument.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите изделие", "Ошибка",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Создание заказа");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue),
|
||||||
|
DocumentName = comboBoxDocument.Text,
|
||||||
|
Count = Convert.ToInt32(textBoxCount.Text),
|
||||||
|
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||||
|
});
|
||||||
|
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/FormCreateOrder.resx
Normal file
60
LawFirm/LawFirm/FormCreateOrder.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>
|
235
LawFirm/LawFirm/FormDocument.Designer.cs
generated
Normal file
235
LawFirm/LawFirm/FormDocument.Designer.cs
generated
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
partial class FormDocument
|
||||||
|
{
|
||||||
|
/// <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.labelName = new System.Windows.Forms.Label();
|
||||||
|
this.labelPrice = new System.Windows.Forms.Label();
|
||||||
|
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||||
|
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
||||||
|
this.groupBoxBlanks = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||||
|
this.buttonDelete = new System.Windows.Forms.Button();
|
||||||
|
this.buttonEdit = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.ColumnBlankName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.groupBoxBlanks.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
this.labelName.AutoSize = true;
|
||||||
|
this.labelName.Location = new System.Drawing.Point(12, 9);
|
||||||
|
this.labelName.Name = "labelName";
|
||||||
|
this.labelName.Size = new System.Drawing.Size(80, 20);
|
||||||
|
this.labelName.TabIndex = 0;
|
||||||
|
this.labelName.Text = "Название:";
|
||||||
|
//
|
||||||
|
// labelPrice
|
||||||
|
//
|
||||||
|
this.labelPrice.AutoSize = true;
|
||||||
|
this.labelPrice.Location = new System.Drawing.Point(12, 45);
|
||||||
|
this.labelPrice.Name = "labelPrice";
|
||||||
|
this.labelPrice.Size = new System.Drawing.Size(86, 20);
|
||||||
|
this.labelPrice.TabIndex = 1;
|
||||||
|
this.labelPrice.Text = "Стоимость:";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
this.textBoxName.Location = new System.Drawing.Point(98, 6);
|
||||||
|
this.textBoxName.Name = "textBoxName";
|
||||||
|
this.textBoxName.Size = new System.Drawing.Size(315, 27);
|
||||||
|
this.textBoxName.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxPrice
|
||||||
|
//
|
||||||
|
this.textBoxPrice.Location = new System.Drawing.Point(98, 39);
|
||||||
|
this.textBoxPrice.Name = "textBoxPrice";
|
||||||
|
this.textBoxPrice.Size = new System.Drawing.Size(157, 27);
|
||||||
|
this.textBoxPrice.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// groupBoxBlanks
|
||||||
|
//
|
||||||
|
this.groupBoxBlanks.Controls.Add(this.buttonUpdate);
|
||||||
|
this.groupBoxBlanks.Controls.Add(this.buttonDelete);
|
||||||
|
this.groupBoxBlanks.Controls.Add(this.buttonEdit);
|
||||||
|
this.groupBoxBlanks.Controls.Add(this.buttonAdd);
|
||||||
|
this.groupBoxBlanks.Controls.Add(this.dataGridView);
|
||||||
|
this.groupBoxBlanks.Location = new System.Drawing.Point(15, 83);
|
||||||
|
this.groupBoxBlanks.Name = "groupBoxBlanks";
|
||||||
|
this.groupBoxBlanks.Size = new System.Drawing.Size(699, 275);
|
||||||
|
this.groupBoxBlanks.TabIndex = 4;
|
||||||
|
this.groupBoxBlanks.TabStop = false;
|
||||||
|
this.groupBoxBlanks.Text = "Бланки";
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
this.buttonUpdate.Location = new System.Drawing.Point(521, 240);
|
||||||
|
this.buttonUpdate.Name = "buttonUpdate";
|
||||||
|
this.buttonUpdate.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonUpdate.TabIndex = 4;
|
||||||
|
this.buttonUpdate.Text = "Обновить";
|
||||||
|
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
this.buttonDelete.Location = new System.Drawing.Point(521, 96);
|
||||||
|
this.buttonDelete.Name = "buttonDelete";
|
||||||
|
this.buttonDelete.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonDelete.TabIndex = 3;
|
||||||
|
this.buttonDelete.Text = "Удалить";
|
||||||
|
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
this.buttonEdit.Location = new System.Drawing.Point(521, 61);
|
||||||
|
this.buttonEdit.Name = "buttonEdit";
|
||||||
|
this.buttonEdit.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonEdit.TabIndex = 2;
|
||||||
|
this.buttonEdit.Text = "Изменить";
|
||||||
|
this.buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(521, 26);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonAdd.TabIndex = 1;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
|
this.ID,
|
||||||
|
this.ColumnBlankName,
|
||||||
|
this.ColumnCount});
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(6, 26);
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(490, 243);
|
||||||
|
this.dataGridView.TabIndex = 0;
|
||||||
|
this.dataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellContentClick);
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
this.buttonSave.Location = new System.Drawing.Point(356, 379);
|
||||||
|
this.buttonSave.Name = "buttonSave";
|
||||||
|
this.buttonSave.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonSave.TabIndex = 5;
|
||||||
|
this.buttonSave.Text = "Сохранить";
|
||||||
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(536, 379);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(155, 29);
|
||||||
|
this.buttonCancel.TabIndex = 6;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||||
|
//
|
||||||
|
// ID
|
||||||
|
//
|
||||||
|
this.ID.HeaderText = "ID";
|
||||||
|
this.ID.MinimumWidth = 6;
|
||||||
|
this.ID.Name = "ID";
|
||||||
|
this.ID.Visible = false;
|
||||||
|
this.ID.Width = 125;
|
||||||
|
//
|
||||||
|
// ColumnBlankName
|
||||||
|
//
|
||||||
|
this.ColumnBlankName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||||
|
this.ColumnBlankName.HeaderText = "Бланк";
|
||||||
|
this.ColumnBlankName.MinimumWidth = 6;
|
||||||
|
this.ColumnBlankName.Name = "ColumnBlankName";
|
||||||
|
this.ColumnBlankName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||||
|
this.ColumnBlankName.Width = 312;
|
||||||
|
//
|
||||||
|
// ColumnCount
|
||||||
|
//
|
||||||
|
this.ColumnCount.HeaderText = "Количество";
|
||||||
|
this.ColumnCount.MinimumWidth = 6;
|
||||||
|
this.ColumnCount.Name = "ColumnCount";
|
||||||
|
this.ColumnCount.Width = 125;
|
||||||
|
//
|
||||||
|
// FormDocument
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(726, 427);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
|
this.Controls.Add(this.buttonSave);
|
||||||
|
this.Controls.Add(this.groupBoxBlanks);
|
||||||
|
this.Controls.Add(this.textBoxPrice);
|
||||||
|
this.Controls.Add(this.textBoxName);
|
||||||
|
this.Controls.Add(this.labelPrice);
|
||||||
|
this.Controls.Add(this.labelName);
|
||||||
|
this.Name = "FormDocument";
|
||||||
|
this.Text = "Документ";
|
||||||
|
this.Load += new System.EventHandler(this.FormDocument_Load);
|
||||||
|
this.groupBoxBlanks.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelPrice;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxPrice;
|
||||||
|
private GroupBox groupBoxBlanks;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonUpdate;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private DataGridViewTextBoxColumn ID;
|
||||||
|
private DataGridViewTextBoxColumn ColumnBlankName;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
}
|
||||||
|
}
|
229
LawFirm/LawFirm/FormDocument.cs
Normal file
229
LawFirm/LawFirm/FormDocument.cs
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
using LawFirm;
|
||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicContracts;
|
||||||
|
using LawFirmContracts.SearchModels;
|
||||||
|
using LawFirmDataModels.Models;
|
||||||
|
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 FormDocument : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IDocumentLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
private Dictionary<int, (IBlankModel, int)> _documentBlanks;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
public FormDocument(ILogger<FormDocument> logger, IDocumentLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger= logger;
|
||||||
|
_logic= logic;
|
||||||
|
_documentBlanks = new Dictionary<int, (IBlankModel, int)>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormDocument_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка документа");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var view = _logic.ReadElement(new DocumentSearchModel
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.DocumentName;
|
||||||
|
textBoxPrice.Text = view.Price.ToString();
|
||||||
|
_documentBlanks = view.DocumentBlanks ?? new Dictionary<int, (IBlankModel, int)>();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки документа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка бланков документа");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_documentBlanks != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
foreach (var pc in _documentBlanks)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[]
|
||||||
|
{
|
||||||
|
pc.Key,
|
||||||
|
pc.Value.Item1.BlankName,
|
||||||
|
pc.Value.Item2
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
textBoxPrice.Text = CalcPrice().ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки бланков документа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double CalcPrice()
|
||||||
|
{
|
||||||
|
double price = 0;
|
||||||
|
foreach (var elem in _documentBlanks)
|
||||||
|
{
|
||||||
|
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
|
||||||
|
}
|
||||||
|
return Math.Round(price * 1.1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormDocumentBlank));
|
||||||
|
if (service is FormDocumentBlank form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (form.BlankModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Добавление нового бланка:{ BlankName}- { Count}", form.BlankModel.BlankName, form.Count);
|
||||||
|
if (_documentBlanks.ContainsKey(form.Id))
|
||||||
|
{
|
||||||
|
_documentBlanks[form.Id] = (form.BlankModel,form.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_documentBlanks.Add(form.Id, (form.BlankModel,form.Count));
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormDocumentBlank));
|
||||||
|
if (service is FormDocumentBlank form)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||||
|
form.Id = id;
|
||||||
|
form.Count = _documentBlanks[id].Item2;
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (form.BlankModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Изменение бланка:{ BlankName}- { Count}", form.BlankModel.BlankName, form.Count);
|
||||||
|
_documentBlanks[form.Id] = (form.BlankModel,form.Count);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление бланка:{ BlankName}- { Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||||
|
_documentBlanks?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_documentBlanks == null || _documentBlanks.Count == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните бланки", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение документа");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new DocumentBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
DocumentName = textBoxName.Text,
|
||||||
|
Price = Convert.ToDouble(textBoxPrice.Text),
|
||||||
|
DocumentBlanks = _documentBlanks
|
||||||
|
};
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
LawFirm/LawFirm/FormDocument.resx
Normal file
69
LawFirm/LawFirm/FormDocument.resx
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<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>
|
||||||
|
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnBlankName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
115
LawFirm/LawFirm/FormDocuments.Designer.cs
generated
Normal file
115
LawFirm/LawFirm/FormDocuments.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
namespace LawFirmView
|
||||||
|
{
|
||||||
|
partial class FormDocuments
|
||||||
|
{
|
||||||
|
/// <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.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.buttonEdit = new System.Windows.Forms.Button();
|
||||||
|
this.buttonDelete = new System.Windows.Forms.Button();
|
||||||
|
this.buttonUpdate = 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(12, 12);
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(507, 426);
|
||||||
|
this.dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(533, 12);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(152, 29);
|
||||||
|
this.buttonAdd.TabIndex = 2;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
this.buttonEdit.Location = new System.Drawing.Point(533, 47);
|
||||||
|
this.buttonEdit.Name = "buttonEdit";
|
||||||
|
this.buttonEdit.Size = new System.Drawing.Size(152, 29);
|
||||||
|
this.buttonEdit.TabIndex = 3;
|
||||||
|
this.buttonEdit.Text = "Изменить";
|
||||||
|
this.buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
this.buttonDelete.Location = new System.Drawing.Point(533, 82);
|
||||||
|
this.buttonDelete.Name = "buttonDelete";
|
||||||
|
this.buttonDelete.Size = new System.Drawing.Size(152, 29);
|
||||||
|
this.buttonDelete.TabIndex = 4;
|
||||||
|
this.buttonDelete.Text = "Удалить";
|
||||||
|
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
this.buttonUpdate.Location = new System.Drawing.Point(533, 409);
|
||||||
|
this.buttonUpdate.Name = "buttonUpdate";
|
||||||
|
this.buttonUpdate.Size = new System.Drawing.Size(152, 29);
|
||||||
|
this.buttonUpdate.TabIndex = 5;
|
||||||
|
this.buttonUpdate.Text = "Обновить";
|
||||||
|
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
|
||||||
|
//
|
||||||
|
// FormDocuments
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(697, 450);
|
||||||
|
this.Controls.Add(this.buttonUpdate);
|
||||||
|
this.Controls.Add(this.buttonDelete);
|
||||||
|
this.Controls.Add(this.buttonEdit);
|
||||||
|
this.Controls.Add(this.buttonAdd);
|
||||||
|
this.Controls.Add(this.dataGridView);
|
||||||
|
this.Name = "FormDocuments";
|
||||||
|
this.Text = "Документы";
|
||||||
|
this.Load += new System.EventHandler(this.FormDocuments_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonUpdate;
|
||||||
|
}
|
||||||
|
}
|
114
LawFirm/LawFirm/FormDocuments.cs
Normal file
114
LawFirm/LawFirm/FormDocuments.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
using LawFirm;
|
||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicContracts;
|
||||||
|
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 FormDocuments : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IDocumentLogic _logic;
|
||||||
|
public FormDocuments(ILogger<FormDocuments> logger, IDocumentLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormDocuments_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["DocumentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
dataGridView.Columns["DocumentBlanks"].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(FormDocument));
|
||||||
|
if (service is FormDocument form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormDocument));
|
||||||
|
if (service is FormDocument form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_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 DocumentBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления документа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
LawFirm/LawFirm/FormDocuments.resx
Normal file
60
LawFirm/LawFirm/FormDocuments.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>
|
143
LawFirm/LawFirm/FormMain.Designer.cs
generated
143
LawFirm/LawFirm/FormMain.Designer.cs
generated
@ -28,12 +28,149 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
|
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.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSetToWork = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSetToDone = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSetToFinish = new System.Windows.Forms.Button();
|
||||||
|
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||||
|
this.menuStrip.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.справочникиToolStripMenuItem});
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(1139, 28);
|
||||||
|
this.menuStrip.TabIndex = 0;
|
||||||
|
this.menuStrip.Text = "Справочники";
|
||||||
|
//
|
||||||
|
// справочникиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.бланкиToolStripMenuItem,
|
||||||
|
this.документыToolStripMenuItem});
|
||||||
|
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
|
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||||
|
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
|
//
|
||||||
|
// бланкиToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.бланкиToolStripMenuItem.Name = "бланкиToolStripMenuItem";
|
||||||
|
this.бланкиToolStripMenuItem.Size = new System.Drawing.Size(170, 26);
|
||||||
|
this.бланкиToolStripMenuItem.Text = "Бланки";
|
||||||
|
this.бланкиToolStripMenuItem.Click += new System.EventHandler(this.бланкиToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// документыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.документыToolStripMenuItem.Name = "документыToolStripMenuItem";
|
||||||
|
this.документыToolStripMenuItem.Size = new System.Drawing.Size(170, 26);
|
||||||
|
this.документыToolStripMenuItem.Text = "Документы";
|
||||||
|
this.документыToolStripMenuItem.Click += new System.EventHandler(this.документыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(12, 31);
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(915, 407);
|
||||||
|
this.dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonCreateOrder
|
||||||
|
//
|
||||||
|
this.buttonCreateOrder.Location = new System.Drawing.Point(933, 45);
|
||||||
|
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
|
this.buttonCreateOrder.Size = new System.Drawing.Size(194, 29);
|
||||||
|
this.buttonCreateOrder.TabIndex = 2;
|
||||||
|
this.buttonCreateOrder.Text = "Создать заказ";
|
||||||
|
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
|
||||||
|
//
|
||||||
|
// buttonSetToWork
|
||||||
|
//
|
||||||
|
this.buttonSetToWork.Location = new System.Drawing.Point(933, 80);
|
||||||
|
this.buttonSetToWork.Name = "buttonSetToWork";
|
||||||
|
this.buttonSetToWork.Size = new System.Drawing.Size(194, 29);
|
||||||
|
this.buttonSetToWork.TabIndex = 3;
|
||||||
|
this.buttonSetToWork.Text = "Отдать на выполнение";
|
||||||
|
this.buttonSetToWork.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSetToWork.Click += new System.EventHandler(this.buttonSetToWork_Click);
|
||||||
|
//
|
||||||
|
// buttonSetToDone
|
||||||
|
//
|
||||||
|
this.buttonSetToDone.Location = new System.Drawing.Point(933, 115);
|
||||||
|
this.buttonSetToDone.Name = "buttonSetToDone";
|
||||||
|
this.buttonSetToDone.Size = new System.Drawing.Size(194, 29);
|
||||||
|
this.buttonSetToDone.TabIndex = 4;
|
||||||
|
this.buttonSetToDone.Text = "Заказ готов";
|
||||||
|
this.buttonSetToDone.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSetToDone.Click += new System.EventHandler(this.buttonSetToDone_Click);
|
||||||
|
//
|
||||||
|
// buttonSetToFinish
|
||||||
|
//
|
||||||
|
this.buttonSetToFinish.Location = new System.Drawing.Point(933, 150);
|
||||||
|
this.buttonSetToFinish.Name = "buttonSetToFinish";
|
||||||
|
this.buttonSetToFinish.Size = new System.Drawing.Size(194, 29);
|
||||||
|
this.buttonSetToFinish.TabIndex = 5;
|
||||||
|
this.buttonSetToFinish.Text = "Заказ выдан";
|
||||||
|
this.buttonSetToFinish.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSetToFinish.Click += new System.EventHandler(this.buttonSetToFinish_Click);
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
this.buttonUpdate.Location = new System.Drawing.Point(933, 410);
|
||||||
|
this.buttonUpdate.Name = "buttonUpdate";
|
||||||
|
this.buttonUpdate.Size = new System.Drawing.Size(194, 29);
|
||||||
|
this.buttonUpdate.TabIndex = 6;
|
||||||
|
this.buttonUpdate.Text = "Обновить";
|
||||||
|
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
|
||||||
|
//
|
||||||
|
// FormMain
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(1139, 450);
|
||||||
this.Text = "FormMain";
|
this.Controls.Add(this.buttonUpdate);
|
||||||
|
this.Controls.Add(this.buttonSetToFinish);
|
||||||
|
this.Controls.Add(this.buttonSetToDone);
|
||||||
|
this.Controls.Add(this.buttonSetToWork);
|
||||||
|
this.Controls.Add(this.buttonCreateOrder);
|
||||||
|
this.Controls.Add(this.dataGridView);
|
||||||
|
this.Controls.Add(this.menuStrip);
|
||||||
|
this.MainMenuStrip = this.menuStrip;
|
||||||
|
this.Name = "FormMain";
|
||||||
|
this.Text = "Юридическая компания";
|
||||||
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
|
this.menuStrip.ResumeLayout(false);
|
||||||
|
this.menuStrip.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem бланкиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem документыToolStripMenuItem;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonCreateOrder;
|
||||||
|
private Button buttonSetToWork;
|
||||||
|
private Button buttonSetToDone;
|
||||||
|
private Button buttonSetToFinish;
|
||||||
|
private Button buttonUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,9 @@
|
|||||||
using System;
|
using LawFirm;
|
||||||
|
using LawFirmContracts.BindingModels;
|
||||||
|
using LawFirmContracts.BusinessLogicContracts;
|
||||||
|
using LawFirmDataModels.Enums;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -10,11 +15,171 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace LawFirmView
|
namespace LawFirmView
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
public FormMain()
|
private readonly ILogger _logger;
|
||||||
|
private readonly IOrderLogic _orderLogic;
|
||||||
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_orderLogic = orderLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка заказов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _orderLogic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["DocumentId"].Visible = false;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка заказов");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки заказов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void бланкиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormBlanks));
|
||||||
|
if (service is FormBlanks form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void документыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
|
||||||
|
if (service is FormDocuments form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
|
if (service is FormCreateOrder form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSetToWork_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
|
{ //id,name,count,sum,status,start,end
|
||||||
|
Id = id,
|
||||||
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
|
DocumentName = dataGridView.SelectedRows[0].Cells["DocumentName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
|
});
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSetToDone_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
|
DocumentName = dataGridView.SelectedRows[0].Cells["DocumentName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
|
});
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSetToFinish_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
|
||||||
|
DocumentName = dataGridView.SelectedRows[0].Cells["DocumentName"].Value.ToString(),
|
||||||
|
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
|
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||||
|
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||||
|
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||||
|
});
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
63
LawFirm/LawFirm/FormMain.resx
Normal file
63
LawFirm/LawFirm/FormMain.resx
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<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>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
@ -43,14 +43,14 @@ namespace LawFirm
|
|||||||
services.AddTransient<IDocumentStorage, DocumentStorage>();
|
services.AddTransient<IDocumentStorage, DocumentStorage>();
|
||||||
services.AddTransient<IBlankLogic, BlankLogic>();
|
services.AddTransient<IBlankLogic, BlankLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IDocumentLogic, IDocumentLogic>();
|
services.AddTransient<IDocumentLogic, DocumentLogic>();
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormBlank>();
|
services.AddTransient<FormBlank>();
|
||||||
services.AddTransient<FormBlanks>();
|
services.AddTransient<FormBlanks>();
|
||||||
//services.AddTransient<FormCreateOrder>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
//services.AddTransient<FormProduct>();
|
services.AddTransient<FormDocument>();
|
||||||
services.AddTransient<FormDocumentBlank>();
|
services.AddTransient<FormDocumentBlank>();
|
||||||
//services.AddTransient<FormProducts>();
|
services.AddTransient<FormDocuments>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
model.Status = newStatus;
|
model.Status = newStatus;
|
||||||
|
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
|
||||||
if (_orderStorage.Update(model) == null)
|
if (_orderStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
model.Status--;
|
model.Status--;
|
||||||
|
@ -12,6 +12,8 @@ namespace LawFirmContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; set; }
|
public int DocumentId { get; set; }
|
||||||
|
|
||||||
|
public string DocumentName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
@ -13,6 +13,9 @@ namespace LawFirmContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; set; }
|
public int DocumentId { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Номер")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
[DisplayName("Документ")]
|
[DisplayName("Документ")]
|
||||||
public string DocumentName { get; set; } = string.Empty;
|
public string DocumentName { get; set; } = string.Empty;
|
||||||
|
|
||||||
@ -31,7 +34,6 @@ namespace LawFirmContracts.ViewModels
|
|||||||
[DisplayName("Дата выполнения")]
|
[DisplayName("Дата выполнения")]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
|
|
||||||
[DisplayName("Номер")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ namespace LawFirmDataModels.Models
|
|||||||
public interface IOrderModel : IId
|
public interface IOrderModel : IId
|
||||||
{
|
{
|
||||||
int DocumentId { get; }
|
int DocumentId { get; }
|
||||||
|
string DocumentName { get; }
|
||||||
int Count { get; }
|
int Count { get; }
|
||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
|
@ -14,6 +14,8 @@ namespace LawFirmListImplements.Models
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; private set; }
|
public int DocumentId { get; private set; }
|
||||||
|
|
||||||
|
public string DocumentName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
@ -35,6 +37,7 @@ namespace LawFirmListImplements.Models
|
|||||||
return new Order
|
return new Order
|
||||||
{
|
{
|
||||||
DocumentId = model.DocumentId,
|
DocumentId = model.DocumentId,
|
||||||
|
DocumentName = model.DocumentName,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -51,6 +54,7 @@ namespace LawFirmListImplements.Models
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocumentId = model.DocumentId;
|
DocumentId = model.DocumentId;
|
||||||
|
DocumentName = model.DocumentName;
|
||||||
Count = model.Count;
|
Count = model.Count;
|
||||||
Sum = model.Sum;
|
Sum = model.Sum;
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
@ -62,6 +66,7 @@ namespace LawFirmListImplements.Models
|
|||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
DocumentId = DocumentId,
|
DocumentId = DocumentId,
|
||||||
|
DocumentName = DocumentName,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
|
Loading…
Reference in New Issue
Block a user