diff --git a/FurnitureAssembly/FurnitureAssembly/FormShop.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormShop.Designer.cs index d7dc3a8..52d32f1 100644 --- a/FurnitureAssembly/FurnitureAssembly/FormShop.Designer.cs +++ b/FurnitureAssembly/FurnitureAssembly/FormShop.Designer.cs @@ -40,13 +40,15 @@ this.FurnitureId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.FurnitureName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.textBoxMaxCount = new System.Windows.Forms.TextBox(); + this.labelMaxCount = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); // // labelShopName // this.labelShopName.AutoSize = true; - this.labelShopName.Location = new System.Drawing.Point(37, 45); + this.labelShopName.Location = new System.Drawing.Point(35, 22); this.labelShopName.Name = "labelShopName"; this.labelShopName.Size = new System.Drawing.Size(113, 15); this.labelShopName.TabIndex = 0; @@ -54,14 +56,14 @@ // // textBoxName // - this.textBoxName.Location = new System.Drawing.Point(168, 42); + this.textBoxName.Location = new System.Drawing.Point(166, 19); this.textBoxName.Name = "textBoxName"; this.textBoxName.Size = new System.Drawing.Size(282, 23); this.textBoxName.TabIndex = 1; // // textBoxAddress // - this.textBoxAddress.Location = new System.Drawing.Point(168, 83); + this.textBoxAddress.Location = new System.Drawing.Point(166, 60); this.textBoxAddress.Name = "textBoxAddress"; this.textBoxAddress.Size = new System.Drawing.Size(282, 23); this.textBoxAddress.TabIndex = 3; @@ -69,7 +71,7 @@ // labelAddress // this.labelAddress.AutoSize = true; - this.labelAddress.Location = new System.Drawing.Point(37, 86); + this.labelAddress.Location = new System.Drawing.Point(35, 63); this.labelAddress.Name = "labelAddress"; this.labelAddress.Size = new System.Drawing.Size(40, 15); this.labelAddress.TabIndex = 2; @@ -78,7 +80,7 @@ // labelDate // this.labelDate.AutoSize = true; - this.labelDate.Location = new System.Drawing.Point(37, 128); + this.labelDate.Location = new System.Drawing.Point(35, 105); this.labelDate.Name = "labelDate"; this.labelDate.Size = new System.Drawing.Size(87, 15); this.labelDate.TabIndex = 4; @@ -86,7 +88,7 @@ // // dateTimePicker // - this.dateTimePicker.Location = new System.Drawing.Point(168, 122); + this.dateTimePicker.Location = new System.Drawing.Point(166, 99); this.dateTimePicker.Name = "dateTimePicker"; this.dateTimePicker.Size = new System.Drawing.Size(282, 23); this.dateTimePicker.TabIndex = 6; @@ -140,11 +142,29 @@ this.Count.HeaderText = "Количество"; this.Count.Name = "Count"; // + // textBoxMaxCount + // + this.textBoxMaxCount.Location = new System.Drawing.Point(166, 138); + this.textBoxMaxCount.Name = "textBoxMaxCount"; + this.textBoxMaxCount.Size = new System.Drawing.Size(282, 23); + this.textBoxMaxCount.TabIndex = 11; + // + // labelMaxCount + // + this.labelMaxCount.AutoSize = true; + this.labelMaxCount.Location = new System.Drawing.Point(35, 141); + this.labelMaxCount.Name = "labelMaxCount"; + this.labelMaxCount.Size = new System.Drawing.Size(40, 15); + this.labelMaxCount.TabIndex = 10; + this.labelMaxCount.Text = "Адрес"; + // // FormShop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(631, 530); + this.Controls.Add(this.textBoxMaxCount); + this.Controls.Add(this.labelMaxCount); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.ButtonCancel); this.Controls.Add(this.ButtonSave); @@ -177,5 +197,7 @@ private DataGridViewTextBoxColumn FurnitureId; private DataGridViewTextBoxColumn FurnitureName; private DataGridViewTextBoxColumn Count; + private TextBox textBoxMaxCount; + private Label labelMaxCount; } } \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssembly/FormShop.cs b/FurnitureAssembly/FurnitureAssembly/FormShop.cs index 5063508..7702155 100644 --- a/FurnitureAssembly/FurnitureAssembly/FormShop.cs +++ b/FurnitureAssembly/FurnitureAssembly/FormShop.cs @@ -44,6 +44,13 @@ namespace FurnitureAssembly MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + + if (Convert.ToInt32(textBoxMaxCount.Text) <= 0) + { + MessageBox.Show("Некорректная вместимость", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } _logger.LogInformation("Сохранение магазина"); try { @@ -52,6 +59,7 @@ namespace FurnitureAssembly Id = _id ?? 0, ShopName = textBoxName.Text, Address = textBoxAddress.Text, + MaxCount = Convert.ToInt32(textBoxMaxCount.Text), DateOpening = dateTimePicker.Value }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); @@ -94,6 +102,7 @@ namespace FurnitureAssembly textBoxName.Text = view.ShopName; textBoxAddress.Text = view.Address.ToString(); dateTimePicker.Value = view.DateOpening; + textBoxMaxCount.Text = view.MaxCount.ToString(); _shopFurnitures = view.Furnitures ?? new Dictionary(); LoadData();