diff --git a/SecuritySystem/SecuritySystem/App.config b/SecuritySystem/SecuritySystem/App.config index e93988a..1cc7c85 100644 --- a/SecuritySystem/SecuritySystem/App.config +++ b/SecuritySystem/SecuritySystem/App.config @@ -5,7 +5,7 @@ - - + + - \ No newline at end of file + diff --git a/SecuritySystem/SecuritySystem/FormMain.Designer.cs b/SecuritySystem/SecuritySystem/FormMain.Designer.cs index a55c07e..33998ed 100644 --- a/SecuritySystem/SecuritySystem/FormMain.Designer.cs +++ b/SecuritySystem/SecuritySystem/FormMain.Designer.cs @@ -1,230 +1,239 @@ namespace SecuritySystem { - partial class FormMain - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + 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 - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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(); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } } \ No newline at end of file diff --git a/SecuritySystem/SecuritySystem/FormMain.cs b/SecuritySystem/SecuritySystem/FormMain.cs index 78a346d..89ab48a 100644 --- a/SecuritySystem/SecuritySystem/FormMain.cs +++ b/SecuritySystem/SecuritySystem/FormMain.cs @@ -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 logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess) - { - InitializeComponent(); + public FormMain(ILogger 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(); + } + } + } } \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemBusinessLogiс/BusinessLogic/OrderLogic.cs b/SecuritySystem/SecuritySystemBusinessLogiс/BusinessLogic/OrderLogic.cs index 0ee314f..9d886ee 100644 --- a/SecuritySystem/SecuritySystemBusinessLogiс/BusinessLogic/OrderLogic.cs +++ b/SecuritySystem/SecuritySystemBusinessLogiс/BusinessLogic/OrderLogic.cs @@ -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; } diff --git a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.Designer.cs b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.Designer.cs similarity index 85% rename from SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.Designer.cs rename to SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.Designer.cs index 6d9cf9a..118ff77 100644 --- a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.Designer.cs +++ b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.Designer.cs @@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement; namespace SecuritySystemDatabaseImplement.Migrations { [DbContext(typeof(SecuritySystemDatabase))] - [Migration("20240508043144_Init")] + [Migration("20240522072007_Init")] partial class Init { /// @@ -77,6 +77,36 @@ namespace SecuritySystemDatabaseImplement.Migrations b.ToTable("Implementers"); }); + modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.HasIndex("ClientId"); + + b.ToTable("Messages"); + }); + modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b => { b.Property("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"); }); diff --git a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.cs b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.cs similarity index 85% rename from SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.cs rename to SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.cs index 732c80c..b608cdc 100644 --- a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240508043144_Init.cs +++ b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/20240522072007_Init.cs @@ -70,6 +70,27 @@ namespace SecuritySystemDatabaseImplement.Migrations table.PrimaryKey("PK_Sensors", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Messages", + columns: table => new + { + MessageId = table.Column(type: "nvarchar(450)", nullable: false), + ClientId = table.Column(type: "int", nullable: true), + SenderName = table.Column(type: "nvarchar(max)", nullable: false), + DateDelivery = table.Column(type: "datetime2", nullable: false), + Subject = table.Column(type: "nvarchar(max)", nullable: false), + Body = table.Column(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 /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "Messages"); + migrationBuilder.DropTable( name: "Orders"); diff --git a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/SecuritySystemDatabaseModelSnapshot.cs b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/SecuritySystemDatabaseModelSnapshot.cs index d5f5bd5..2b1b1ab 100644 --- a/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/SecuritySystemDatabaseModelSnapshot.cs +++ b/SecuritySystem/SecuritySystemDatabaseImplement/Migrations/SecuritySystemDatabaseModelSnapshot.cs @@ -74,6 +74,36 @@ namespace SecuritySystemDatabaseImplement.Migrations b.ToTable("Implementers"); }); + modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.HasIndex("ClientId"); + + b.ToTable("Messages"); + }); + modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b => { b.Property("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"); }); diff --git a/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabase.cs b/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabase.cs index c5eed06..0cf2553 100644 --- a/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabase.cs +++ b/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabase.cs @@ -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"); } diff --git a/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabaseImplement.csproj b/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabaseImplement.csproj index 8ef60a6..c47a43f 100644 --- a/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabaseImplement.csproj +++ b/SecuritySystem/SecuritySystemDatabaseImplement/SecuritySystemDatabaseImplement.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -16,4 +16,8 @@ + + + + diff --git a/SecuritySystem/SecuritySystemRestApi/appsettings.json b/SecuritySystem/SecuritySystemRestApi/appsettings.json index 471597d..e2b17b9 100644 --- a/SecuritySystem/SecuritySystemRestApi/appsettings.json +++ b/SecuritySystem/SecuritySystemRestApi/appsettings.json @@ -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" }