diff --git a/Laba3/MainForm.cs b/Laba3/MainForm.cs index 2fac4fa..33ae5d4 100644 --- a/Laba3/MainForm.cs +++ b/Laba3/MainForm.cs @@ -2,7 +2,6 @@ using Data.Repositories; using View; using System.Windows.Forms; -using Microsoft.Office.Interop.Excel; using Data.Models; namespace Laba3 diff --git a/Laba3/ManufacturerForm.Designer.cs b/Laba3/ManufacturerForm.Designer.cs index d4b7d6d..89fec90 100644 --- a/Laba3/ManufacturerForm.Designer.cs +++ b/Laba3/ManufacturerForm.Designer.cs @@ -38,17 +38,18 @@ dataGridView.Location = new Point(12, 12); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; - dataGridView.Size = new Size(776, 426); + dataGridView.Size = new Size(711, 426); dataGridView.TabIndex = 0; dataGridView.CellValueChanged += dataGridView_CellValueChanged; dataGridView.UserAddedRow += dataGridView_UserAddedRow; dataGridView.UserDeletingRow += dataGridView_UserDeletingRow; + dataGridView.KeyDown += dataGridView_KeyDown; // // ManufacturerForm // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(731, 450); Controls.Add(dataGridView); Name = "ManufacturerForm"; Text = "ManufacturerForm"; diff --git a/Laba3/ManufacturerForm.cs b/Laba3/ManufacturerForm.cs index d3161f9..71e678d 100644 --- a/Laba3/ManufacturerForm.cs +++ b/Laba3/ManufacturerForm.cs @@ -57,11 +57,26 @@ namespace View } } + + // private void dataGridView_UserAddedRow(object sender, DataGridViewRowEventArgs e) { var manufacturer = new Manufacturer { Name = "" }; _manufacturerRepository.AddManufacturer(manufacturer); LoadManufacturers(); } + + + // test + + private void dataGridView_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Insert) + { + var manufacturer = new Manufacturer { Name = "" }; + _manufacturerRepository.AddManufacturer(manufacturer); + LoadManufacturers(); + } + } } } diff --git a/Laba3/ProductForm.Designer.cs b/Laba3/ProductForm.Designer.cs index f856d35..5efeb57 100644 --- a/Laba3/ProductForm.Designer.cs +++ b/Laba3/ProductForm.Designer.cs @@ -38,7 +38,7 @@ // // dtpDeliveryDate // - dtpDeliveryDate.Location = new Point(12, 98); + dtpDeliveryDate.Location = new Point(13, 137); dtpDeliveryDate.Margin = new Padding(4, 5, 4, 5); dtpDeliveryDate.Name = "dtpDeliveryDate"; dtpDeliveryDate.Size = new Size(186, 110); @@ -46,7 +46,7 @@ // // cmbManufacturer // - cmbManufacturer.Location = new Point(13, 150); + cmbManufacturer.Location = new Point(12, 218); cmbManufacturer.Margin = new Padding(4, 5, 4, 5); cmbManufacturer.Name = "cmbManufacturer"; cmbManufacturer.SelectedValue = ""; @@ -92,6 +92,7 @@ Controls.Add(dtpDeliveryDate); Name = "ProductForm"; Text = "ProductForm"; + Load += ProductForm_Load; ((System.ComponentModel.ISupportInitialize)pbImage).EndInit(); ResumeLayout(false); } diff --git a/Laba3/ProductForm.cs b/Laba3/ProductForm.cs index 7a2a07a..0966d0e 100644 --- a/Laba3/ProductForm.cs +++ b/Laba3/ProductForm.cs @@ -31,7 +31,7 @@ namespace Laba3 _isNewProduct = product == null; txtName.MinLength = MINL; txtName.MaxLength = MAXL; - //TODO dtpDeliveryDate.DateF + // dtpDeliveryDate.DateFormat = "DD month YYYY"; if (!_isNewProduct) {