From fc21e984bf1c3be7502f40a1f2047c99e4f8d12d Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Thu, 14 Mar 2024 19:50:50 +0400 Subject: [PATCH] lab-2-hard Is this win? --- .../BlacksmithWorkshop/FormShop.Designer.cs | 29 +++- .../BlacksmithWorkshop/FormShop.cs | 5 +- .../BlacksmithWorkshop/FormShop.resx | 132 ++++++++++++++++++ .../BlacksmithWorkshop/Program.cs | 3 +- 4 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 BlacksmithWorkshop/BlacksmithWorkshop/FormShop.resx diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.Designer.cs index 509d542..3b7011a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.Designer.cs @@ -41,17 +41,20 @@ textBoxAddress = new TextBox(); buttonSave = new Button(); buttonCancel = new Button(); + CapacityUpDown = new NumericUpDown(); + CapacityLabel = new Label(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)CapacityUpDown).BeginInit(); SuspendLayout(); // // dataGridView // dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnId, ColumnName, ColumnPrice, ColumnCount }); - dataGridView.Location = new Point(12, 101); + dataGridView.Location = new Point(12, 128); dataGridView.Name = "dataGridView"; dataGridView.RowTemplate.Height = 25; - dataGridView.Size = new Size(553, 281); + dataGridView.Size = new Size(553, 254); dataGridView.TabIndex = 0; // // ColumnId @@ -144,6 +147,23 @@ buttonCancel.UseVisualStyleBackColor = true; buttonCancel.Click += CancelButton_Click; // + // CapacityUpDown + // + CapacityUpDown.Location = new Point(150, 92); + CapacityUpDown.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + CapacityUpDown.Name = "CapacityUpDown"; + CapacityUpDown.Size = new Size(166, 23); + CapacityUpDown.TabIndex = 9; + // + // CapacityLabel + // + CapacityLabel.AutoSize = true; + CapacityLabel.Location = new Point(12, 94); + CapacityLabel.Name = "CapacityLabel"; + CapacityLabel.Size = new Size(80, 15); + CapacityLabel.TabIndex = 10; + CapacityLabel.Text = "Вместимость"; + // // FormShop // AutoScaleDimensions = new SizeF(7F, 15F); @@ -158,11 +178,14 @@ Controls.Add(labelName); Controls.Add(dateTimePicker); Controls.Add(dataGridView); + Controls.Add(CapacityLabel); + Controls.Add(CapacityUpDown); Name = "FormShop"; StartPosition = FormStartPosition.CenterParent; Text = "Магазин"; Load += FormShop_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)CapacityUpDown).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -182,5 +205,7 @@ private DataGridViewTextBoxColumn ColumnCount; private Button buttonSave; private Button buttonCancel; + private NumericUpDown CapacityUpDown; + private Label CapacityLabel; } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.cs index 33eeeb4..bc29ad2 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.cs @@ -42,7 +42,8 @@ namespace BlacksmithWorkshop textBoxName.Text = shop.ShopName; textBoxAddress.Text = shop.Address; dateTimePicker.Text = shop.OpeningDate.ToString(); - _manufactures = shop.ShopManufactures; + _manufactures = shop.ShopManufactures ?? new Dictionary(); + CapacityUpDown.Value = shop.MaxCapacity; } LoadData(); } @@ -101,7 +102,7 @@ namespace BlacksmithWorkshop ShopName = textBoxName.Text, Address = textBoxAddress.Text, OpeningDate = dateTimePicker.Value.Date, - ShopManufactures = _manufactures + MaxCapacity = Convert.ToInt32(CapacityUpDown.Value) }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); if (!operationResult) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.resx new file mode 100644 index 0000000..b0c7c5d --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormShop.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index 81e1e01..4addc8a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -1,7 +1,7 @@ using BlacksmithWorkshopBusinessLogic.BusinessLogics; using BlacksmithWorkshopContracts.BusinessLogicsContracts; using BlacksmithWorkshopContracts.StoragesContracts; -using BlacksmithWorkshopListImplement.Implements; +using BlacksmithWorkshopFileImplement.Implements; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; @@ -52,6 +52,7 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file