diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/OrderBindingModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/OrderBindingModel.cs index e3fa2fd..2f25f6d 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/OrderBindingModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/OrderBindingModel.cs @@ -12,7 +12,8 @@ namespace AbstractLawFirmContracts.BindingModels { public int Id { get; set; } public int DocumentId { get; set; } - public int Count { get; set; } + public int ClientId { get; set; } + public int Count { get; set; } public double Sum { get; set; } public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public DateTime DateCreate { get; set; } = DateTime.Now; diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/SearchModels/OrderSearchModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/SearchModels/OrderSearchModel.cs index 02604d4..d78a23c 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/SearchModels/OrderSearchModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/SearchModels/OrderSearchModel.cs @@ -11,5 +11,6 @@ namespace AbstractLawFirmContracts.SearchModels public int? Id { get; set; } public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set; } + public int? ClientId { get; set; } } } diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/OrderViewModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/OrderViewModel.cs index 2acfb53..5a0770d 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/OrderViewModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/OrderViewModel.cs @@ -16,6 +16,9 @@ namespace AbstractLawFirmContracts.ViewModels public int DocumentId { get; set; } [DisplayName("Пакет документов")] public string DocumentName { get; set; } = string.Empty; + public int ClientId { get; set; } + [DisplayName("ФИО клиента")] + public string ClientFIO { get; set; } = string.Empty; [DisplayName("Количество")] public int Count { get; set; } [DisplayName("Сумма")] diff --git a/LawFirm/AbstractLawFirmDataModels/AbstractLawFirmDataModels/Models/IOrderModel.cs b/LawFirm/AbstractLawFirmDataModels/AbstractLawFirmDataModels/Models/IOrderModel.cs index 126df76..d0cdd09 100644 --- a/LawFirm/AbstractLawFirmDataModels/AbstractLawFirmDataModels/Models/IOrderModel.cs +++ b/LawFirm/AbstractLawFirmDataModels/AbstractLawFirmDataModels/Models/IOrderModel.cs @@ -11,6 +11,7 @@ namespace AbstractLawFirmDataModels.Models public interface IOrderModel : IId { int DocumentId { get; } + int ClientId { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs b/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs index 863d9a1..9b6c81e 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/AbstractLawFirmDataBase.cs @@ -23,6 +23,7 @@ namespace AbstractLawFirmDataBaseImplement public virtual DbSet Documents { set; get; } public virtual DbSet DocumentComponents { set; get; } public virtual DbSet Orders { set; get; } + public virtual DbSet Clients { set; get; } } } diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ClientStorage.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ClientStorage.cs new file mode 100644 index 0000000..3c90321 --- /dev/null +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/ClientStorage.cs @@ -0,0 +1,85 @@ +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 ClientStorage : IClientStorage + { + public ClientViewModel? GetElement(ClientSearchModel model) + { + if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue) + { + return null; + } + using var context = new AbstractLawFirmDatabase(); + return context.Clients.FirstOrDefault(x => + (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email) + || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + + public List GetFilteredList(ClientSearchModel model) + { + if (string.IsNullOrEmpty(model.Email)) + { + return new(); + } + using var context = new AbstractLawFirmDatabase(); + return context.Clients + .Where(x => x.Email.Contains(model.Email)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new AbstractLawFirmDatabase(); + return context.Clients.Select(x => x.GetViewModel).ToList(); + } + + public ClientViewModel? Insert(ClientBindingModel model) + { + var newClient = Client.Create(model); + if (newClient == null) + { + return null; + } + using var context = new AbstractLawFirmDatabase(); + context.Clients.Add(newClient); + context.SaveChanges(); + return newClient.GetViewModel; + } + + public ClientViewModel? Update(ClientBindingModel model) + { + using var context = new AbstractLawFirmDatabase(); + var client = context.Clients.FirstOrDefault(x => x.Id == model.Id); + if (client == null) + { + return null; + } + client.Update(model); + context.SaveChanges(); + return client.GetViewModel; + } + public ClientViewModel? Delete(ClientBindingModel model) + { + using var context = new AbstractLawFirmDatabase(); + var client = context.Clients.FirstOrDefault(x => x.Id == model.Id); + if (client == null) + { + return null; + } + context.Clients.Remove(client); + context.SaveChanges(); + return client.GetViewModel; + } + } +} diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs index e1c1ac3..ace0bdf 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs @@ -28,14 +28,15 @@ namespace AbstractLawFirmDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) + if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue) { return new(); } using var context = new AbstractLawFirmDatabase(); return context.Orders - .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo) + .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo || x.ClientId == model.ClientId) .Include(x => x.Document) + .Include(x => x.Client) .Select(x => x.GetViewModel) .ToList(); } @@ -43,7 +44,7 @@ namespace AbstractLawFirmDatabaseImplement.Implements public List GetFullList() { using var context = new AbstractLawFirmDatabase(); - return context.Orders.Include(x => x.Document).Select(x => x.GetViewModel).ToList(); + return context.Orders.Include(x => x.Document).Include(x => x.Client).Select(x => x.GetViewModel).ToList(); } public OrderViewModel? Insert(OrderBindingModel model) @@ -56,7 +57,7 @@ namespace AbstractLawFirmDatabaseImplement.Implements using var context = new AbstractLawFirmDatabase(); context.Orders.Add(newOrder); context.SaveChanges(); - return context.Orders.Include(x => x.Document).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel; + return context.Orders.Include(x => x.Document).Include(x => x.Client).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel; } public OrderViewModel? Update(OrderBindingModel model) @@ -69,7 +70,7 @@ namespace AbstractLawFirmDatabaseImplement.Implements } order.Update(model); context.SaveChanges(); - return context.Orders.Include(x => x.Document).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + return context.Orders.Include(x => x.Document).Include(x => x.Client).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; } public OrderViewModel? Delete(OrderBindingModel model) { diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Models/Client.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Client.cs new file mode 100644 index 0000000..9688e19 --- /dev/null +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Client.cs @@ -0,0 +1,65 @@ +using AbstractLawFirmDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AbstractLawFirmDatabaseImplement.Models; +using AbstractLawFirmContracts.BindingModels; +using AbstractLawFirmContracts.ViewModels; + +namespace AbstractLawFirmDataBaseImplement.Models +{ + public class Client : IClientModel + { + public int Id { get; private set; } + + [Required] + public string ClientFIO { get; private set; } = string.Empty; + + [Required] + public string Email { get; private set; } = string.Empty; + + [Required] + public string Password { get; private set; } = string.Empty; + + [ForeignKey("ClientId")] + public virtual List Orders { get; set; } = new(); + + public static Client? Create(ClientBindingModel model) + { + if (model == null) + { + return null; + } + return new() + { + Id = model.Id, + ClientFIO = model.ClientFIO, + Email = model.Email, + Password = model.Password + }; + } + + public void Update(ClientBindingModel model) + { + if (model == null) + { + return; + } + ClientFIO = model.ClientFIO; + Email = model.Email; + Password = model.Password; + } + + public ClientViewModel GetViewModel => new() + { + Id = Id, + ClientFIO = ClientFIO, + Email = Email, + Password = Password, + }; + } +} diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Models/Order.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Order.cs index dfed9cd..cd148bd 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Models/Order.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Models/Order.cs @@ -1,5 +1,6 @@ using AbstractLawFirmContracts.BindingModels; using AbstractLawFirmContracts.ViewModels; +using AbstractLawFirmDataBaseImplement.Models; using AbstractLawFirmDataModels.Enums; using AbstractLawFirmDataModels.Models; using System; @@ -17,6 +18,8 @@ namespace AbstractLawFirmDatabaseImplement.Models [Required] public int DocumentId { get; private set; } [Required] + public int ClientId { get; private set; } + [Required] public int Count { get; private set; } [Required] public double Sum { get; private set; } @@ -27,6 +30,7 @@ namespace AbstractLawFirmDatabaseImplement.Models public DateTime? DateImplement { get; private set; } public virtual Document Document { get; set; } + public virtual Client Client { get; set; } public static Order? Create(OrderBindingModel? model) { @@ -37,6 +41,7 @@ namespace AbstractLawFirmDatabaseImplement.Models return new Order { DocumentId = model.DocumentId, + ClientId = model.ClientId, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -59,13 +64,15 @@ namespace AbstractLawFirmDatabaseImplement.Models public OrderViewModel GetViewModel => new OrderViewModel { DocumentId = DocumentId, + ClientId = ClientId, Count = Count, Sum = Sum, DateCreate = DateCreate, DateImplement = DateImplement, Id = Id, Status = Status, - DocumentName = Document?.DocumentName ?? string.Empty // Безопасное использование DocumentName + DocumentName = Document?.DocumentName ?? string.Empty, + ClientFIO = Client.ClientFIO }; } } \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmFileImpliment/Models/Order.cs b/LawFirm/AbstractLawFirmFileImpliment/Models/Order.cs index fe2eb6f..cfb1552 100644 --- a/LawFirm/AbstractLawFirmFileImpliment/Models/Order.cs +++ b/LawFirm/AbstractLawFirmFileImpliment/Models/Order.cs @@ -16,6 +16,7 @@ namespace AbstractLawFirmFileImplement.Models { public int Id { get; private set; } public int DocumentId { get; private set; } + public int ClientId { get; private set; } public int Count { get; private set; } public double Sum { get; private set; } public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; diff --git a/LawFirm/AbstractLawFirmListImplement/Models/Order.cs b/LawFirm/AbstractLawFirmListImplement/Models/Order.cs index f2c291d..368d1ed 100644 --- a/LawFirm/AbstractLawFirmListImplement/Models/Order.cs +++ b/LawFirm/AbstractLawFirmListImplement/Models/Order.cs @@ -14,6 +14,7 @@ namespace AbstractLawFirmListImplement.Models { public int Id { get; private set; } public int DocumentId { get; private set; } + public int ClientId { get; private set; } public int Count { get; private set; } public double Sum { get; private set; } public OrderStatus Status { get; private set; } diff --git a/LawFirm/LawFirmView/FormCreateOrder.cs b/LawFirm/LawFirmView/FormCreateOrder.cs index 6f6a410..3a0084f 100644 --- a/LawFirm/LawFirmView/FormCreateOrder.cs +++ b/LawFirm/LawFirmView/FormCreateOrder.cs @@ -19,12 +19,14 @@ namespace LawFirmView private readonly ILogger _logger; private readonly IDocumentLogic _logicD; private readonly IOrderLogic _logicO; - public FormCreateOrder(ILogger logger, IDocumentLogic logicD, IOrderLogic logicO) + private readonly IClientLogic _logicC; + public FormCreateOrder(ILogger logger, IDocumentLogic logicD, IOrderLogic logicO, IClientLogic logicC) { InitializeComponent(); _logger = logger; _logicD = logicD; _logicO = logicO; + _logicC = logicC; } private void FormCreateOrder_Load(object sender, EventArgs e) @@ -48,6 +50,24 @@ namespace LawFirmView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } + _logger.LogInformation("Загрузка клиентов для заказа"); + try + { + var list = _logicC.ReadList(null); + if (list != null) + { + comboBoxClient.DisplayMember = "ClientFIO"; + comboBoxClient.ValueMember = "Id"; + comboBoxClient.DataSource = list; + comboBoxClient.SelectedItem = null; + } + + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка клиентов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void CalcSum() { @@ -105,12 +125,18 @@ namespace LawFirmView MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + if (comboBoxClient.SelectedValue == null) + { + MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } _logger.LogInformation("Создание заказа"); try { var operationResult = _logicO.CreateOrder(new OrderBindingModel { DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue), + ClientId = Convert.ToInt32(comboBoxClient.SelectedValue), Count = Convert.ToInt32(textBoxCount.Text), Sum = Convert.ToDouble(textBoxSum.Text) }); diff --git a/LawFirm/LawFirmView/FormCreateOrder.designer.cs b/LawFirm/LawFirmView/FormCreateOrder.designer.cs index 8837e68..68c379e 100644 --- a/LawFirm/LawFirmView/FormCreateOrder.designer.cs +++ b/LawFirm/LawFirmView/FormCreateOrder.designer.cs @@ -36,12 +36,14 @@ label3 = new Label(); buttonSave = new Button(); buttonCancel = new Button(); + comboBoxClient = new ComboBox(); + label4 = new Label(); SuspendLayout(); // // comboBoxDocument // comboBoxDocument.FormattingEnabled = true; - comboBoxDocument.Location = new Point(133, 16); + comboBoxDocument.Location = new Point(147, 16); comboBoxDocument.Margin = new Padding(3, 4, 3, 4); comboBoxDocument.Name = "comboBoxDocument"; comboBoxDocument.Size = new Size(226, 28); @@ -50,7 +52,7 @@ // // textBoxCount // - textBoxCount.Location = new Point(133, 55); + textBoxCount.Location = new Point(147, 52); textBoxCount.Margin = new Padding(3, 4, 3, 4); textBoxCount.Name = "textBoxCount"; textBoxCount.Size = new Size(226, 27); @@ -59,7 +61,7 @@ // // textBoxSum // - textBoxSum.Location = new Point(133, 93); + textBoxSum.Location = new Point(147, 93); textBoxSum.Margin = new Padding(3, 4, 3, 4); textBoxSum.Name = "textBoxSum"; textBoxSum.Size = new Size(226, 27); @@ -115,11 +117,30 @@ buttonCancel.UseVisualStyleBackColor = true; buttonCancel.Click += buttonCancel_Click; // + // comboBoxClient + // + comboBoxClient.FormattingEnabled = true; + comboBoxClient.Location = new Point(147, 128); + comboBoxClient.Name = "comboBoxClient"; + comboBoxClient.Size = new Size(226, 28); + comboBoxClient.TabIndex = 8; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(3, 131); + label4.Name = "label4"; + label4.Size = new Size(61, 20); + label4.TabIndex = 9; + label4.Text = "Клиент:"; + // // FormCreateOrder // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(509, 211); + Controls.Add(label4); + Controls.Add(comboBoxClient); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(label3); @@ -146,5 +167,7 @@ private Label label3; private Button buttonSave; private Button buttonCancel; + private ComboBox comboBoxClient; + private Label label4; } } \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormMain.cs b/LawFirm/LawFirmView/FormMain.cs index 4b76a3b..9af50dd 100644 --- a/LawFirm/LawFirmView/FormMain.cs +++ b/LawFirm/LawFirmView/FormMain.cs @@ -34,7 +34,8 @@ namespace LawFirmView { dataGridView.DataSource = list; dataGridView.Columns["DocumentId"].Visible = false; - dataGridView.Columns["DocumentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["ClientId"].Visible = false; + } _logger.LogInformation("Загрузка заказов"); } @@ -204,5 +205,14 @@ namespace LawFirmView form.ShowDialog(); } } + + private void клиентыToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormClients)); + if (service is FormClients form) + { + form.ShowDialog(); + } + } } } \ No newline at end of file diff --git a/LawFirm/LawFirmView/FormMain.designer.cs b/LawFirm/LawFirmView/FormMain.designer.cs index a727f61..3ee65d4 100644 --- a/LawFirm/LawFirmView/FormMain.designer.cs +++ b/LawFirm/LawFirmView/FormMain.designer.cs @@ -28,172 +28,180 @@ /// private void InitializeComponent() { - menuStrip1 = new MenuStrip(); - toolStripMenuItemCatalogs = 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(); - списокЗаказовToolStripMenuItem1 = new ToolStripMenuItem(); - списокПакетовToolStripMenuItem = new ToolStripMenuItem(); - компонентыПоПакетамToolStripMenuItem = new ToolStripMenuItem(); - menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - SuspendLayout(); + 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 // - menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItemCatalogs, отчётыToolStripMenuItem }); - menuStrip1.Location = new Point(0, 0); - menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(7, 3, 0, 3); - menuStrip1.Size = new Size(1040, 30); - menuStrip1.TabIndex = 0; - menuStrip1.Text = "Справочники"; + 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 = "Справочники"; // // toolStripMenuItemCatalogs // - toolStripMenuItemCatalogs.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, пакетыДокументовToolStripMenuItem }); - toolStripMenuItemCatalogs.Name = "toolStripMenuItemCatalogs"; - toolStripMenuItemCatalogs.Size = new Size(117, 24); - toolStripMenuItemCatalogs.Text = "Справочники"; + 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 = "Справочники"; // // компонентыToolStripMenuItem // - компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - компонентыToolStripMenuItem.Size = new Size(259, 26); - компонентыToolStripMenuItem.Text = "Компоненты"; - компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click; + 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 // - пакетыДокументовToolStripMenuItem.Name = "пакетыДокументовToolStripMenuItem"; - пакетыДокументовToolStripMenuItem.Size = new Size(259, 26); - пакетыДокументовToolStripMenuItem.Text = "Пакеты документов"; - пакетыДокументовToolStripMenuItem.Click += пакетыДокументовToolStripMenuItem_Click; + 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); // - // dataGridView + // клиентыToolStripMenuItem // - 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(841, 548); - dataGridView.TabIndex = 1; - // - // buttonCreateOrder - // - buttonCreateOrder.Location = new Point(848, 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 - // - buttonTakeOrderInWork.Location = new Point(848, 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 - // - buttonOrderReady.Location = new Point(848, 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 - // - buttonIssuedOrder.Location = new Point(848, 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 - // - buttonRef.Location = new Point(848, 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; + 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 // - отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокЗаказовToolStripMenuItem1, списокПакетовToolStripMenuItem, компонентыПоПакетамToolStripMenuItem }); - отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; - отчётыToolStripMenuItem.Size = new Size(73, 24); - отчётыToolStripMenuItem.Text = "Отчёты"; + 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 = "Отчёты"; // - // списокЗаказовToolStripMenuItem1 + // списокПакетовДокументовToolStripMenuItem // - списокЗаказовToolStripMenuItem1.Name = "списокЗаказовToolStripMenuItem1"; - списокЗаказовToolStripMenuItem1.Size = new Size(265, 26); - списокЗаказовToolStripMenuItem1.Text = "Список заказов"; - списокЗаказовToolStripMenuItem1.Click += списокЗаказовToolStripMenuItem_Click; + 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 + // компонентыПоПакетамДокументовToolStripMenuItem // - списокПакетовToolStripMenuItem.Name = "списокПакетовToolStripMenuItem"; - списокПакетовToolStripMenuItem.Size = new Size(265, 26); - списокПакетовToolStripMenuItem.Text = "Список пакетов"; - списокПакетовToolStripMenuItem.Click += списокПакетовДокументовToolStripMenuItem_Click; + 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 + // списокЗаказовToolStripMenuItem // - компонентыПоПакетамToolStripMenuItem.Name = "компонентыПоПакетамToolStripMenuItem"; - компонентыПоПакетамToolStripMenuItem.Size = new Size(265, 26); - компонентыПоПакетамToolStripMenuItem.Text = "Компоненты по пакетам"; - компонентыПоПакетамToolStripMenuItem.Click += компонентыПоПакетамДокументовToolStripMenuItem_Click; + 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); + // + // 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; + // + // 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); + // + // 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); + // + // 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); + // + // 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); + // + // 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); // // FormMain // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1040, 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(); + 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(); + } #endregion @@ -209,8 +217,9 @@ private Button buttonIssuedOrder; private Button buttonRef; private ToolStripMenuItem отчётыToolStripMenuItem; - private ToolStripMenuItem списокЗаказовToolStripMenuItem1; - private ToolStripMenuItem списокПакетовToolStripMenuItem; - private ToolStripMenuItem компонентыПоПакетамToolStripMenuItem; + 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 d655516..91d1980 100644 --- a/LawFirm/LawFirmView/Program.cs +++ b/LawFirm/LawFirmView/Program.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; using System; +using AbstractLawFirmDataBaseImplement.Implements; namespace LawFirmView { @@ -39,7 +40,9 @@ namespace LawFirmView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -49,6 +52,7 @@ namespace LawFirmView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient();