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

View File

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

View File

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

View File

@ -97,7 +97,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false; 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; return true;
} }
@ -213,7 +213,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false; return false;
} }
SendOrderMessage(result.ClientId, $"Кузнечаня мастерская, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}"); SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
return true; return true;
} }

View File

@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement;
namespace SecuritySystemDatabaseImplement.Migrations namespace SecuritySystemDatabaseImplement.Migrations
{ {
[DbContext(typeof(SecuritySystemDatabase))] [DbContext(typeof(SecuritySystemDatabase))]
[Migration("20240508043144_Init")] [Migration("20240522072007_Init")]
partial class Init partial class Init
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -77,6 +77,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -186,6 +216,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client") b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -232,6 +271,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("MessageInfos");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -70,6 +70,27 @@ namespace SecuritySystemDatabaseImplement.Migrations
table.PrimaryKey("PK_Sensors", x => x.Id); 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( migrationBuilder.CreateTable(
name: "Orders", name: "Orders",
columns: table => new columns: table => new
@ -134,6 +155,11 @@ namespace SecuritySystemDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId", name: "IX_Orders_ClientId",
table: "Orders", table: "Orders",
@ -163,6 +189,9 @@ namespace SecuritySystemDatabaseImplement.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Orders"); name: "Orders");

View File

@ -74,6 +74,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -183,6 +213,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client") b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -229,6 +268,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("MessageInfos");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -15,7 +15,7 @@ namespace SecuritySystemDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) 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> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@ -16,4 +16,8 @@
<ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" /> <ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project> </Project>

View File

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