Создана главная форма. Исправлены ошибки

This commit is contained in:
Данила Мочалов 2023-01-30 09:20:55 +04:00
parent 913ea75594
commit 828af603ab
20 changed files with 490 additions and 83 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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();
} }

View File

@ -124,6 +124,7 @@
this.Controls.Add(this.labelName); this.Controls.Add(this.labelName);
this.Name = "FormCreateOrder"; this.Name = "FormCreateOrder";
this.Text = "Создание заказа"; this.Text = "Создание заказа";
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -115,6 +115,7 @@ namespace LawFirmView
var operationResult = _logicO.CreateOrder(new OrderBindingModel var operationResult = _logicO.CreateOrder(new OrderBindingModel
{ {
DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue), DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue),
DocumentName = comboBoxDocument.Text,
Count = Convert.ToInt32(textBoxCount.Text), Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text) Sum = Convert.ToDouble(textBoxSum.Text)
}); });

View File

@ -33,15 +33,16 @@
this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox(); this.textBoxPrice = new System.Windows.Forms.TextBox();
this.groupBoxBlanks = new System.Windows.Forms.GroupBox(); this.groupBoxBlanks = new System.Windows.Forms.GroupBox();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.ColumnBlankName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
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(); 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.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = 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(); this.groupBoxBlanks.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -92,53 +93,15 @@
this.groupBoxBlanks.TabStop = false; this.groupBoxBlanks.TabStop = false;
this.groupBoxBlanks.Text = "Бланки"; this.groupBoxBlanks.Text = "Бланки";
// //
// dataGridView // buttonUpdate
// //
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.buttonUpdate.Location = new System.Drawing.Point(521, 240);
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.buttonUpdate.Name = "buttonUpdate";
this.ColumnBlankName, this.buttonUpdate.Size = new System.Drawing.Size(155, 29);
this.ColumnCount}); this.buttonUpdate.TabIndex = 4;
this.dataGridView.Location = new System.Drawing.Point(6, 26); this.buttonUpdate.Text = "Обновить";
this.dataGridView.Name = "dataGridView"; this.buttonUpdate.UseVisualStyleBackColor = true;
this.dataGridView.RowHeadersWidth = 51; this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(490, 243);
this.dataGridView.TabIndex = 0;
//
// ColumnBlankName
//
this.ColumnBlankName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ColumnBlankName.HeaderText = "Бланк";
this.ColumnBlankName.MinimumWidth = 6;
this.ColumnBlankName.Name = "ColumnBlankName";
this.ColumnBlankName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
//
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.MinimumWidth = 6;
this.ColumnCount.Name = "ColumnCount";
this.ColumnCount.Width = 125;
//
// 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);
//
// 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);
// //
// buttonDelete // buttonDelete
// //
@ -150,15 +113,40 @@
this.buttonDelete.UseVisualStyleBackColor = true; this.buttonDelete.UseVisualStyleBackColor = true;
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click); this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
// //
// buttonUpdate // buttonEdit
// //
this.buttonUpdate.Location = new System.Drawing.Point(521, 240); this.buttonEdit.Location = new System.Drawing.Point(521, 61);
this.buttonUpdate.Name = "buttonUpdate"; this.buttonEdit.Name = "buttonEdit";
this.buttonUpdate.Size = new System.Drawing.Size(155, 29); this.buttonEdit.Size = new System.Drawing.Size(155, 29);
this.buttonUpdate.TabIndex = 4; this.buttonEdit.TabIndex = 2;
this.buttonUpdate.Text = "Обновить"; this.buttonEdit.Text = "Изменить";
this.buttonUpdate.UseVisualStyleBackColor = true; this.buttonEdit.UseVisualStyleBackColor = true;
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click); 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 // buttonSave
// //
@ -180,6 +168,30 @@
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); 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 // FormDocument
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
@ -194,6 +206,7 @@
this.Controls.Add(this.labelName); this.Controls.Add(this.labelName);
this.Name = "FormDocument"; this.Name = "FormDocument";
this.Text = "Документ"; this.Text = "Документ";
this.Load += new System.EventHandler(this.FormDocument_Load);
this.groupBoxBlanks.ResumeLayout(false); this.groupBoxBlanks.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -209,13 +222,14 @@
private TextBox textBoxPrice; private TextBox textBoxPrice;
private GroupBox groupBoxBlanks; private GroupBox groupBoxBlanks;
private DataGridView dataGridView; private DataGridView dataGridView;
private DataGridViewTextBoxColumn ColumnBlankName;
private DataGridViewTextBoxColumn ColumnCount;
private Button buttonUpdate; private Button buttonUpdate;
private Button buttonDelete; private Button buttonDelete;
private Button buttonEdit; private Button buttonEdit;
private Button buttonAdd; private Button buttonAdd;
private Button buttonSave; private Button buttonSave;
private Button buttonCancel; private Button buttonCancel;
private DataGridViewTextBoxColumn ID;
private DataGridViewTextBoxColumn ColumnBlankName;
private DataGridViewTextBoxColumn ColumnCount;
} }
} }

View File

@ -31,7 +31,7 @@ namespace LawFirmView
_documentBlanks = new Dictionary<int, (IBlankModel, int)>(); _documentBlanks = new Dictionary<int, (IBlankModel, int)>();
} }
private void FormProduct_Load(object sender, EventArgs e) private void FormDocument_Load(object sender, EventArgs e)
{ {
if (_id.HasValue) if (_id.HasValue)
{ {
@ -68,7 +68,13 @@ namespace LawFirmView
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var pc in _documentBlanks) foreach (var pc in _documentBlanks)
{ {
dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.BlankName, pc.Value.Item2 }); dataGridView.Rows.Add(new object[]
{
pc.Key,
pc.Value.Item1.BlankName,
pc.Value.Item2
}
);
} }
textBoxPrice.Text = CalcPrice().ToString(); textBoxPrice.Text = CalcPrice().ToString();
} }
@ -214,5 +220,10 @@ namespace LawFirmView
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
Close(); Close();
} }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
} }
} }

View File

@ -57,10 +57,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ColumnBlankName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="ID.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> <value>True</value>
</metadata> </metadata>
<metadata name="ColumnBlankName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="ColumnBlankName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@ -98,6 +98,7 @@
this.Controls.Add(this.dataGridView); this.Controls.Add(this.dataGridView);
this.Name = "FormDocuments"; this.Name = "FormDocuments";
this.Text = "Документы"; this.Text = "Документы";
this.Load += new System.EventHandler(this.FormDocuments_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -39,6 +39,7 @@ namespace LawFirmView
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["DocumentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns["DocumentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["DocumentBlanks"].Visible = false;
} }
_logger.LogInformation("Загрузка документов"); _logger.LogInformation("Загрузка документов");
} }

View File

@ -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(982, 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(758, 407);
this.dataGridView.TabIndex = 1;
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(776, 44);
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(776, 79);
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(776, 114);
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(776, 149);
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(776, 409);
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(982, 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;
} }
} }

View File

@ -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,172 @@ 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();
} }
} }
} }

View 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>

View File

@ -43,11 +43,11 @@ 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<FormDocument>(); services.AddTransient<FormDocument>();
services.AddTransient<FormDocumentBlank>(); services.AddTransient<FormDocumentBlank>();
services.AddTransient<FormDocuments>(); services.AddTransient<FormDocuments>();

View File

@ -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--;

View File

@ -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; }

View File

@ -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; }
} }
} }

View File

@ -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; }

View File

@ -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,
@ -62,6 +65,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,