Merge branch 'Worker'
This commit is contained in:
commit
ec15a51395
@ -690,7 +690,7 @@ View(res);
|
||||
|
||||
// Строка для визита
|
||||
table += "<tr>";
|
||||
table += $"<td></td>";
|
||||
table += $"<td>{visit.DateVisit}</td>";
|
||||
table += $"<td>{visit.VisitName}</td>";
|
||||
table += $"<td></td>";
|
||||
table += $"<td></td>";
|
||||
|
@ -96,36 +96,58 @@ namespace VetClinicBusinessLogic.BusinessLogics
|
||||
List<Tuple<VisitViewModel, List<Tuple<AnimalViewModel, List<VaccinationViewModel>>>>> responseVaccinations =
|
||||
_visitStorage.GetVaccinationsInfo(new MedicineVaccinationsSearchModel { DateFrom = model.DateFrom!, DateTo = model.DateTo!, AdminId = model.AdminId!});
|
||||
List<Tuple<VisitViewModel, List<Tuple<AnimalViewModel, List<MedicineViewModel>>>>> responseMedicines =
|
||||
_visitStorage.GetMedicinesInfo(new MedicineVaccinationsSearchModel { DateFrom = model.DateFrom!, DateTo = model.DateTo!, AdminId = model.AdminId! });
|
||||
_visitStorage.GetMedicinesInfo(new MedicineVaccinationsSearchModel { AdminId = model.AdminId! });
|
||||
Dictionary<int, MedicinesVaccinationsViewModel> dict = new();
|
||||
|
||||
foreach(var visit in responseVaccinations)
|
||||
{
|
||||
dict.Add(visit.Item1.Id, new());
|
||||
dict[visit.Item1.Id].VisitName = visit.Item1.NameVisit;
|
||||
foreach(var animal in visit.Item2)
|
||||
if (visit.Item1.DateVisit >= model.DateFrom && visit.Item1.DateVisit <= model.DateTo)
|
||||
{
|
||||
foreach(var vaccination in animal.Item2)
|
||||
|
||||
|
||||
dict.Add(visit.Item1.Id, new());
|
||||
dict[visit.Item1.Id].VisitName = visit.Item1.NameVisit;
|
||||
dict[visit.Item1.Id].DateVisit = visit.Item1.DateVisit;
|
||||
foreach (var animal in visit.Item2)
|
||||
{
|
||||
dict[visit.Item1.Id].Vaccinations.Add(vaccination);
|
||||
foreach (var vaccination in animal.Item2)
|
||||
{
|
||||
dict[visit.Item1.Id].Vaccinations.Add(vaccination);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var visit in responseMedicines)
|
||||
{
|
||||
HashSet<int> used = new();
|
||||
foreach (var animal in visit.Item2)
|
||||
if (visit.Item1.DateVisit >= model.DateFrom && visit.Item1.DateVisit <= model.DateTo)
|
||||
{
|
||||
foreach (var medicine in animal.Item2)
|
||||
if (!dict.ContainsKey(visit.Item1.Id))
|
||||
{
|
||||
if (used.Contains(medicine.Id))
|
||||
continue;
|
||||
dict[visit.Item1.Id].Medicines.Add(medicine);
|
||||
used.Add(medicine.Id);
|
||||
dict.Add(visit.Item1.Id, new MedicinesVaccinationsViewModel());
|
||||
dict[visit.Item1.Id].VisitName = visit.Item1.NameVisit;
|
||||
dict[visit.Item1.Id].DateVisit = visit.Item1.DateVisit;
|
||||
}
|
||||
HashSet<int> used = new();
|
||||
foreach (var animal in visit.Item2)
|
||||
{
|
||||
foreach (var medicine in animal.Item2)
|
||||
{
|
||||
if (used.Contains(medicine.Id))
|
||||
continue;
|
||||
|
||||
dict[visit.Item1.Id].Medicines.Add(medicine);
|
||||
|
||||
used.Add(medicine.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
ans.Add(dict[visit.Item1.Id]);
|
||||
|
||||
|
||||
}
|
||||
foreach (var kvp in dict)
|
||||
{
|
||||
ans.Add(kvp.Value);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
@ -38,19 +38,11 @@ namespace VetClinicBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", visit.VisitName, "", "" },
|
||||
Texts = new List<string> { visit.DateVisit.ToString(), visit.VisitName, "", "" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach(var medicine in visit.Medicines)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", "", "", medicine.MedicineName },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var vaccination in visit.Vaccinations)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
@ -60,6 +52,15 @@ namespace VetClinicBusinessLogic.OfficePackage
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
}
|
||||
foreach (var medicine in visit.Medicines)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", "", "", medicine.MedicineName },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
SavePdf(info);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
public class MedicinesVaccinationsViewModel
|
||||
{
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
public DateTime DateVisit { get; set; } = DateTime.Now;
|
||||
public List<MedicineViewModel> Medicines { get; set; } = new();
|
||||
public List<VaccinationViewModel> Vaccinations { get; set; } = new();
|
||||
public DateTime DateFrom { get; set; } = DateTime.Now;
|
||||
|
Loading…
Reference in New Issue
Block a user