володя поправь

This commit is contained in:
GokaPek 2024-10-30 18:54:45 +04:00
parent 8baae1a495
commit 5ae61a964d
5 changed files with 22 additions and 6 deletions

View File

@ -2,7 +2,6 @@
using Data.Repositories;
using View;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
using Data.Models;
namespace Laba3

View File

@ -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";

View File

@ -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();
}
}
}
}

View File

@ -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);
}

View File

@ -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)
{