Заработало
This commit is contained in:
parent
cc9e601ee6
commit
ae713d790f
@ -114,10 +114,6 @@ namespace VeterinaryBusinessLogic.BusinessLogic
|
||||
PetName = model.PetName
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Животное с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class ReportVisitsDrugsBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public List<int> Pets { get; set; } = new();
|
||||
//public List<int> Pets { get; set; } = new();
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public int? OwnerId { get; set; }
|
||||
|
@ -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)))
|
||||
|
@ -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) &&
|
||||
|
@ -76,8 +76,8 @@ namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
MailAddress = model.Email!,
|
||||
Subject = "Отчет по животным",
|
||||
Text = "Лови"
|
||||
});
|
||||
Text = "Отчет по животным"
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
PetBreed = breed,
|
||||
PetGender = gender,
|
||||
});
|
||||
Response.Redirect("Pets");
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<PetViewModel, List<string>>? GetPet(int petId)
|
||||
@ -497,7 +497,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
table += "<tr>";
|
||||
table += "<th scope=\"col\">Дата</th>";
|
||||
table += "<th scope=\"col\">Животное</th>";
|
||||
table += "<th scope=\"col\">Название визита</th>";
|
||||
table += "<th scope=\"col\">Название посещенияы</th>";
|
||||
table += "<th scope=\"col\">Лекарство</th>";
|
||||
table += "</tr>";
|
||||
table += "</thead>";
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user