From 4e5b73188d1d37810c516a3a90ce0dcaa007cd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=84=D1=8C=D1=8F=20=D0=AF=D0=BA=D0=BE=D0=B1?= =?UTF-8?q?=D1=87=D1=83=D0=BA?= Date: Fri, 3 May 2024 04:48:06 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=A4=D0=98=D0=9A=D0=A1=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/HearingLogic.cs | 8 ++++++++ .../LawCompanyBusinessLogic/BusinessLogics/LawyerLogic.cs | 1 - .../Implements/HearingStorage.cs | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/LawCompany/LawCompanyBusinessLogic/BusinessLogics/HearingLogic.cs b/LawCompany/LawCompanyBusinessLogic/BusinessLogics/HearingLogic.cs index cb2fb95..3ec0394 100644 --- a/LawCompany/LawCompanyBusinessLogic/BusinessLogics/HearingLogic.cs +++ b/LawCompany/LawCompanyBusinessLogic/BusinessLogics/HearingLogic.cs @@ -95,6 +95,10 @@ namespace LawCompanyBusinessLogic.BusinessLogics { return false; } + if (element.HearingLawyers.ContainsKey(lawyer.Id)) + { + return false; + } element.HearingLawyers[lawyer.Id] = lawyer; _hearingStorage.Update(new() @@ -118,6 +122,10 @@ namespace LawCompanyBusinessLogic.BusinessLogics { return; } + if (string.IsNullOrEmpty(model.Judge)) + { + throw new ArgumentNullException("Не указан суд", nameof(model.Judge)); + } if (string.IsNullOrEmpty((model.HearingDate).ToString())) { throw new ArgumentNullException("Не поставлено время", nameof(model.HearingDate)); diff --git a/LawCompany/LawCompanyBusinessLogic/BusinessLogics/LawyerLogic.cs b/LawCompany/LawCompanyBusinessLogic/BusinessLogics/LawyerLogic.cs index d062877..45a71af 100644 --- a/LawCompany/LawCompanyBusinessLogic/BusinessLogics/LawyerLogic.cs +++ b/LawCompany/LawCompanyBusinessLogic/BusinessLogics/LawyerLogic.cs @@ -142,7 +142,6 @@ namespace LawCompanyBusinessLogic.BusinessLogics FIO = model.FIO, Phone = model.Phone, Email = model.Email, - GuarantorId = model.GuarantorId, }); if (element != null && element.Id != model.Id) diff --git a/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs b/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs index 8d70d34..10a3c8d 100644 --- a/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs +++ b/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs @@ -26,7 +26,7 @@ namespace LawCompanyDatabaseImplement.Implements { return new(); } - if (!model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + if (model.GuarantorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) { using var context = new LawCompanyDatabase(); return context.Hearings @@ -37,7 +37,7 @@ namespace LawCompanyDatabaseImplement.Implements .Select(x => x.GetViewModel) .ToList(); } - if (!model.GuarantorId.HasValue) + else if (model.GuarantorId.HasValue) { using var context = new LawCompanyDatabase(); return context.Hearings