Merge branch 'main' of https://git.is.ulstu.ru/antic0der/PIbd-23_Nasyrov_A_Yunusov_N_CourseWork_Veterinary
This commit is contained in:
commit
74a6ddac62
@ -96,7 +96,7 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
{
|
||||
MedicationName = medication.MedicationName,
|
||||
Purchases = context.Purchases.Include(purchase => purchase.Drug).ThenInclude(drug => drug.Medications)
|
||||
.Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Select(x => x.MedicationId).ToList().Contains(medication.Id))
|
||||
.Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Any(m => m.MedicationId == medication.Id))
|
||||
.Select(purchase => purchase.GetViewModel).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
@ -106,28 +106,25 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
using var context = new VeterinaryDatabase();
|
||||
|
||||
return context.Medications
|
||||
.Select(pet => new ReportDrugsVisitsViewModel()
|
||||
{
|
||||
MedicationName = pet.MedicationName,
|
||||
Drugs = context.Drugs
|
||||
.Where(drug => drug.DateCreate <= model.DateTo &&
|
||||
drug.DateCreate >= model.DateFrom && drug.Medications
|
||||
.Select(x => x.MedicationId)
|
||||
.ToList()
|
||||
.Contains(pet.Id))
|
||||
.Select(drug => drug.GetViewModel)
|
||||
.ToList(),
|
||||
Visits = context.Services
|
||||
.Include(service => service.Visit)
|
||||
.Where(service => service.Visit!=null&&service.Visit.DateVisit <= model.DateTo &&
|
||||
service.Visit.DateVisit >= model.DateFrom && service.Medications
|
||||
.Select(x => x.MedicationId)
|
||||
.ToList()
|
||||
.Contains(pet.Id))
|
||||
.Select(service => service.Visit.GetViewModel)
|
||||
.ToList(),
|
||||
})
|
||||
.ToList();
|
||||
.Select(pet => new ReportDrugsVisitsViewModel()
|
||||
{
|
||||
MedicationName = pet.MedicationName,
|
||||
Drugs = context.Drugs
|
||||
.Where(drug => drug.DateCreate <= model.DateTo &&
|
||||
drug.DateCreate >= model.DateFrom && drug.Medications.Any(m => m.MedicationId == pet.Id))
|
||||
.Select(drug => drug.GetViewModel)
|
||||
.ToList(),
|
||||
Visits = context.Services
|
||||
.Include(service => service.Visit)
|
||||
.Where(service => service.Visit != null && service.Visit.DateVisit <= model.DateTo &&
|
||||
service.Visit.DateVisit >= model.DateFrom && service.Medications.Any(m => m.MedicationId == pet.Id))
|
||||
.Select(service => service.Visit.GetViewModel)
|
||||
.ToList(),
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
{
|
||||
PetName = pet.PetName,
|
||||
Services = context.Services.Include(service => service.Visit).ThenInclude(visit => visit.Pets)
|
||||
.Where(service => service.Visit!=null&&service.Visit.Pets.Select(x => x.PetId).ToList().Contains(pet.Id))
|
||||
.Where(service => service.Visit!=null&&service.Visit.Pets.Any(p => p.PetId == pet.Id))
|
||||
.Select(service => service.GetViewModel).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
@ -62,28 +62,22 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
using var context = new VeterinaryDatabase();
|
||||
|
||||
return context.Pets
|
||||
.Select(pet => new ReportVisitsDrugsViewModel()
|
||||
{
|
||||
PetName = pet.PetName,
|
||||
Visits = context.Visits
|
||||
.Where(visit => visit.DateVisit <= model.DateTo &&
|
||||
visit.DateVisit >= model.DateFrom && visit.Pets
|
||||
.Select(x => x.PetId)
|
||||
.ToList()
|
||||
.Contains(pet.Id))
|
||||
.Select(visit => visit.GetViewModel)
|
||||
.ToList(),
|
||||
Drugs = context.Purchases
|
||||
.Include(purchase => purchase.Drug)
|
||||
.Where(purchase => purchase.DateCreate <= model.DateTo &&
|
||||
purchase.DateCreate >= model.DateFrom && purchase.Pets
|
||||
.Select(x => x.PetId)
|
||||
.ToList()
|
||||
.Contains(pet.Id))
|
||||
.Select(purchase => purchase.Drug.GetViewModel)
|
||||
.ToList(),
|
||||
})
|
||||
.ToList();
|
||||
.Select(pet => new ReportVisitsDrugsViewModel()
|
||||
{
|
||||
PetName = pet.PetName,
|
||||
Visits = context.Visits
|
||||
.Where(visit => visit.DateVisit <= model.DateTo &&
|
||||
visit.DateVisit >= model.DateFrom && visit.Pets.Any(p => p.PetId == pet.Id))
|
||||
.Select(visit => visit.GetViewModel)
|
||||
.ToList(),
|
||||
Drugs = context.Purchases
|
||||
.Include(purchase => purchase.Drug)
|
||||
.Where(purchase => purchase.DateCreate <= model.DateTo &&
|
||||
purchase.DateCreate >= model.DateFrom && purchase.Pets.Any(p => p.PetId == pet.Id))
|
||||
.Select(purchase => purchase.Drug.GetViewModel)
|
||||
.ToList(),
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
public PetViewModel? Insert(PetBindingModel model)
|
||||
{
|
||||
|
@ -41,10 +41,12 @@ namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _drug.ReadElement(new DrugSearchModel
|
||||
{
|
||||
Id =drugId
|
||||
});
|
||||
var elem = _drug.ReadElement(new DrugSearchModel{Id =drugId});
|
||||
if (elem == null)
|
||||
return null;
|
||||
elem.DrugMedications = null!;
|
||||
return elem;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -498,7 +498,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
APIDoctor.PostRequest("api/report/createpurchaselistwordfile", new ReportPurchaseMedicationBindingModel
|
||||
{
|
||||
Medications = medications,
|
||||
FileName = "C:\\ReportsCourseWork\\wordfile.docx"
|
||||
FileName = "C:\\Users\\1\\Downloads\\wordfile.docx"
|
||||
});
|
||||
Response.Redirect("GetWordFile");
|
||||
}
|
||||
@ -507,7 +507,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
APIDoctor.PostRequest("api/report/createpurchaselistexcelfile", new ReportPurchaseMedicationBindingModel
|
||||
{
|
||||
Medications = medications,
|
||||
FileName = "C:\\ReportsCourseWork\\excelfile.xlsx"
|
||||
FileName = "C:\\Users\\1\\Downloads\\excelfile.xlsx"
|
||||
});
|
||||
Response.Redirect("GetExcelFile");
|
||||
}
|
||||
@ -516,12 +516,12 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\ReportsCourseWork\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Report()
|
||||
@ -542,7 +542,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
string dateFromS = dateFrom.ToString("s", CultureInfo.InvariantCulture);
|
||||
string dateToS = dateTo.ToString("s", CultureInfo.InvariantCulture);
|
||||
result = APIDoctor.GetRequest<List<ReportDrugsVisitsViewModel>>
|
||||
($"api/report/getvisitsguidesreport?datefrom={dateFromS}&dateto={dateToS}&doctorid={APIDoctor.Doctor.Id}")!; // переделать
|
||||
($"api/report/getdrugsvisitsreport?datefrom={dateFromS}&dateto={dateToS}&doctorid={APIDoctor.Doctor.Id}")!;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -603,7 +603,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIDoctor.PostRequest("api/report/sendvisitsguidesreporttoemail", new ReportDrugsVisitsBindingModel // поменять
|
||||
APIDoctor.PostRequest("api/report/senddrugsvisitsreporttoemail", new ReportDrugsVisitsBindingModel
|
||||
{
|
||||
FileName = "C:\\ReportsCourseWork\\pdffile.pdf",
|
||||
DoctorId = APIDoctor.Doctor.Id,
|
||||
|
@ -353,7 +353,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}");
|
||||
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getalldrugs");
|
||||
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getdrugs?doctorid={null}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -437,8 +437,8 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
APIOwner.PostRequest("api/reportowner/createservicelistwordfile", new ReportServicesBindingModel
|
||||
{
|
||||
Pets = pets,
|
||||
FileName = "C:\\ReportsCourseWork\\wordfile.docx"
|
||||
});
|
||||
FileName = "C:\\Users\\1\\Downloads\\wordfile.docx"
|
||||
});
|
||||
Response.Redirect("GetWordFile");
|
||||
}
|
||||
else
|
||||
@ -446,23 +446,23 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
APIOwner.PostRequest("api/reportowner/createservicelistexcelfile", new ReportServicesBindingModel
|
||||
{
|
||||
Pets = pets,
|
||||
FileName = "C:\\ReportsCourseWork\\excelfile.xlsx"
|
||||
});
|
||||
FileName = "C:\\Users\\1\\Downloads\\excelfile.xlsx"
|
||||
});
|
||||
Response.Redirect("GetExcelFile");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\ReportsCourseWork\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult GetWordFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
}
|
||||
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult GetExcelFile()
|
||||
{
|
||||
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Report()
|
||||
{
|
||||
ViewBag.Report = new List<ReportVisitsDrugsBindingModel>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user