diff --git a/ProjectOpticsStore/ProjectOpticsStore/Entities/Product.cs b/ProjectOpticsStore/ProjectOpticsStore/Entities/Product.cs index bc14611..d80ea3b 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Entities/Product.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Entities/Product.cs @@ -6,11 +6,11 @@ public class Product public ProductTypeEnum Type { get; private set; } public double Power { get; private set; } public int Price { get; private set; } - public int StoreId { get; private set; } + public int Store { get; private set; } public float Thickness { get; private set; } public string Disease { get; private set; } = string.Empty; - public static Product CreateEntity(int id, ProductTypeEnum type, double power, int price, int storeId, float thickness, string disease) + public static Product CreateEntity(int id, ProductTypeEnum type, double power, int price, int store, float thickness, string disease) { return new Product { @@ -18,7 +18,7 @@ public class Product Type = type, Power = power, Price = price, - StoreId = storeId, + Store = store, Thickness = thickness, Disease = disease ?? string.Empty }; diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.Designer.cs index 23a697d..12090e8 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.Designer.cs @@ -85,6 +85,7 @@ // dataGridViewData.AllowUserToAddRows = false; dataGridViewData.AllowUserToDeleteRows = false; + dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewData.Dock = DockStyle.Fill; dataGridViewData.Location = new Point(0, 0); diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.cs index 098e594..fb421c0 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormCustomers.cs @@ -1,5 +1,4 @@ using ProjectOpticsStore.Repositories; -using ProjectOpticsStore.Repositories.Implementations; using Unity; namespace ProjectOpticsStore.Forms; diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.Designer.cs index 052b7fc..8c8ba74 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.Designer.cs @@ -72,6 +72,7 @@ // dataGridViewOrders.AllowUserToAddRows = false; dataGridViewOrders.AllowUserToDeleteRows = false; + dataGridViewOrders.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridViewOrders.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewOrders.Dock = DockStyle.Fill; dataGridViewOrders.Location = new Point(0, 0); diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.cs index 8980d0b..5b6f721 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormOrders.cs @@ -1,7 +1,4 @@ using ProjectOpticsStore.Repositories; -using ProjectOpticsStore.Entities; -using ProjectOpticsStore.Repositories.Implementations; - namespace ProjectOpticsStore.Forms; public partial class FormOrders : Form diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.Designer.cs index a379967..b920a82 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.Designer.cs @@ -39,9 +39,9 @@ label6 = new Label(); textBoxPower = new TextBox(); textBoxPrice = new TextBox(); - textBoxStoreID = new TextBox(); textBoxThickness = new TextBox(); textBoxDisease = new TextBox(); + comboBoxStore = new ComboBox(); SuspendLayout(); // // buttonSave @@ -140,13 +140,6 @@ textBoxPrice.Size = new Size(254, 27); textBoxPrice.TabIndex = 12; // - // textBoxStoreID - // - textBoxStoreID.Location = new Point(157, 284); - textBoxStoreID.Name = "textBoxStoreID"; - textBoxStoreID.Size = new Size(254, 27); - textBoxStoreID.TabIndex = 13; - // // textBoxThickness // textBoxThickness.Location = new Point(157, 349); @@ -162,14 +155,23 @@ textBoxDisease.Size = new Size(254, 67); textBoxDisease.TabIndex = 15; // + // comboBoxStore + // + comboBoxStore.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStore.FormattingEnabled = true; + comboBoxStore.Location = new Point(157, 287); + comboBoxStore.Name = "comboBoxStore"; + comboBoxStore.Size = new Size(254, 28); + comboBoxStore.TabIndex = 16; + // // FormProduct // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(436, 545); + Controls.Add(comboBoxStore); Controls.Add(textBoxDisease); Controls.Add(textBoxThickness); - Controls.Add(textBoxStoreID); Controls.Add(textBoxPrice); Controls.Add(textBoxPower); Controls.Add(label6); @@ -200,8 +202,8 @@ private Label label6; private TextBox textBoxPower; private TextBox textBoxPrice; - private TextBox textBoxStoreID; private TextBox textBoxThickness; private TextBox textBoxDisease; + private ComboBox comboBoxStore; } } \ No newline at end of file diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.cs index 72069c6..3381bda 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProduct.cs @@ -34,7 +34,7 @@ public partial class FormProduct : Form // Заполнение текстовых полей textBoxPower.Text = product.Power.ToString(); textBoxPrice.Text = product.Price.ToString(); - textBoxStoreID.Text = product.StoreId.ToString(); + comboBoxStore.Text = product.Store.ToString(); textBoxThickness.Text = product.Thickness.ToString("F2"); textBoxDisease.Text = product.Disease; @@ -68,7 +68,7 @@ public partial class FormProduct : Form if (checkedListBoxProductType.CheckedItems.Count == 0 || string.IsNullOrWhiteSpace(textBoxPower.Text) || string.IsNullOrWhiteSpace(textBoxPrice.Text) || - string.IsNullOrWhiteSpace(textBoxStoreID.Text) || + string.IsNullOrWhiteSpace(comboBoxStore.Text) || string.IsNullOrWhiteSpace(textBoxThickness.Text)) { throw new Exception("Имеются незаполненные поля."); @@ -109,7 +109,7 @@ public partial class FormProduct : Form productType, double.Parse(textBoxPower.Text), int.Parse(textBoxPrice.Text), - int.Parse(textBoxStoreID.Text), + int.Parse(comboBoxStore.Text), float.Parse(textBoxThickness.Text), textBoxDisease.Text ); diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProducts.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProducts.Designer.cs index 890564a..80299ff 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProducts.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormProducts.Designer.cs @@ -85,6 +85,7 @@ // dataGridViewProducts.AllowUserToAddRows = false; dataGridViewProducts.AllowUserToDeleteRows = false; + dataGridViewProducts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridViewProducts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewProducts.Dock = DockStyle.Fill; dataGridViewProducts.Location = new Point(0, 0); diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormStores.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormStores.Designer.cs index aff9d97..b8546b4 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormStores.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormStores.Designer.cs @@ -85,6 +85,7 @@ // dataGridViewStores.AllowUserToAddRows = false; dataGridViewStores.AllowUserToDeleteRows = false; + dataGridViewStores.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridViewStores.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewStores.Dock = DockStyle.Fill; dataGridViewStores.Location = new Point(0, 0); @@ -105,6 +106,7 @@ Controls.Add(panelButtons); Name = "FormStores"; Text = "Так сказать магазины"; + Load += FormStores_Load; panelButtons.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridViewStores).EndInit(); ResumeLayout(false); diff --git a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormSupplies.Designer.cs b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormSupplies.Designer.cs index 94fba8a..2945ac1 100644 --- a/ProjectOpticsStore/ProjectOpticsStore/Forms/FormSupplies.Designer.cs +++ b/ProjectOpticsStore/ProjectOpticsStore/Forms/FormSupplies.Designer.cs @@ -59,6 +59,7 @@ // dataGridViewSupplies.AllowUserToAddRows = false; dataGridViewSupplies.AllowUserToDeleteRows = false; + dataGridViewSupplies.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridViewSupplies.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewSupplies.Dock = DockStyle.Fill; dataGridViewSupplies.Location = new Point(0, 0);