finilized report logic

This commit is contained in:
MaxKarme 2023-04-09 00:38:43 +04:00
parent c59b0e725c
commit 2bf631e109

View File

@ -11,11 +11,58 @@ namespace UniversityBuisnessLogic.BuisnessLogic
{
ILogger _logger;
IDisciplineStorage _disciplineStorage;
IStatementStorage _statementStorage;
IExaminationResultStorage _examinationResultStorage;
public ReportLogic(ILogger<ReportLogic> logger, IDisciplineStorage disciplineStorage)
public ReportLogic(ILogger<ReportLogic> logger, IDisciplineStorage disciplineStorage,
IStatementStorage statementStorage, IExaminationResultStorage examinationResultStorage)
{
_logger = logger;
_disciplineStorage = disciplineStorage;
_statementStorage = statementStorage;
_examinationResultStorage = examinationResultStorage;
}
public List<ReportStudentsViewModel> GetStudens(ReportBindingModel model)
{
if (model == null) return new();
var results = _examinationResultStorage.GetFilteredList(new ExaminationResultSearchModel
{
From = model.From,
To = model.To,
});
var statements = _statementStorage.GetFilteredList(new StatementSearchModel
{
From = model.From,
To = model.To,
});
List<ReportStudentsViewModel> list = new();
foreach (var result in results)
{
foreach(var student in result.Students.Values)
{
foreach(var statement in statements)
{
if (!student.Statements.ContainsKey(statement.Id)) continue;
list.Add(new ReportStudentsViewModel
{
StudentName = student.Name,
ExaminationForm = result.ExaminationForm,
mark = result.Mark,
ExaminationResultDate = result.Date,
HoursCount = statement.HoursCount,
StatementDate = statement.Date
});
}
}
}
return list;
}
public List<ReportStudentDisciplineViewModel> GetStudentDiscipline(ReportBindingModel model)
@ -45,5 +92,20 @@ namespace UniversityBuisnessLogic.BuisnessLogic
return result;
}
public void SaveStudentsToExcel()
{
throw new NotImplementedException("Реализация в следующем этапе");
}
public void SaveStudentsToPdf()
{
throw new NotImplementedException("Реализация в следующем этапе");
}
public void SaveStudentsToWord()
{
throw new NotImplementedException("Реализация в следующем этапе");
}
}
}