From bb968d63f911d4cb43624d41446c1d91f4890daf Mon Sep 17 00:00:00 2001 From: Safgerd Date: Sat, 25 Mar 2023 21:40:02 +0400 Subject: [PATCH] =?UTF-8?q?LabWork01=5FHard:=20=D0=9B=D0=B0=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=81=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0,=20=D1=84=D0=B8=D0=BA=D1=81=D1=8B=20=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8B=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutomobilePlant/FormShop.Designer.cs | 61 +++++++++++------- AutomobilePlant/AutomobilePlant/FormShop.cs | 4 +- AutomobilePlant/AutomobilePlant/FormShop.resx | 62 +------------------ .../BusinessLogics/ShopLogic.cs | 1 - .../BindingModels/ShopBindingModel.cs | 4 +- .../ViewModels/ShopViewModel.cs | 4 +- .../Models/IShopModel.cs | 2 +- .../Models/Shop.cs | 6 +- 8 files changed, 52 insertions(+), 92 deletions(-) diff --git a/AutomobilePlant/AutomobilePlant/FormShop.Designer.cs b/AutomobilePlant/AutomobilePlant/FormShop.Designer.cs index 886a469..b6707aa 100644 --- a/AutomobilePlant/AutomobilePlant/FormShop.Designer.cs +++ b/AutomobilePlant/AutomobilePlant/FormShop.Designer.cs @@ -38,40 +38,40 @@ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonSave = new System.Windows.Forms.Button(); + this.foundingDateLabel = new System.Windows.Forms.Label(); + this.foundingDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); // // textBoxAddress // - this.textBoxAddress.Location = new System.Drawing.Point(88, 34); - this.textBoxAddress.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxAddress.Location = new System.Drawing.Point(101, 45); this.textBoxAddress.Name = "textBoxAddress"; - this.textBoxAddress.Size = new System.Drawing.Size(276, 23); + this.textBoxAddress.Size = new System.Drawing.Size(315, 27); this.textBoxAddress.TabIndex = 7; // // textBoxName // - this.textBoxName.Location = new System.Drawing.Point(88, 9); - this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Location = new System.Drawing.Point(101, 12); this.textBoxName.Name = "textBoxName"; - this.textBoxName.Size = new System.Drawing.Size(276, 23); + this.textBoxName.Size = new System.Drawing.Size(315, 27); this.textBoxName.TabIndex = 6; // // labelAddress // this.labelAddress.AutoSize = true; - this.labelAddress.Location = new System.Drawing.Point(12, 38); + this.labelAddress.Location = new System.Drawing.Point(14, 51); this.labelAddress.Name = "labelAddress"; - this.labelAddress.Size = new System.Drawing.Size(43, 15); + this.labelAddress.Size = new System.Drawing.Size(54, 20); this.labelAddress.TabIndex = 5; this.labelAddress.Text = "Адрес:"; // // labelName // this.labelName.AutoSize = true; - this.labelName.Location = new System.Drawing.Point(12, 11); + this.labelName.Location = new System.Drawing.Point(14, 15); this.labelName.Name = "labelName"; - this.labelName.Size = new System.Drawing.Size(62, 15); + this.labelName.Size = new System.Drawing.Size(80, 20); this.labelName.TabIndex = 4; this.labelName.Text = "Название:"; // @@ -82,12 +82,11 @@ this.ColumnId, this.ColumnCarName, this.ColumnCount}); - this.dataGridView.Location = new System.Drawing.Point(12, 61); - this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.dataGridView.Location = new System.Drawing.Point(14, 127); this.dataGridView.Name = "dataGridView"; this.dataGridView.RowHeadersWidth = 51; this.dataGridView.RowTemplate.Height = 29; - this.dataGridView.Size = new System.Drawing.Size(351, 251); + this.dataGridView.Size = new System.Drawing.Size(401, 289); this.dataGridView.TabIndex = 10; // // ColumnId @@ -114,10 +113,9 @@ // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point(200, 327); - this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCancel.Location = new System.Drawing.Point(229, 436); this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(136, 31); + this.buttonCancel.Size = new System.Drawing.Size(155, 41); this.buttonCancel.TabIndex = 12; this.buttonCancel.Text = "Отмена"; this.buttonCancel.UseVisualStyleBackColor = true; @@ -125,20 +123,37 @@ // // buttonSave // - this.buttonSave.Location = new System.Drawing.Point(42, 327); - this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonSave.Location = new System.Drawing.Point(48, 436); this.buttonSave.Name = "buttonSave"; - this.buttonSave.Size = new System.Drawing.Size(136, 31); + this.buttonSave.Size = new System.Drawing.Size(155, 41); this.buttonSave.TabIndex = 11; this.buttonSave.Text = "Сохранить"; this.buttonSave.UseVisualStyleBackColor = true; this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); // + // foundingDateLabel + // + this.foundingDateLabel.AutoSize = true; + this.foundingDateLabel.Location = new System.Drawing.Point(14, 83); + this.foundingDateLabel.Name = "foundingDateLabel"; + this.foundingDateLabel.Size = new System.Drawing.Size(121, 20); + this.foundingDateLabel.TabIndex = 13; + this.foundingDateLabel.Text = "Дата основания"; + // + // foundingDateTimePicker + // + this.foundingDateTimePicker.Location = new System.Drawing.Point(141, 78); + this.foundingDateTimePicker.Name = "foundingDateTimePicker"; + this.foundingDateTimePicker.Size = new System.Drawing.Size(274, 27); + this.foundingDateTimePicker.TabIndex = 14; + // // FormShop // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(389, 367); + this.ClientSize = new System.Drawing.Size(445, 489); + this.Controls.Add(this.foundingDateTimePicker); + this.Controls.Add(this.foundingDateLabel); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonSave); this.Controls.Add(this.dataGridView); @@ -146,13 +161,13 @@ this.Controls.Add(this.textBoxName); this.Controls.Add(this.labelAddress); this.Controls.Add(this.labelName); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "FormShop"; this.Text = "Магазин"; this.Load += new System.EventHandler(this.FormShop_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); + } #endregion @@ -167,5 +182,7 @@ private DataGridViewTextBoxColumn ColumnId; private DataGridViewTextBoxColumn ColumnCarName; private DataGridViewTextBoxColumn ColumnCount; + private Label foundingDateLabel; + private DateTimePicker foundingDateTimePicker; } } \ No newline at end of file diff --git a/AutomobilePlant/AutomobilePlant/FormShop.cs b/AutomobilePlant/AutomobilePlant/FormShop.cs index aa52a7a..f23363b 100644 --- a/AutomobilePlant/AutomobilePlant/FormShop.cs +++ b/AutomobilePlant/AutomobilePlant/FormShop.cs @@ -45,6 +45,7 @@ namespace AutomobilePlant { textBoxName.Text = view.Name; textBoxAddress.Text = view.Address; + foundingDateTimePicker.Value = view.FoundingDate; _shopCars = view.ShopCars ?? new Dictionary(); LoadData(); } @@ -102,7 +103,8 @@ namespace AutomobilePlant Id = _id ?? 0, Name = textBoxName.Text, Address = textBoxAddress.Text, - OpeningDate = DateTime.Now + FoundingDate = foundingDateTimePicker.Value.Date, + ShopCars= _shopCars }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); diff --git a/AutomobilePlant/AutomobilePlant/FormShop.resx b/AutomobilePlant/AutomobilePlant/FormShop.resx index 1af7de1..f298a7b 100644 --- a/AutomobilePlant/AutomobilePlant/FormShop.resx +++ b/AutomobilePlant/AutomobilePlant/FormShop.resx @@ -1,64 +1,4 @@ - - - + diff --git a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/ShopLogic.cs b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/ShopLogic.cs index 6294354..0c939bb 100644 --- a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/ShopLogic.cs +++ b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/ShopLogic.cs @@ -104,7 +104,6 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics Id = shopElement.Id, Name = shopElement.Name, Address = shopElement.Address, - OpeningDate = shopElement.OpeningDate, ShopCars = shopElement.ShopCars }); diff --git a/AutomobilePlant/AutomobilePlantContracts/BindingModels/ShopBindingModel.cs b/AutomobilePlant/AutomobilePlantContracts/BindingModels/ShopBindingModel.cs index f975864..3e24460 100644 --- a/AutomobilePlant/AutomobilePlantContracts/BindingModels/ShopBindingModel.cs +++ b/AutomobilePlant/AutomobilePlantContracts/BindingModels/ShopBindingModel.cs @@ -14,8 +14,8 @@ namespace AutomobilePlantContracts.BindingModels public string Name { get; set; } = string.Empty; public string Address { get; set; } = string.Empty; - - public DateTime OpeningDate { get; set; } + + public DateTime FoundingDate { get; set; } public Dictionary ShopCars { get; set; } } diff --git a/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs b/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs index 9566b0d..bceed02 100644 --- a/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs +++ b/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs @@ -18,8 +18,8 @@ namespace AutomobilePlantContracts.ViewModels [DisplayName("Адрес")] public string Address { get; set; } = string.Empty; - [DisplayName("Дата открытия")] - public DateTime OpeningDate { get; set; } + [DisplayName("Дата основания")] + public DateTime FoundingDate { get; set; } public Dictionary ShopCars { get; set; } = new(); } diff --git a/AutomobilePlant/AutomobilePlantDataModels/Models/IShopModel.cs b/AutomobilePlant/AutomobilePlantDataModels/Models/IShopModel.cs index 8ee298b..2b3d610 100644 --- a/AutomobilePlant/AutomobilePlantDataModels/Models/IShopModel.cs +++ b/AutomobilePlant/AutomobilePlantDataModels/Models/IShopModel.cs @@ -10,7 +10,7 @@ namespace AutomobilePlantDataModels.Models { string Name { get; } string Address { get; } - DateTime OpeningDate { get; } + DateTime FoundingDate { get; } Dictionary ShopCars { get; } } } diff --git a/AutomobilePlant/AutomobilePlantListImplements/Models/Shop.cs b/AutomobilePlant/AutomobilePlantListImplements/Models/Shop.cs index 6de3c15..438bd8a 100644 --- a/AutomobilePlant/AutomobilePlantListImplements/Models/Shop.cs +++ b/AutomobilePlant/AutomobilePlantListImplements/Models/Shop.cs @@ -18,6 +18,8 @@ namespace AutomobilePlantListImplements.Models public string Address { get; private set; } = string.Empty; public DateTime OpeningDate { get; private set; } + + public DateTime FoundingDate { get; private set; } public Dictionary ShopCars { get; private set; } = new(); @@ -33,7 +35,7 @@ namespace AutomobilePlantListImplements.Models Id = model.Id, Name = model.Name, Address = model.Address, - OpeningDate = model.OpeningDate, + FoundingDate = model.FoundingDate, ShopCars = new() }; } @@ -55,7 +57,7 @@ namespace AutomobilePlantListImplements.Models Id = Id, Name = Name, Address = Address, - OpeningDate = OpeningDate, + FoundingDate = FoundingDate, ShopCars = ShopCars }; }