From 02c015aa697ad6b3c80402d4cf62acddf5f4d46c Mon Sep 17 00:00:00 2001 From: Anitonchik Date: Fri, 15 Nov 2024 12:35:39 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectCompanyFurniture/Program.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs index 95b14d8..e593abf 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs @@ -1,6 +1,7 @@ using ProjectCompanyFurniture.Repositories; using ProjectCompanyFurniture.Repositories.Implementations; using Unity; +using Unity.Lifetime; namespace ProjectCompanyFurniture { @@ -21,11 +22,11 @@ namespace ProjectCompanyFurniture private static IUnityContainer CreateContainer() { var container = new UnityContainer(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); - container.RegisterType(); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); return container; } } From 8bded9e4bdd0881bc5dea419887ed8626e2ae0ca Mon Sep 17 00:00:00 2001 From: Anitonchik Date: Fri, 15 Nov 2024 18:10:37 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectCompanyFurniture/Forms/FormClient.cs | 4 +--- .../ProjectCompanyFurniture/Forms/FormInvoice.cs | 2 +- .../ProjectCompanyFurniture/Forms/FormProduct.cs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs index 3bf819a..d131e60 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs @@ -55,9 +55,7 @@ namespace ProjectCompanyFurniture.Forms { try { - if (string.IsNullOrWhiteSpace(textBoxName.Text) - || checkBoxOptYes.Checked == false - || comboBoxClientType.SelectedIndex < 1) + if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxClientType.SelectedIndex < 1) { throw new Exception("Имеются незаполненные поля"); } diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs index 41b6eab..9711f53 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs @@ -36,7 +36,7 @@ namespace ProjectCompanyFurniture.Forms { try { - if (dataGridViewProducts.RowCount < 1 || comboBoxClient.SelectedIndex < 0 || checkBoxPromYes.Checked == false) + if (dataGridViewProducts.RowCount < 1 || comboBoxClient.SelectedIndex < 0) { throw new Exception("Имеются незаполненные поля"); } diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs index b9cf7d5..2823d4d 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs @@ -50,8 +50,7 @@ namespace ProjectCompanyFurniture.Forms { try { - if (string.IsNullOrWhiteSpace(textBoxName.Text) - || string.IsNullOrEmpty(textBoxCategory.Text) + if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrEmpty(textBoxCategory.Text) || comboBoxManufacturer.SelectedIndex < 0) { throw new Exception("Имеются незаполненные поля"); From 7e744cb8d90ea722304ef311cdff41b39d717112 Mon Sep 17 00:00:00 2001 From: Anitonchik Date: Fri, 15 Nov 2024 18:20:41 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D1=8E=D1=81=D1=8C?= =?UTF-8?q?=20=D0=B8=D1=82=D0=BE=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectCompanyFurniture/Entities/Invoice.cs | 4 ++-- .../ProjectCompanyFurniture/Entities/ProductMovement.cs | 6 +++--- .../ProjectCompanyFurniture/Forms/FormInvoice.cs | 6 +++--- .../ProjectCompanyFurniture/Forms/FormProducts.cs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs index 7034b3c..063a75f 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs @@ -19,7 +19,7 @@ public class Invoice public int SellingPrice { get; set; } - DateTime Data { get; set; } + public DateTime Date { get; set; } public IEnumerable Products { @@ -37,7 +37,7 @@ public class Invoice AvailabilityOfPromotionalCode = availabilityOfPromotionalCode, DiscountPercentage = discountPercentage, SellingPrice = sellingPrice, - Data = DateTime.Now, + Date = DateTime.Now, Products = products }; } diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs index cba9cff..add15c2 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs @@ -13,17 +13,17 @@ public class ProductMovement public int ProductID { get; private set; } - public Movement MovementProduct { get; private set; } + public Movement MovementType { get; private set; } public DateTime Date { get; private set; } - public static ProductMovement CreateOperation (int it, int productId, Movement movement) + public static ProductMovement CreateOperation (int it, int productId, Movement movementType) { return new ProductMovement { ID = it, ProductID = productId, - MovementProduct = movement, + MovementType = movementType, Date = DateTime.Now }; } diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs index 9711f53..a001695 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs @@ -24,12 +24,12 @@ namespace ProjectCompanyFurniture.Forms throw new ArgumentNullException(nameof(invoiceRepository)); comboBoxClient.DataSource = clientRepository.ReadClients(); - comboBoxClient.DisplayMember = "FirstName"; - comboBoxClient.ValueMember = "Id"; + comboBoxClient.DisplayMember = "Name"; + comboBoxClient.ValueMember = "ID"; ColumnProduct.DataSource = productRepository.ReadProducts(); ColumnProduct.DisplayMember = "Name"; - ColumnProduct.ValueMember = "Id"; + ColumnProduct.ValueMember = "ID"; } private void ButtonSave_Click(object sender, EventArgs e) diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs index 3f37393..b20d13e 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs @@ -59,7 +59,7 @@ namespace ProjectCompanyFurniture.Forms } try { - var form = _container.Resolve(); + var form = _container.Resolve(); form.Id = findId; form.ShowDialog(); LoadList();