diff --git a/AircraftPlant/AircraftPlantView/FormShop.Designer.cs b/AircraftPlant/AircraftPlantView/FormShop.Designer.cs index d741c4d..10c183e 100644 --- a/AircraftPlant/AircraftPlantView/FormShop.Designer.cs +++ b/AircraftPlant/AircraftPlantView/FormShop.Designer.cs @@ -28,46 +28,47 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); + this.labelName = new System.Windows.Forms.Label(); + this.labelAddress = new System.Windows.Forms.Label(); + this.labelDate = new System.Windows.Forms.Label(); this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxAddress = new System.Windows.Forms.TextBox(); this.dateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.dataGridView = new System.Windows.Forms.DataGridView(); + this.dataGridViewShop = new System.Windows.Forms.DataGridView(); this.buttonSave = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); - this.Plane = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnPlane = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewShop)).BeginInit(); this.SuspendLayout(); // - // label1 + // labelName // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(62, 15); - this.label1.TabIndex = 0; - this.label1.Text = "Название:"; + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(12, 9); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(62, 15); + this.labelName.TabIndex = 0; + this.labelName.Text = "Название:"; // - // label2 + // labelAddress // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 39); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(43, 15); - this.label2.TabIndex = 1; - this.label2.Text = "Адрес:"; + this.labelAddress.AutoSize = true; + this.labelAddress.Location = new System.Drawing.Point(12, 39); + this.labelAddress.Name = "labelAddress"; + this.labelAddress.Size = new System.Drawing.Size(43, 15); + this.labelAddress.TabIndex = 1; + this.labelAddress.Text = "Адрес:"; // - // label3 + // labelDate // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 74); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(90, 15); - this.label3.TabIndex = 2; - this.label3.Text = "Дата открытия:"; + this.labelDate.AutoSize = true; + this.labelDate.Location = new System.Drawing.Point(12, 74); + this.labelDate.Name = "labelDate"; + this.labelDate.Size = new System.Drawing.Size(90, 15); + this.labelDate.TabIndex = 2; + this.labelDate.Text = "Дата открытия:"; // // textBoxName // @@ -90,17 +91,18 @@ this.dateTimePicker.Size = new System.Drawing.Size(200, 23); this.dateTimePicker.TabIndex = 5; // - // dataGridView + // dataGridViewShop // - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Plane, - this.Count}); - this.dataGridView.Location = new System.Drawing.Point(26, 118); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(446, 325); - this.dataGridView.TabIndex = 6; + this.dataGridViewShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ColumnID, + this.ColumnPlane, + this.ColumnCount}); + this.dataGridViewShop.Location = new System.Drawing.Point(26, 118); + this.dataGridViewShop.Name = "dataGridViewShop"; + this.dataGridViewShop.RowTemplate.Height = 25; + this.dataGridViewShop.Size = new System.Drawing.Size(446, 325); + this.dataGridViewShop.TabIndex = 6; // // buttonSave // @@ -122,16 +124,22 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // - // Plane + // ColumnID // - this.Plane.HeaderText = "Изделие"; - this.Plane.Name = "Plane"; - this.Plane.Width = 300; + this.ColumnID.HeaderText = "ID"; + this.ColumnID.Name = "ColumnID"; + this.ColumnID.Visible = false; // - // Count + // ColumnPlane // - this.Count.HeaderText = "Количество"; - this.Count.Name = "Count"; + this.ColumnPlane.HeaderText = "Изделие"; + this.ColumnPlane.Name = "ColumnPlane"; + this.ColumnPlane.Width = 300; + // + // ColumnCount + // + this.ColumnCount.HeaderText = "Количество"; + this.ColumnCount.Name = "ColumnCount"; // // FormShop // @@ -140,17 +148,17 @@ this.ClientSize = new System.Drawing.Size(481, 470); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonSave); - this.Controls.Add(this.dataGridView); + this.Controls.Add(this.dataGridViewShop); this.Controls.Add(this.dateTimePicker); this.Controls.Add(this.textBoxAddress); this.Controls.Add(this.textBoxName); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.Controls.Add(this.labelDate); + this.Controls.Add(this.labelAddress); + this.Controls.Add(this.labelName); this.Name = "FormShop"; this.Text = "Магазин"; this.Load += new System.EventHandler(this.FormShop_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewShop)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -169,5 +177,13 @@ private DataGridViewTextBoxColumn Count; private Button buttonSave; private Button buttonCancel; + private Label labelName; + private Label labelAddress; + private Label labelDate; + private DataGridView dataGridViewShops; + private DataGridViewTextBoxColumn ColumnID; + private DataGridViewTextBoxColumn ColumnPlane; + private DataGridViewTextBoxColumn ColumnCount; + private DataGridView dataGridViewShop; } } \ No newline at end of file diff --git a/AircraftPlant/AircraftPlantView/FormShop.cs b/AircraftPlant/AircraftPlantView/FormShop.cs index 0c74932..888ed05 100644 --- a/AircraftPlant/AircraftPlantView/FormShop.cs +++ b/AircraftPlant/AircraftPlantView/FormShop.cs @@ -141,10 +141,10 @@ namespace AircraftPlantView { if (_shopPlanes != null) { - dataGridView.Rows.Clear(); + dataGridViewShop.Rows.Clear(); foreach (var elem in _shopPlanes) { - dataGridView.Rows.Add(new object[] + dataGridViewShop.Rows.Add(new object[] { elem.Key, elem.Value.Item1.PlaneName, diff --git a/AircraftPlant/AircraftPlantView/FormShop.resx b/AircraftPlant/AircraftPlantView/FormShop.resx index 05b9989..4ff2619 100644 --- a/AircraftPlant/AircraftPlantView/FormShop.resx +++ b/AircraftPlant/AircraftPlantView/FormShop.resx @@ -57,16 +57,13 @@ 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/AircraftPlant/AircraftPlantView/FormShops.Designer.cs b/AircraftPlant/AircraftPlantView/FormShops.Designer.cs index c6c86a2..2083ddb 100644 --- a/AircraftPlant/AircraftPlantView/FormShops.Designer.cs +++ b/AircraftPlant/AircraftPlantView/FormShops.Designer.cs @@ -28,22 +28,22 @@ /// private void InitializeComponent() { - this.dataGridView = new System.Windows.Forms.DataGridView(); + this.dataGridViewShops = new System.Windows.Forms.DataGridView(); this.buttonAdd = new System.Windows.Forms.Button(); this.buttonUpdate = new System.Windows.Forms.Button(); this.buttonDelete = new System.Windows.Forms.Button(); this.buttonRefresh = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewShops)).BeginInit(); this.SuspendLayout(); // - // dataGridView + // dataGridViewShops // - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Location = new System.Drawing.Point(0, 0); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowTemplate.Height = 25; - this.dataGridView.Size = new System.Drawing.Size(495, 449); - this.dataGridView.TabIndex = 0; + this.dataGridViewShops.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewShops.Location = new System.Drawing.Point(0, 0); + this.dataGridViewShops.Name = "dataGridViewShops"; + this.dataGridViewShops.RowTemplate.Height = 25; + this.dataGridViewShops.Size = new System.Drawing.Size(495, 449); + this.dataGridViewShops.TabIndex = 0; // // buttonAdd // @@ -94,11 +94,11 @@ this.Controls.Add(this.buttonDelete); this.Controls.Add(this.buttonUpdate); this.Controls.Add(this.buttonAdd); - this.Controls.Add(this.dataGridView); + this.Controls.Add(this.dataGridViewShops); this.Name = "FormShops"; this.Text = "Магазины"; this.Load += new System.EventHandler(this.FormShops_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewShops)).EndInit(); this.ResumeLayout(false); } @@ -110,5 +110,6 @@ private Button buttonUpdate; private Button buttonDelete; private Button buttonRefresh; + private DataGridView dataGridViewShops; } } \ No newline at end of file diff --git a/AircraftPlant/AircraftPlantView/FormShops.cs b/AircraftPlant/AircraftPlantView/FormShops.cs index c14f592..7150b27 100644 --- a/AircraftPlant/AircraftPlantView/FormShops.cs +++ b/AircraftPlant/AircraftPlantView/FormShops.cs @@ -67,12 +67,12 @@ namespace AircraftPlantView /// private void buttonUpdate_Click(object sender, EventArgs e) { - if (dataGridView.SelectedRows.Count == 1) + if (dataGridViewShops.SelectedRows.Count == 1) { var service = Program.ServiceProvider?.GetService(typeof(FormShop)); if (service is FormShop form) { - form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + form.Id = Convert.ToInt32(dataGridViewShops.SelectedRows[0].Cells["Id"].Value); if (form.ShowDialog() == DialogResult.OK) { LoadData(); @@ -87,11 +87,11 @@ namespace AircraftPlantView /// private void buttonDelete_Click(object sender, EventArgs e) { - if (dataGridView.SelectedRows.Count == 1) + if (dataGridViewShops.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + int id = Convert.ToInt32(dataGridViewShops.SelectedRows[0].Cells["Id"].Value); _logger.LogInformation("Удаление магазина"); try { @@ -128,10 +128,10 @@ namespace AircraftPlantView var list = _logic.ReadList(null); if (list != null) { - dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["ShopPlanes"].Visible = false; + dataGridViewShops.DataSource = list; + dataGridViewShops.Columns["Id"].Visible = false; + dataGridViewShops.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridViewShops.Columns["ShopPlanes"].Visible = false; } _logger.LogInformation("Загрузка магазинов"); } diff --git a/AircraftPlant/AircraftPlantView/Program.cs b/AircraftPlant/AircraftPlantView/Program.cs index 90280e1..ed671cc 100644 --- a/AircraftPlant/AircraftPlantView/Program.cs +++ b/AircraftPlant/AircraftPlantView/Program.cs @@ -49,10 +49,12 @@ namespace AircraftPlantView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -61,6 +63,9 @@ namespace AircraftPlantView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file