From ae713d790f6cf3e021686b13db9b45902c1cf8e3 Mon Sep 17 00:00:00 2001 From: Yunusov_Niyaz Date: Mon, 27 May 2024 02:05:49 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VeterinaryBusinessLogic/BusinessLogic/PetLogic.cs | 4 ---- .../BusinessLogic/ReportLogicOwner.cs | 4 ++-- .../BindingModels/ReportVisitsDrugsBindingModel.cs | 2 +- .../Implements/PurchaseStorage.cs | 3 ++- .../Implements/VisitStorage.cs | 3 ++- .../Controllers/ReportOwnerController.cs | 4 ++-- .../VeterinaryShowOwnerApp/Controllers/HomeController.cs | 8 ++++---- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/PetLogic.cs b/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/PetLogic.cs index 85505e3..82af991 100644 --- a/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/PetLogic.cs +++ b/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/PetLogic.cs @@ -114,10 +114,6 @@ namespace VeterinaryBusinessLogic.BusinessLogic PetName = model.PetName }); - if (element != null && element.Id != model.Id) - { - throw new InvalidOperationException("Животное с таким названием уже есть"); - } } } } diff --git a/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/ReportLogicOwner.cs b/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/ReportLogicOwner.cs index 60b0849..45f2b6d 100644 --- a/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/ReportLogicOwner.cs +++ b/VeterinaryView/VeterinaryBusinessLogic/BusinessLogic/ReportLogicOwner.cs @@ -16,9 +16,9 @@ namespace VeterinaryBusinessLogic.BusinessLogic private readonly IPetStorage _petStorage; private readonly AbstractSaveToExcelOwner _saveToExcel; private readonly AbstractSaveToWordOwner _saveToWord; - private readonly AbstractSaveToPdfDoctor _saveToPdf; + private readonly AbstractSaveToPdfOwner _saveToPdf; public ReportLogicOwner(IPetStorage petStorage, - AbstractSaveToExcelOwner saveToExcel, AbstractSaveToWordOwner saveToWord, AbstractSaveToPdfDoctor saveToPdf) + AbstractSaveToExcelOwner saveToExcel, AbstractSaveToWordOwner saveToWord, AbstractSaveToPdfOwner saveToPdf) { _petStorage = petStorage; _saveToExcel = saveToExcel; diff --git a/VeterinaryView/VeterinaryContracts/BindingModels/ReportVisitsDrugsBindingModel.cs b/VeterinaryView/VeterinaryContracts/BindingModels/ReportVisitsDrugsBindingModel.cs index 35229ed..dabe1e3 100644 --- a/VeterinaryView/VeterinaryContracts/BindingModels/ReportVisitsDrugsBindingModel.cs +++ b/VeterinaryView/VeterinaryContracts/BindingModels/ReportVisitsDrugsBindingModel.cs @@ -3,7 +3,7 @@ public class ReportVisitsDrugsBindingModel { public string FileName { get; set; } = string.Empty; - public List Pets { get; set; } = new(); + //public List Pets { get; set; } = new(); public DateTime DateFrom { get; set; } public DateTime DateTo { get; set; } public int? OwnerId { get; set; } diff --git a/VeterinaryView/VeterinaryDatabaseImplement/Implements/PurchaseStorage.cs b/VeterinaryView/VeterinaryDatabaseImplement/Implements/PurchaseStorage.cs index 567c782..2e54f44 100644 --- a/VeterinaryView/VeterinaryDatabaseImplement/Implements/PurchaseStorage.cs +++ b/VeterinaryView/VeterinaryDatabaseImplement/Implements/PurchaseStorage.cs @@ -20,7 +20,8 @@ namespace VeterinaryDatabaseImplement.Implements { using var context = new VeterinaryDatabase(); return context.Purchases.Include(x => x.Owner).Include(x => x.Pets).ThenInclude(x => x.Pet).Include(x => x.Drug) - .Where(x => ((!model.Id.HasValue || x.Id == model.Id) && + .Where(x => x.OwnerId == model.OwnerId) + .Where(x => ((!model.Id.HasValue || x.Id == model.Id) && (!model.DateCreate.HasValue || x.DateCreate >= model.DateCreate) && (!model.OwnerId.HasValue || x.OwnerId <= model.OwnerId) && (!model.DrugId.HasValue || x.DrugId == model.DrugId))) diff --git a/VeterinaryView/VeterinaryDatabaseImplement/Implements/VisitStorage.cs b/VeterinaryView/VeterinaryDatabaseImplement/Implements/VisitStorage.cs index fd93363..017796f 100644 --- a/VeterinaryView/VeterinaryDatabaseImplement/Implements/VisitStorage.cs +++ b/VeterinaryView/VeterinaryDatabaseImplement/Implements/VisitStorage.cs @@ -21,7 +21,8 @@ namespace VeterinaryDatabaseImplement.Implements using var context = new VeterinaryDatabase(); return context.Visits.Include(x => x.Owner).Include(x => x.Pets).ThenInclude(x => x.Pet).Include(x => x.Doctor) - .Where(x => ((!model.Id.HasValue || x.Id == model.Id) && + .Where(x => x.OwnerId == model.OwnerId) + .Where(x => ((!model.Id.HasValue || x.Id == model.Id) && (string.IsNullOrEmpty(model.VisitName) || x.VisitName.Contains(model.VisitName)) && (!model.DateVisit.HasValue || x.DateVisit >= model.DateVisit) && (!model.OwnerId.HasValue || x.OwnerId <= model.OwnerId) && diff --git a/VeterinaryView/VeterinaryRestApi/Controllers/ReportOwnerController.cs b/VeterinaryView/VeterinaryRestApi/Controllers/ReportOwnerController.cs index 8cb818a..09daee1 100644 --- a/VeterinaryView/VeterinaryRestApi/Controllers/ReportOwnerController.cs +++ b/VeterinaryView/VeterinaryRestApi/Controllers/ReportOwnerController.cs @@ -76,8 +76,8 @@ namespace VeterinaryRestApi.Controllers { MailAddress = model.Email!, Subject = "Отчет по животным", - Text = "Лови" - }); + Text = "Отчет по животным" + }); } catch (Exception ex) { diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs index 54291d7..7dee0e7 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs @@ -199,7 +199,7 @@ namespace VeterinaryShowOwnerApp.Controllers PetBreed = breed, PetGender = gender, }); - Response.Redirect("Pets"); + Response.Redirect("Index"); } [HttpGet] public Tuple>? GetPet(int petId) @@ -497,7 +497,7 @@ namespace VeterinaryShowOwnerApp.Controllers table += ""; table += "Дата"; table += "Животное"; - table += "Название визита"; + table += "Название посещенияы"; table += "Лекарство"; table += ""; table += ""; @@ -542,9 +542,9 @@ namespace VeterinaryShowOwnerApp.Controllers { throw new Exception("Вы как суда попали? Суда вход только авторизованным"); } - APIOwner.PostRequest("api/report/sendvisitsdrugsreporttoemail", new ReportVisitsDrugsBindingModel + APIOwner.PostRequest("api/reportowner/sendvisitsdrugsreporttoemail", new ReportVisitsDrugsBindingModel { - FileName = "C:\\ReportsCourseWork\\pdffile.pdf", + FileName = "C:\\Users\\niyaz\\Downloads\\pdffile.pdf", OwnerId = APIOwner.Owner.Id, DateFrom = dateFrom, DateTo = dateTo,