fix
This commit is contained in:
parent
8caeebb8d3
commit
e5b2dcdab6
@ -15,7 +15,7 @@ namespace UniversityBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly IDocumentStorage _documentStorage;
|
||||
|
||||
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline()
|
||||
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace UniversityContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IReportProviderLogic
|
||||
{
|
||||
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline();
|
||||
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(ReportBindingModel model);
|
||||
|
||||
List<ReportStreamStudentEdStatPeriodViewModel> StreamStudentEdStatPeriod(ReportBindingModel model);
|
||||
|
||||
|
@ -11,5 +11,7 @@ namespace UniversityContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,34 @@ namespace UniversityDataBaseImplemet.Implements
|
||||
.Select(record => record.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.DateFrom != null && model.DateTo != null && model.UserId.HasValue) // фильтрация для отчета#2 Поставщик
|
||||
{
|
||||
return context.Documents
|
||||
.Where(d => d.Date >= model.DateFrom && d.Date <= model.DateTo)
|
||||
.Join(context.StudentDocuments,
|
||||
doc => doc.Id,
|
||||
studDoc => studDoc.DocumentId,
|
||||
(doc, studDoc) => new { Document = doc, StudentDocument = studDoc })
|
||||
.Join(context.Students,
|
||||
studDoc => studDoc.StudentDocument.StudentId,
|
||||
stud => stud.Id,
|
||||
(studDoc, stud) => new { studDoc.Document, Student = stud })
|
||||
.Include(record => record.Student.EducationStatus)
|
||||
.Join(context.StudentStreams,
|
||||
studEdu => studEdu.Student.Id,
|
||||
studStream => studStream.StudentId,
|
||||
(studEdu, studStream) => new { studEdu.Document, studEdu.Student, studEdu.EducationStatus, StudentStream = studStream })
|
||||
.Join(context.Streams,
|
||||
studStream => studStream.StudentStream.StreamId,
|
||||
stream => stream.Id,
|
||||
(studStream, stream) => new { Stream = stream.Name, studStream.Student, studStream.EducationStatus.Name })
|
||||
.Select(result => new {
|
||||
result.Stream,
|
||||
result.Student,
|
||||
result.EducationStatus
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
else if (model.UserId.HasValue)
|
||||
{
|
||||
return context.Documents
|
||||
|
@ -51,39 +51,6 @@ namespace UniversityDataBaseImplemet.Implements
|
||||
.Select(record => record.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
/*else if (model.Disciplines == true) // для отчета#1 Поставщик
|
||||
{
|
||||
return context.Students
|
||||
.Join(context.StudentStreams, student => student.Id, studentStream => studentStream.StudentId, (student, studentStream) => new { Student = student, StreamId = studentStream })
|
||||
.Join(context.Streams, studentStream => studentStream.StreamId, stream => stream.Id, (studentStream, stream) => new { Stream = stream })
|
||||
.Join(context.Disciplines, record => record.stream.Id, discipline => discipline.StreamId, (record, discipline) => new { record.student, discipline })
|
||||
.GroupBy(sd => sd.student)
|
||||
.Select(g => new {
|
||||
Student = g.Key.Name,
|
||||
Disciplines = g.Select(sd => sd.discipline.Name).ToList()
|
||||
})
|
||||
.ToList();
|
||||
}*/
|
||||
/*else if (model.DateFrom != null && model.DateTo != null) // для отчета#2 Поставщик
|
||||
{
|
||||
return context.Students
|
||||
.Include(record => record.User)
|
||||
.Include(record => record.EducationStatus)
|
||||
.Join(context.StudentStreams,
|
||||
student => student.Id,
|
||||
studentStream => studentStream.StudentId,
|
||||
(student, studentStream) => new { Student = student, StreamId = studentStream })
|
||||
.Join(context.Streams,
|
||||
studentStream => studentStream.StreamId,
|
||||
stream => stream.Id,
|
||||
(studentStream, stream) => new { Stream = stream })
|
||||
.Select(result => new
|
||||
{
|
||||
Stream = result.Stream,
|
||||
Students = result.Select(record => (record.Student, record.EducationStatus)).ToList()
|
||||
})
|
||||
.ToList();
|
||||
}*/
|
||||
else
|
||||
{
|
||||
return new();
|
||||
|
Loading…
Reference in New Issue
Block a user