7 лаба исправления

This commit is contained in:
spacyboy 2024-05-22 18:56:53 +04:00
parent 4ae8ee3e9f
commit 5eaa15c044
10 changed files with 512 additions and 389 deletions

View File

@ -5,7 +5,7 @@
<add key="SmtpClientPort" value="587" />
<add key="PopHost" value="pop.gmail.com" />
<add key="PopPort" value="995" />
<add key="MailLogin" value="spaccyy@mail.com" />
<add key="MailPassword" value="123" />
<add key="MailLogin" value="rpplabss@gmail.com" />
<add key="MailPassword" value="fcwf gdjw zooy ehpq" />
</appSettings>
</configuration>
</configuration>

View File

@ -1,230 +1,239 @@
namespace SecuritySystem
{
partial class FormMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
partial class FormMain
{
/// <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);
}
/// <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
#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()
{
dataGridView = new DataGridView();
menuStrip1 = new MenuStrip();
toolStripMenuItem = new ToolStripMenuItem();
SensorToolStripMenuItem = new ToolStripMenuItem();
SecureToolStripMenuItem = new ToolStripMenuItem();
reportsToolStripMenuItem = new ToolStripMenuItem();
sensorsToolStripMenuItem = new ToolStripMenuItem();
sensorSecuresToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
workWithClientsToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
workWithImplementerToolStripMenuItem = new ToolStripMenuItem();
implementerToolStripMenuItem = new ToolStripMenuItem();
startingWorkToolStripMenuItem = new ToolStripMenuItem();
buttonCreateOrder = new Button();
buttonRef = new Button();
buttonIssuedOrder = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(10, 32);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(820, 302);
dataGridView.TabIndex = 7;
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem, workWithClientsToolStripMenuItem, workWithImplementerToolStripMenuItem, startingWorkToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(5, 2, 0, 2);
menuStrip1.Size = new Size(1135, 24);
menuStrip1.TabIndex = 13;
menuStrip1.Text = "menuStrip1";
//
// toolStripMenuItem
//
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SensorToolStripMenuItem, SecureToolStripMenuItem });
toolStripMenuItem.Name = "toolStripMenuItem";
toolStripMenuItem.Size = new Size(94, 20);
toolStripMenuItem.Text = "Справочники";
//
// SensorToolStripMenuItem
//
SensorToolStripMenuItem.Name = "SensorToolStripMenuItem";
SensorToolStripMenuItem.Size = new Size(130, 22);
SensorToolStripMenuItem.Text = "Заготовки";
SensorToolStripMenuItem.Click += SensorToolStripMenuItem_Click;
//
// SecureToolStripMenuItem
//
SecureToolStripMenuItem.Name = "SecureToolStripMenuItem";
SecureToolStripMenuItem.Size = new Size(130, 22);
SecureToolStripMenuItem.Text = "Изделия";
SecureToolStripMenuItem.Click += SecureToolStripMenuItem_Click;
//
// reportsToolStripMenuItem
//
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sensorsToolStripMenuItem, sensorSecuresToolStripMenuItem, ordersToolStripMenuItem });
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
reportsToolStripMenuItem.Size = new Size(60, 20);
reportsToolStripMenuItem.Text = "Отчёты";
//
// sensorsToolStripMenuItem
//
sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
sensorsToolStripMenuItem.Size = new Size(203, 22);
sensorsToolStripMenuItem.Text = "Список заготовок";
sensorsToolStripMenuItem.Click += SensorsToolStripMenuItem_Click;
//
// sensorSecuresToolStripMenuItem
//
sensorSecuresToolStripMenuItem.Name = "sensorSecuresToolStripMenuItem";
sensorSecuresToolStripMenuItem.Size = new Size(203, 22);
sensorSecuresToolStripMenuItem.Text = "Заготовки по изделиям";
sensorSecuresToolStripMenuItem.Click += SensorSecuresToolStripMenuItem_Click;
//
// ordersToolStripMenuItem
//
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(203, 22);
ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// workWithClientsToolStripMenuItem
//
workWithClientsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem });
workWithClientsToolStripMenuItem.Name = "workWithClientsToolStripMenuItem";
workWithClientsToolStripMenuItem.Size = new Size(129, 20);
workWithClientsToolStripMenuItem.Text = "Работа с клиентами";
//
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(122, 22);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// workWithImplementerToolStripMenuItem
//
workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { implementerToolStripMenuItem });
workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem";
workWithImplementerToolStripMenuItem.Size = new Size(157, 20);
workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями";
//
// implementerToolStripMenuItem
//
implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
implementerToolStripMenuItem.Size = new Size(180, 22);
implementerToolStripMenuItem.Text = "Исполнители";
implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click;
//
// startingWorkToolStripMenuItem
//
startingWorkToolStripMenuItem.Name = "startingWorkToolStripMenuItem";
startingWorkToolStripMenuItem.Size = new Size(92, 20);
startingWorkToolStripMenuItem.Text = "Запуск работ";
startingWorkToolStripMenuItem.Click += StartingWorkToolStripMenuItem_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Location = new Point(887, 55);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(206, 22);
buttonCreateOrder.TabIndex = 8;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += ButtonCreateOrder_Click;
//
// buttonRef
//
buttonRef.Location = new Point(887, 166);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(206, 22);
buttonRef.TabIndex = 12;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// buttonIssuedOrder
//
buttonIssuedOrder.Location = new Point(887, 111);
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(206, 22);
buttonIssuedOrder.TabIndex = 11;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1135, 338);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
Name = "FormMain";
Text = "SecuritySystem";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dataGridView = new DataGridView();
menuStrip1 = new MenuStrip();
toolStripMenuItem = new ToolStripMenuItem();
SensorToolStripMenuItem = new ToolStripMenuItem();
SecureToolStripMenuItem = new ToolStripMenuItem();
reportsToolStripMenuItem = new ToolStripMenuItem();
sensorsToolStripMenuItem = new ToolStripMenuItem();
sensorSecuresToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
workWithClientsToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
workWithImplementerToolStripMenuItem = new ToolStripMenuItem();
implementerToolStripMenuItem = new ToolStripMenuItem();
startingWorkToolStripMenuItem = new ToolStripMenuItem();
buttonCreateOrder = new Button();
buttonRef = new Button();
buttonIssuedOrder = new Button();
письмаToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(10, 32);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(820, 302);
dataGridView.TabIndex = 7;
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem, workWithClientsToolStripMenuItem, workWithImplementerToolStripMenuItem, startingWorkToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(5, 2, 0, 2);
menuStrip1.Size = new Size(1135, 24);
menuStrip1.TabIndex = 13;
menuStrip1.Text = "menuStrip1";
//
// toolStripMenuItem
//
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SensorToolStripMenuItem, SecureToolStripMenuItem, письмаToolStripMenuItem });
toolStripMenuItem.Name = "toolStripMenuItem";
toolStripMenuItem.Size = new Size(94, 20);
toolStripMenuItem.Text = "Справочники";
//
// SensorToolStripMenuItem
//
SensorToolStripMenuItem.Name = "SensorToolStripMenuItem";
SensorToolStripMenuItem.Size = new Size(180, 22);
SensorToolStripMenuItem.Text = "Заготовки";
SensorToolStripMenuItem.Click += SensorToolStripMenuItem_Click;
//
// SecureToolStripMenuItem
//
SecureToolStripMenuItem.Name = "SecureToolStripMenuItem";
SecureToolStripMenuItem.Size = new Size(180, 22);
SecureToolStripMenuItem.Text = "Изделия";
SecureToolStripMenuItem.Click += SecureToolStripMenuItem_Click;
//
// reportsToolStripMenuItem
//
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sensorsToolStripMenuItem, sensorSecuresToolStripMenuItem, ordersToolStripMenuItem });
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
reportsToolStripMenuItem.Size = new Size(60, 20);
reportsToolStripMenuItem.Text = "Отчёты";
//
// sensorsToolStripMenuItem
//
sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
sensorsToolStripMenuItem.Size = new Size(203, 22);
sensorsToolStripMenuItem.Text = "Список заготовок";
sensorsToolStripMenuItem.Click += SensorsToolStripMenuItem_Click;
//
// sensorSecuresToolStripMenuItem
//
sensorSecuresToolStripMenuItem.Name = "sensorSecuresToolStripMenuItem";
sensorSecuresToolStripMenuItem.Size = new Size(203, 22);
sensorSecuresToolStripMenuItem.Text = "Заготовки по изделиям";
sensorSecuresToolStripMenuItem.Click += SensorSecuresToolStripMenuItem_Click;
//
// ordersToolStripMenuItem
//
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(203, 22);
ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// workWithClientsToolStripMenuItem
//
workWithClientsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem });
workWithClientsToolStripMenuItem.Name = "workWithClientsToolStripMenuItem";
workWithClientsToolStripMenuItem.Size = new Size(129, 20);
workWithClientsToolStripMenuItem.Text = "Работа с клиентами";
//
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(122, 22);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// workWithImplementerToolStripMenuItem
//
workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { implementerToolStripMenuItem });
workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem";
workWithImplementerToolStripMenuItem.Size = new Size(157, 20);
workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями";
//
// implementerToolStripMenuItem
//
implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
implementerToolStripMenuItem.Size = new Size(149, 22);
implementerToolStripMenuItem.Text = "Исполнители";
implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click;
//
// startingWorkToolStripMenuItem
//
startingWorkToolStripMenuItem.Name = "startingWorkToolStripMenuItem";
startingWorkToolStripMenuItem.Size = new Size(92, 20);
startingWorkToolStripMenuItem.Text = "Запуск работ";
startingWorkToolStripMenuItem.Click += StartingWorkToolStripMenuItem_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Location = new Point(887, 55);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(206, 22);
buttonCreateOrder.TabIndex = 8;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += ButtonCreateOrder_Click;
//
// buttonRef
//
buttonRef.Location = new Point(887, 166);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(206, 22);
buttonRef.TabIndex = 12;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// buttonIssuedOrder
//
buttonIssuedOrder.Location = new Point(887, 111);
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(206, 22);
buttonIssuedOrder.TabIndex = 11;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
//
// письмаToolStripMenuItem
//
письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
письмаToolStripMenuItem.Size = new Size(180, 22);
письмаToolStripMenuItem.Text = "Письма";
письмаToolStripMenuItem.Click += MailsToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1135, 338);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
Name = "FormMain";
Text = "SecuritySystem";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DataGridView dataGridView;
private MenuStrip menuStrip1;
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem SensorToolStripMenuItem;
private ToolStripMenuItem SecureToolStripMenuItem;
private ToolStripMenuItem reportsToolStripMenuItem;
private ToolStripMenuItem sensorsToolStripMenuItem;
private ToolStripMenuItem sensorSecuresToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
private ToolStripMenuItem workWithClientsToolStripMenuItem;
private ToolStripMenuItem clientsToolStripMenuItem;
private ToolStripMenuItem workWithImplementerToolStripMenuItem;
private ToolStripMenuItem implementerToolStripMenuItem;
private ToolStripMenuItem startingWorkToolStripMenuItem;
private Button buttonCreateOrder;
private Button buttonRef;
private Button buttonIssuedOrder;
}
#endregion
private DataGridView dataGridView;
private MenuStrip menuStrip1;
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem SensorToolStripMenuItem;
private ToolStripMenuItem SecureToolStripMenuItem;
private ToolStripMenuItem reportsToolStripMenuItem;
private ToolStripMenuItem sensorsToolStripMenuItem;
private ToolStripMenuItem sensorSecuresToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
private ToolStripMenuItem workWithClientsToolStripMenuItem;
private ToolStripMenuItem clientsToolStripMenuItem;
private ToolStripMenuItem workWithImplementerToolStripMenuItem;
private ToolStripMenuItem implementerToolStripMenuItem;
private ToolStripMenuItem startingWorkToolStripMenuItem;
private Button buttonCreateOrder;
private Button buttonRef;
private Button buttonIssuedOrder;
private ToolStripMenuItem письмаToolStripMenuItem;
}
}

View File

@ -15,197 +15,197 @@ using System.Windows.Forms;
namespace SecuritySystem
{
public partial class FormMain : Form
{
private readonly ILogger _logger;
public partial class FormMain : Form
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
private readonly IReportLogic _reportLogic;
private readonly IWorkProcess _workProcess;
private readonly IWorkProcess _workProcess;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
{
InitializeComponent();
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
_workProcess = workProcess;
}
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
_workProcess = workProcess;
}
private void FormMain_Load(object sender, EventArgs e)
{
LoadData();
}
private void FormMain_Load(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
_logger.LogInformation("Çàãðóçêà çàêàçîâ");
private void LoadData()
{
_logger.LogInformation("Çàãðóçêà çàêàçîâ");
try
{
var list = _orderLogic.ReadList(null);
try
{
var list = _orderLogic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["SecureId"].Visible = false;
dataGridView.Columns["ImplementerId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["SecureId"].Visible = false;
dataGridView.Columns["ImplementerId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Çàãðóçêà çàêàçîâ");
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà çàãðóçêè çàêàçîâ");
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
_logger.LogInformation("Çàãðóçêà çàêàçîâ");
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà çàãðóçêè çàêàçîâ");
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SensorToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSensors));
private void SensorToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSensors));
if (service is FormSensors form)
{
form.ShowDialog();
}
}
if (service is FormSensors form)
{
form.ShowDialog();
}
}
private void SecureToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSecures));
private void SecureToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSecures));
if (service is FormSecures form)
{
form.ShowDialog();
}
}
if (service is FormSecures form)
{
form.ShowDialog();
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
private void ButtonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form)
{
form.ShowDialog();
LoadData();
}
if (service is FormCreateOrder form)
{
form.ShowDialog();
LoadData();
}
}
}
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Çàêàç ¹{id}. Ìåíÿåòñÿ ñòàòóñ íà 'Âûäàí'", id);
private void ButtonIssuedOrder_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
});
try
{
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
{
Id = id
});
if (!operationResult)
{
throw new Exception("Îøèáêà ïðè ñîõðàíåíèè. Äîïîëíèòåëüíàÿ èíôîðìàöèÿ â ëîãàõ.");
}
if (!operationResult)
{
throw new Exception("Îøèáêà ïðè ñîõðàíåíèè. Äîïîëíèòåëüíàÿ èíôîðìàöèÿ â ëîãàõ.");
}
_logger.LogInformation("Çàêàç ¹{id} âûäàí", id);
_logger.LogInformation("Çàêàç ¹{id} âûäàí", id);
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà îòìåòêè î âûäà÷è çàêàçà");
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Îøèáêà îòìåòêè î âûäà÷è çàêàçà");
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
private void SensorsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
private void SensorsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveSecuresToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveSecuresToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void SensorSecuresToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportSecureSensors));
private void SensorSecuresToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportSecureSensors));
if (service is FormReportSecureSensors form)
{
form.ShowDialog();
}
}
if (service is FormReportSecureSensors form)
{
form.ShowDialog();
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
if (service is FormClients form)
{
form.ShowDialog();
}
}
private void StartingWorkToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
private void StartingWorkToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
MessageBox.Show("Ïðîöåññ îáðàáîòêè çàïóùåí", "Ñîîáùåíèå", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
MessageBox.Show("Ïðîöåññ îáðàáîòêè çàïóùåí", "Ñîîáùåíèå", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void ImplementerToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
private void ImplementerToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
private void MailsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
private void MailsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
if (service is FormMails form)
{
form.ShowDialog();
}
}
}
if (service is FormMails form)
{
form.ShowDialog();
}
}
}
}

View File

@ -97,7 +97,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false;
}
SendOrderMessage(result.ClientId, $"Кузнечная мастерская, Заказ №{result.Id}", $"Заказ №{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
return true;
}
@ -213,7 +213,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false;
}
SendOrderMessage(result.ClientId, $"Кузнечаня мастерская, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
return true;
}

View File

@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement;
namespace SecuritySystemDatabaseImplement.Migrations
{
[DbContext(typeof(SecuritySystemDatabase))]
[Migration("20240508043144_Init")]
[Migration("20240522072007_Init")]
partial class Init
{
/// <inheritdoc />
@ -77,6 +77,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -186,6 +216,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
.WithMany("MessageInfos")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -232,6 +271,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{
b.Navigation("MessageInfos");
b.Navigation("Orders");
});

View File

@ -70,6 +70,27 @@ namespace SecuritySystemDatabaseImplement.Migrations
table.PrimaryKey("PK_Sensors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.MessageId);
table.ForeignKey(
name: "FK_Messages_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
@ -134,6 +155,11 @@ namespace SecuritySystemDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
@ -163,6 +189,9 @@ namespace SecuritySystemDatabaseImplement.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Orders");

View File

@ -74,6 +74,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -183,6 +213,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
.WithMany("MessageInfos")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -229,6 +268,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{
b.Navigation("MessageInfos");
b.Navigation("Orders");
});

View File

@ -15,7 +15,7 @@ namespace SecuritySystemDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=WIN-GKU3FFNUNO6;Initial Catalog=SecuritySystemDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=WIN-GKU3FFNUNO6;Initial Catalog=SecuritySystemDatabase7;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -16,4 +16,8 @@
<ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@ -6,11 +6,10 @@
}
},
"AllowedHosts": "*",
"SmtpClientHost": "smtp.gmail.com",
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "spaccyy@mail.ru",
"MailPassword": "123"
"MailLogin": "rpplabss@gmail.com",
"MailPassword": "fcwf gdjw zooy ehpq"
}