diff --git a/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ImplementerLogic.cs b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ImplementerLogic.cs new file mode 100644 index 0000000..bb84476 --- /dev/null +++ b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ImplementerLogic.cs @@ -0,0 +1,126 @@ +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.BusinessLogicsContracts; +using AbstractLawFirmContracts.SearchModels; +using AbstractLawFirmContracts.StoragesContracts; +using AbstractLawFirmContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmBusinessLogic.BusinessLogic +{ + public class ImplementerLogic : IImplementerLogic + { + private readonly ILogger _logger; + private readonly IImplementerStorage _implementerStorage; + public ImplementerLogic(ILogger logger, IImplementerStorage implementerStorage) + { + _logger = logger; + _implementerStorage = implementerStorage; + } + + public bool Create(ImplementerBindingModel model) + { + CheckModel(model); + if (_implementerStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(ImplementerBindingModel model) + { + CheckModel(model); + if (_implementerStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(ImplementerBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_implementerStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public ImplementerViewModel? ReadElement(ImplementerSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. FIO:{FIO}.Id:{ Id}", model.ImplementerFIO, model.Id); + var element = _implementerStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + + public List? ReadList(ImplementerSearchModel? model) + { + _logger.LogInformation("ReadList. FIO:{FIO}.Id:{ Id} ", model?.ImplementerFIO, model?.Id); + var list = (model == null) ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + private void CheckModel(ImplementerBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (model.WorkExperience < 0) + { + throw new ArgumentException("Стаж работы не может быть меньше нуля", nameof(model.WorkExperience)); + } + if (model.Qualification < 0) + { + throw new ArgumentException("Квалификация не должна быть меньше нуля", nameof(model.Qualification)); + } + if (string.IsNullOrEmpty(model.Password)) + { + throw new ArgumentNullException("Нет пароля исполнителя", nameof(model.ImplementerFIO)); + } + if (string.IsNullOrEmpty(model.ImplementerFIO)) + { + throw new ArgumentNullException("Нет ФИО исполнителя", nameof(model.ImplementerFIO)); + } + _logger.LogInformation("Implementer. Id: {Id}, FIO: {FIO}", model.Id, model.ImplementerFIO); + var element = _implementerStorage.GetElement(new ImplementerSearchModel + { + ImplementerFIO = model.ImplementerFIO, + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Исполнитель с таким ФИО уже есть"); + } + } + } +} diff --git a/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/WorkModeling.cs b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/WorkModeling.cs new file mode 100644 index 0000000..5fe6bf5 --- /dev/null +++ b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/WorkModeling.cs @@ -0,0 +1,141 @@ +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.BusinessLogicsContracts; +using AbstractLawFirmContracts.SearchModels; +using AbstractLawFirmContracts.ViewModels; +using AbstractLawFirmDataModels.Enums; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmBusinessLogic.BusinessLogic +{ + public class WorkModeling : IWorkProcess + { + private readonly ILogger _logger; + private readonly Random _rnd; + private IOrderLogic? _orderLogic; + public WorkModeling(ILogger logger) + { + _logger = logger; + _rnd = new Random(1000); + } + public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic) + { + _orderLogic = orderLogic; + var implementers = implementerLogic.ReadList(null); + if (implementers == null) + { + _logger.LogWarning("DoWork. Implementers is null"); + return; + } + var orders = _orderLogic.ReadList(new OrderSearchModel + { + Status = OrderStatus.Принят + }); + if (orders == null || orders.Count == 0) + { + _logger.LogWarning("DoWork. Orders is null or empty"); + return; + } + _logger.LogDebug("DoWork for {Count} orders", orders.Count); + foreach (var implementer in implementers) + { + Task.Run(() => WorkerWorkAsync(implementer, orders)); + } + } + /// Иммитация работы исполнителя + private async Task WorkerWorkAsync(ImplementerViewModel implementer, + List orders) + { + if (_orderLogic == null || implementer == null) + { + return; + } + await RunOrderInWork(implementer); + await Task.Run(() => + { + foreach (var order in orders) + { + try + { + _logger.LogDebug("DoWork. Worker {Id} try get order { Order}", implementer.Id, order.Id); + // пытаемся назначить заказ на исполнителя + _orderLogic.TakeOrderInWork(new OrderBindingModel + { + Id = order.Id, + ImplementerId = implementer.Id + }); + // делаем работу + Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count); + _logger.LogDebug("DoWork. Worker {Id} finish order { Order}", implementer.Id, order.Id); + + _orderLogic.FinishOrder(new OrderBindingModel + { + Id = order.Id + }); + } + // кто-то мог уже перехватить заказ, игнорируем ошибку + catch (InvalidOperationException ex) + { + _logger.LogWarning(ex, "Error try get work"); + } + // заканчиваем выполнение имитации в случае иной ошибки + catch (Exception ex) + { + _logger.LogError(ex, "Error while do work"); + throw; + } + // отдыхаем + Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + } + }); + } + /// Ищем заказ, которые уже в работе (вдруг исполнителя прервали) + private async Task RunOrderInWork(ImplementerViewModel implementer) + { + if (_orderLogic == null || implementer == null) + { + return; + } + try + { + var runOrder = await Task.Run(() => _orderLogic.ReadElement(new + OrderSearchModel + { + ImplementerId = implementer.Id, + Status = OrderStatus.Выполняется + })); + if (runOrder == null) + { + return; + } + _logger.LogDebug("DoWork. Worker {Id} back to order {Order}", + implementer.Id, runOrder.Id); + // доделываем работу + Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count); + _logger.LogDebug("DoWork. Worker {Id} finish order {Order}", + implementer.Id, runOrder.Id); + _orderLogic.FinishOrder(new OrderBindingModel + { + Id = runOrder.Id + }); + // отдыхаем + Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + } + // заказа может не быть, просто игнорируем ошибку + catch (InvalidOperationException ex) + { + _logger.LogWarning(ex, "Error try get work"); + } + // а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации + catch (Exception ex) + { + _logger.LogError(ex, "Error while do work"); + throw; + } + } + } +} diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IWorkProcess.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IWorkProcess.cs new file mode 100644 index 0000000..3b8e483 --- /dev/null +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IWorkProcess.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmContracts.BusinessLogicsContracts +{ + public interface IWorkProcess + { + /// + /// Запуск работ + /// + void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic); + } + +} diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/StoragesContracts/IImplementerStorage.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/StoragesContracts/IImplementerStorage.cs new file mode 100644 index 0000000..67f86c4 --- /dev/null +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/StoragesContracts/IImplementerStorage.cs @@ -0,0 +1,26 @@ +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.SearchModels; +using AbstractLawFirmContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmContracts.StoragesContracts +{ + public interface IImplementerStorage + { + List GetFullList(); + + List GetFilteredList(ImplementerSearchModel model); + + ImplementerViewModel? GetElement(ImplementerSearchModel model); + + ImplementerViewModel? Insert(ImplementerBindingModel model); + + ImplementerViewModel? Update(ImplementerBindingModel model); + + ImplementerViewModel? Delete(ImplementerBindingModel model); + } +} diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs b/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs index 9b6c81e..2de4690 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs @@ -24,6 +24,7 @@ namespace AbstractLawFirmDataBaseImplement public virtual DbSet DocumentComponents { set; get; } public virtual DbSet Orders { set; get; } public virtual DbSet Clients { set; get; } + public virtual DbSet Implementers { set; get; } } } diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ImplementerStorage.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ImplementerStorage.cs new file mode 100644 index 0000000..875c32a --- /dev/null +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ImplementerStorage.cs @@ -0,0 +1,84 @@ +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.SearchModels; +using AbstractLawFirmContracts.StoragesContracts; +using AbstractLawFirmContracts.ViewModels; +using AbstractLawFirmDataBaseImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmDataBaseImplement.Implements +{ + public class ImplementerStorage : IImplementerStorage + { + public ImplementerViewModel? GetElement(ImplementerSearchModel model) + { + using var context = new AbstractLawFirmDatabase(); + if (model.Id.HasValue) return context.Implementers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + if (model.ImplementerFIO != null && model.Password != null) return context.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO) && x.Password.Equals(model.Password))?.GetViewModel; + if (model.ImplementerFIO != null) return context.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO))?.GetViewModel; + return null; + } + + public List GetFilteredList(ImplementerSearchModel model) + { + if (model == null) + { + return new(); + } + if (model.ImplementerFIO != null) + { + using var context = new AbstractLawFirmDatabase(); + return context.Implementers + .Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO)) + .Select(x => x.GetViewModel) + .ToList(); + } + return new(); + } + + public List GetFullList() + { + using var context = new AbstractLawFirmDatabase(); + return context.Implementers.Select(x => x.GetViewModel).ToList(); + } + + public ImplementerViewModel? Insert(ImplementerBindingModel model) + { + using var context = new AbstractLawFirmDatabase(); + var res = Implementer.Create(model); + if (res != null) + { + context.Implementers.Add(res); + context.SaveChanges(); + } + return res?.GetViewModel; + } + + public ImplementerViewModel? Update(ImplementerBindingModel model) + { + using var context = new AbstractLawFirmDatabase(); + var res = context.Implementers.FirstOrDefault(x => x.Id == model.Id); + if (res != null) + { + res.Update(model); + context.SaveChanges(); + } + return res?.GetViewModel; + } + public ImplementerViewModel? Delete(ImplementerBindingModel model) + { + using var context = new AbstractLawFirmDatabase(); + var res = context.Implementers.FirstOrDefault(x => x.Id == model.Id); + if (res != null) + { + context.Implementers.Remove(res); + context.SaveChanges(); + } + return res?.GetViewModel; + } + + } +} diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Models/Implementer.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Implementer.cs new file mode 100644 index 0000000..21696b1 --- /dev/null +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Implementer.cs @@ -0,0 +1,66 @@ +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.ViewModels; +using AbstractLawFirmDatabaseImplement.Models; +using AbstractLawFirmDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractLawFirmDataBaseImplement.Models +{ + public class Implementer : IImplementerModel + { + public int Id { get; private set; } + + public string ImplementerFIO { get; private set; } = string.Empty; + + public string Password { get; private set; } = string.Empty; + + public int WorkExperience { get; private set; } + + public int Qualification { get; private set; } + + [ForeignKey("ImplementerId")] + public virtual List Orders { get; private set; } = new(); + + public static Implementer? Create(ImplementerBindingModel model) + { + if (model == null) + { + return null; + } + return new() + { + Id = model.Id, + ImplementerFIO = model.ImplementerFIO, + Password = model.Password, + Qualification = model.Qualification, + WorkExperience = model.WorkExperience, + }; + } + + public void Update(ImplementerBindingModel model) + { + if (model == null) + { + return; + } + ImplementerFIO = model.ImplementerFIO; + Password = model.Password; + Qualification = model.Qualification; + WorkExperience = model.WorkExperience; + } + + public ImplementerViewModel GetViewModel => new() + { + Id = Id, + ImplementerFIO = ImplementerFIO, + Password = Password, + Qualification = Qualification, + WorkExperience = WorkExperience, + }; + } +} diff --git a/LawFirm/LawFirmView/FormImplementer.Designer.cs b/LawFirm/LawFirmView/FormImplementer.Designer.cs new file mode 100644 index 0000000..ec6d7f0 --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementer.Designer.cs @@ -0,0 +1,39 @@ +namespace LawFirmView +{ + partial class FormImplementer + { + /// + /// 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); + } + + #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() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "FormImplementer"; + } + + #endregion + } +} \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormImplementer.cs b/LawFirm/LawFirmView/FormImplementer.cs new file mode 100644 index 0000000..fd1c35c --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementer.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LawFirmView +{ + public partial class FormImplementer : Form + { + public FormImplementer() + { + InitializeComponent(); + } + } +} diff --git a/LawFirm/LawFirmView/FormImplementer.resx b/LawFirm/LawFirmView/FormImplementer.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormImplementers.Designer.cs b/LawFirm/LawFirmView/FormImplementers.Designer.cs new file mode 100644 index 0000000..13e858e --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementers.Designer.cs @@ -0,0 +1,39 @@ +namespace LawFirmView +{ + partial class FormImplementers + { + /// + /// 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); + } + + #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() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "FormImplementers"; + } + + #endregion + } +} \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormImplementers.cs b/LawFirm/LawFirmView/FormImplementers.cs new file mode 100644 index 0000000..fad38ff --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementers.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LawFirmView +{ + public partial class FormImplementers : Form + { + public FormImplementers() + { + InitializeComponent(); + } + } +} diff --git a/LawFirm/LawFirmView/FormImplementers.resx b/LawFirm/LawFirmView/FormImplementers.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/LawFirm/LawFirmView/FormImplementers.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormMain.cs b/LawFirm/LawFirmView/FormMain.cs index 9af50dd..a2383cf 100644 --- a/LawFirm/LawFirmView/FormMain.cs +++ b/LawFirm/LawFirmView/FormMain.cs @@ -12,12 +12,14 @@ namespace LawFirmView private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; private readonly IReportLogic _reportLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) + private readonly IWorkProcess _workProcess; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; _reportLogic = reportLogic; + _workProcess = workProcess; } private void FormMain_Load(object sender, EventArgs e) @@ -214,5 +216,15 @@ namespace LawFirmView form.ShowDialog(); } } + + private void ЗапускРаботToolStripMenuItem_Click(object sender, EventArgs e) + { + + _workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic + )) as IImplementerLogic)!, _orderLogic); + MessageBox.Show("Процесс обработки запущен", "Сообщение", + MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } } \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormMain.designer.cs b/LawFirm/LawFirmView/FormMain.designer.cs index 3ee65d4..bb4a36b 100644 --- a/LawFirm/LawFirmView/FormMain.designer.cs +++ b/LawFirm/LawFirmView/FormMain.designer.cs @@ -28,180 +28,189 @@ /// private void InitializeComponent() { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.toolStripMenuItemCatalogs = new System.Windows.Forms.ToolStripMenuItem(); - this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.пакетыДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.списокПакетовДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.компонентыПоПакетамДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.buttonCreateOrder = new System.Windows.Forms.Button(); - this.buttonTakeOrderInWork = new System.Windows.Forms.Button(); - this.buttonOrderReady = new System.Windows.Forms.Button(); - this.buttonIssuedOrder = new System.Windows.Forms.Button(); - this.buttonRef = new System.Windows.Forms.Button(); - this.menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); + menuStrip1 = new MenuStrip(); + toolStripMenuItemCatalogs = new ToolStripMenuItem(); + компонентыToolStripMenuItem = new ToolStripMenuItem(); + пакетыДокументовToolStripMenuItem = new ToolStripMenuItem(); + клиентыToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem = new ToolStripMenuItem(); + списокПакетовДокументовToolStripMenuItem = new ToolStripMenuItem(); + компонентыПоПакетамДокументовToolStripMenuItem = new ToolStripMenuItem(); + списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + dataGridView = new DataGridView(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonOrderReady = new Button(); + buttonIssuedOrder = new Button(); + buttonRef = new Button(); + ЗапускРаботToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); // // menuStrip1 // - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItemCatalogs, - this.отчётыToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1047, 24); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "Справочники"; + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItemCatalogs, отчётыToolStripMenuItem, ЗапускРаботToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Padding = new Padding(7, 3, 0, 3); + menuStrip1.Size = new Size(1197, 30); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "Справочники"; // // toolStripMenuItemCatalogs // - this.toolStripMenuItemCatalogs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.компонентыToolStripMenuItem, - this.пакетыДокументовToolStripMenuItem, - this.клиентыToolStripMenuItem}); - this.toolStripMenuItemCatalogs.Name = "toolStripMenuItemCatalogs"; - this.toolStripMenuItemCatalogs.Size = new System.Drawing.Size(94, 20); - this.toolStripMenuItemCatalogs.Text = "Справочники"; + toolStripMenuItemCatalogs.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, пакетыДокументовToolStripMenuItem, клиентыToolStripMenuItem }); + toolStripMenuItemCatalogs.Name = "toolStripMenuItemCatalogs"; + toolStripMenuItemCatalogs.Size = new Size(117, 24); + toolStripMenuItemCatalogs.Text = "Справочники"; // // компонентыToolStripMenuItem // - this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(183, 22); - this.компонентыToolStripMenuItem.Text = "Компоненты"; - this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.компонентыToolStripMenuItem_Click); + компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; + компонентыToolStripMenuItem.Size = new Size(229, 26); + компонентыToolStripMenuItem.Text = "Компоненты"; + компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click; // // пакетыДокументовToolStripMenuItem // - this.пакетыДокументовToolStripMenuItem.Name = "пакетыДокументовToolStripMenuItem"; - this.пакетыДокументовToolStripMenuItem.Size = new System.Drawing.Size(183, 22); - this.пакетыДокументовToolStripMenuItem.Text = "Пакеты документов"; - this.пакетыДокументовToolStripMenuItem.Click += new System.EventHandler(this.пакетыДокументовToolStripMenuItem_Click); + пакетыДокументовToolStripMenuItem.Name = "пакетыДокументовToolStripMenuItem"; + пакетыДокументовToolStripMenuItem.Size = new Size(229, 26); + пакетыДокументовToolStripMenuItem.Text = "Пакеты документов"; + пакетыДокументовToolStripMenuItem.Click += пакетыДокументовToolStripMenuItem_Click; // // клиентыToolStripMenuItem // - this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(183, 22); - this.клиентыToolStripMenuItem.Text = "Клиенты"; - this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click); + клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; + клиентыToolStripMenuItem.Size = new Size(229, 26); + клиентыToolStripMenuItem.Text = "Клиенты"; + клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click; // // отчётыToolStripMenuItem // - this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.списокПакетовДокументовToolStripMenuItem, - this.компонентыПоПакетамДокументовToolStripMenuItem, - this.списокЗаказовToolStripMenuItem}); - this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; - this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20); - this.отчётыToolStripMenuItem.Text = "Отчёты"; + отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокПакетовДокументовToolStripMenuItem, компонентыПоПакетамДокументовToolStripMenuItem, списокЗаказовToolStripMenuItem }); + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(73, 24); + отчётыToolStripMenuItem.Text = "Отчёты"; // // списокПакетовДокументовToolStripMenuItem // - this.списокПакетовДокументовToolStripMenuItem.Name = "списокПакетовДокументовToolStripMenuItem"; - this.списокПакетовДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); - this.списокПакетовДокументовToolStripMenuItem.Text = "Список пакетов документов"; - this.списокПакетовДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокПакетовДокументовToolStripMenuItem_Click); + списокПакетовДокументовToolStripMenuItem.Name = "списокПакетовДокументовToolStripMenuItem"; + списокПакетовДокументовToolStripMenuItem.Size = new Size(351, 26); + списокПакетовДокументовToolStripMenuItem.Text = "Список пакетов документов"; + списокПакетовДокументовToolStripMenuItem.Click += списокПакетовДокументовToolStripMenuItem_Click; // // компонентыПоПакетамДокументовToolStripMenuItem // - this.компонентыПоПакетамДокументовToolStripMenuItem.Name = "компонентыПоПакетамДокументовToolStripMenuItem"; - this.компонентыПоПакетамДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); - this.компонентыПоПакетамДокументовToolStripMenuItem.Text = "Компоненты по пакетам документов"; - this.компонентыПоПакетамДокументовToolStripMenuItem.Click += new System.EventHandler(this.компонентыПоПакетамДокументовToolStripMenuItem_Click); + компонентыПоПакетамДокументовToolStripMenuItem.Name = "компонентыПоПакетамДокументовToolStripMenuItem"; + компонентыПоПакетамДокументовToolStripMenuItem.Size = new Size(351, 26); + компонентыПоПакетамДокументовToolStripMenuItem.Text = "Компоненты по пакетам документов"; + компонентыПоПакетамДокументовToolStripMenuItem.Click += компонентыПоПакетамДокументовToolStripMenuItem_Click; // // списокЗаказовToolStripMenuItem // - this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; - this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); - this.списокЗаказовToolStripMenuItem.Text = "Список заказов"; - this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click); + списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + списокЗаказовToolStripMenuItem.Size = new Size(351, 26); + списокЗаказовToolStripMenuItem.Text = "Список заказов"; + списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // // dataGridView // - this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Location = new System.Drawing.Point(0, 27); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(873, 411); - this.dataGridView.TabIndex = 1; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 36); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(998, 548); + dataGridView.TabIndex = 1; // // buttonCreateOrder // - this.buttonCreateOrder.Location = new System.Drawing.Point(879, 39); - this.buttonCreateOrder.Name = "buttonCreateOrder"; - this.buttonCreateOrder.Size = new System.Drawing.Size(156, 26); - this.buttonCreateOrder.TabIndex = 2; - this.buttonCreateOrder.Text = "Создать заказ"; - this.buttonCreateOrder.UseVisualStyleBackColor = true; - this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click); + buttonCreateOrder.Location = new Point(1005, 52); + buttonCreateOrder.Margin = new Padding(3, 4, 3, 4); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(178, 35); + buttonCreateOrder.TabIndex = 2; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += buttonCreateOrder_Click; // // buttonTakeOrderInWork // - this.buttonTakeOrderInWork.Location = new System.Drawing.Point(879, 71); - this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - this.buttonTakeOrderInWork.Size = new System.Drawing.Size(156, 23); - this.buttonTakeOrderInWork.TabIndex = 3; - this.buttonTakeOrderInWork.Text = "Отдать на выполнение"; - this.buttonTakeOrderInWork.UseVisualStyleBackColor = true; - this.buttonTakeOrderInWork.Click += new System.EventHandler(this.buttonTakeOrderInWork_Click); + buttonTakeOrderInWork.Location = new Point(1005, 95); + buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(178, 31); + buttonTakeOrderInWork.TabIndex = 3; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; // // buttonOrderReady // - this.buttonOrderReady.Location = new System.Drawing.Point(879, 100); - this.buttonOrderReady.Name = "buttonOrderReady"; - this.buttonOrderReady.Size = new System.Drawing.Size(156, 23); - this.buttonOrderReady.TabIndex = 4; - this.buttonOrderReady.Text = "Заказ готов"; - this.buttonOrderReady.UseVisualStyleBackColor = true; - this.buttonOrderReady.Click += new System.EventHandler(this.buttonOrderReady_Click); + buttonOrderReady.Location = new Point(1005, 133); + buttonOrderReady.Margin = new Padding(3, 4, 3, 4); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(178, 31); + buttonOrderReady.TabIndex = 4; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += buttonOrderReady_Click; // // buttonIssuedOrder // - this.buttonIssuedOrder.Location = new System.Drawing.Point(879, 129); - this.buttonIssuedOrder.Name = "buttonIssuedOrder"; - this.buttonIssuedOrder.Size = new System.Drawing.Size(156, 23); - this.buttonIssuedOrder.TabIndex = 5; - this.buttonIssuedOrder.Text = "Заказ выдан"; - this.buttonIssuedOrder.UseVisualStyleBackColor = true; - this.buttonIssuedOrder.Click += new System.EventHandler(this.buttonIssuedOrder_Click); + buttonIssuedOrder.Location = new Point(1005, 172); + buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(178, 31); + buttonIssuedOrder.TabIndex = 5; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += buttonIssuedOrder_Click; // // buttonRef // - this.buttonRef.Location = new System.Drawing.Point(879, 158); - this.buttonRef.Name = "buttonRef"; - this.buttonRef.Size = new System.Drawing.Size(156, 23); - this.buttonRef.TabIndex = 6; - this.buttonRef.Text = "Обновить список"; - this.buttonRef.UseVisualStyleBackColor = true; - this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click); + buttonRef.Location = new Point(1005, 211); + buttonRef.Margin = new Padding(3, 4, 3, 4); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(178, 31); + buttonRef.TabIndex = 6; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += buttonRef_Click; + // + // ЗапускРаботToolStripMenuItem + // + ЗапускРаботToolStripMenuItem.Name = "ЗапускРаботToolStripMenuItem"; + ЗапускРаботToolStripMenuItem.Size = new Size(236, 24); + ЗапускРаботToolStripMenuItem.Text = "ЗапускРаботToolStripMenuItem"; + ЗапускРаботToolStripMenuItem.Click += ЗапускРаботToolStripMenuItem_Click; // // FormMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1047, 477); - this.Controls.Add(this.buttonRef); - this.Controls.Add(this.buttonIssuedOrder); - this.Controls.Add(this.buttonOrderReady); - this.Controls.Add(this.buttonTakeOrderInWork); - this.Controls.Add(this.buttonCreateOrder); - this.Controls.Add(this.dataGridView); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "FormMain"; - this.Text = "FormMain"; - this.Load += new System.EventHandler(this.FormMain_Load); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1197, 636); + Controls.Add(buttonRef); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonOrderReady); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Margin = new Padding(3, 4, 3, 4); + Name = "FormMain"; + Text = "FormMain"; + Load += FormMain_Load; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion @@ -221,5 +230,6 @@ private ToolStripMenuItem компонентыПоПакетамДокументовToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem клиентыToolStripMenuItem; + private ToolStripMenuItem ЗапускРаботToolStripMenuItem; } } \ No newline at end of file diff --git a/LawFirm/LawFirmView/Program.cs b/LawFirm/LawFirmView/Program.cs index 91d1980..5bc46d2 100644 --- a/LawFirm/LawFirmView/Program.cs +++ b/LawFirm/LawFirmView/Program.cs @@ -41,11 +41,14 @@ namespace LawFirmView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -59,6 +62,8 @@ namespace LawFirmView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } }