This commit is contained in:
ker73rus 2023-04-09 03:05:40 +04:00
parent f71b37f7e4
commit bc79eaad4c
4 changed files with 41 additions and 19 deletions

View File

@ -9,6 +9,9 @@ using UniversityContracts.ViewModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityBusinessLogic.OfficePackage;
using System.Reflection;
using System.Net;
using System.Reflection.Metadata;
namespace UniversityBusinessLogic.BusinessLogics
{
@ -45,32 +48,49 @@ namespace UniversityBusinessLogic.BusinessLogics
_saveToPdf = saveToPdf;
}
public List<ReportDisciplineViewModel> GetDisciplineReport(List<StudentViewModel> students)
public List<ReportDisciplineViewModel> GetDiscipline(ReportBindingModel model)
{
throw new NotImplementedException();
}
public List<ReportStreamEducationStatusViewModel> GetStreamEdStat(ReportBindingModel model)
{
var result = _streamStorage
.GetFilteredList(new StreamSearchModel { UserId = model.UserId })
.Select(stream => new ReportStreamStudentEdStatPeriodViewModel
var result = _streamStorage.GetFilteredList(new StreamSearchModel { Id = _disciplineStorage.GetElement(new DisciplineSearchModel { Name = model.DisciplineName })?.StreamId })
.Select(stream => new ReportDisciplineViewModel
{
StreamName = stream.Name,
StudentEdStatus = stream.StudentStream
DisciplineName = model.DisciplineName,
StudentEdStatus = stream.StudentStream
.Where(student => _documentStorage.GetFilteredList(new DocumentSearchModel
{
UserId = model.UserId,
DateFrom = model.DateFrom,
DateTo = model.DateTo,
})
.Select(student => (
StudentFIO: $"{student.Value.Name} {student.Value.Surname}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList())
.Any(document => document.StudentDocument.ContainsKey(student.Value.Id)))//Выбираем студентов, которые есть в приказах за выбранный промежуток времени
.Join(_documentStorage.GetFullList(),
t1 => t1.Value.Id,
t2 => t2.UserId,
(t1, t2) => new { student = t1, document = t2 })
.Select(res => (
StudentFIO: $"{res.student.Value.Name} {res.student.Value.Surname}",
Document: $"{res.document.Date}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = res.student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList()
})
.ToList();
return result;
}
public List<ReportStreamEducationStatusViewModel> StreamEducationStatus(List<StreamViewModel> streams)
{
var result = streams
.Select(stream => new ReportStreamEducationStatusViewModel
{
StreamName = stream.Name,
StudentEdStatus = stream.StudentStream
.Select(student => (
StudentFIO: $"{student.Value.Name} {student.Value.Surname}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList()
})
.ToList();
return result;
}
public void SaveBlanksToWordFile(ReportBindingModel model)
{

View File

@ -9,6 +9,7 @@ namespace UniversityContracts.BindingModels
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public string DisciplineName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int? UserId { get; set; }

View File

@ -10,8 +10,8 @@ namespace UniversityContracts.BusinessLogicContracts
{
public interface IReportCustomerLogic
{
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(List<StudentViewModel> students);
List<ReportStreamEducationStatusViewModel> StreamStudentEdStatPeriod(ReportBindingModel model);
List<ReportDisciplineViewModel> GetDiscipline(ReportBindingModel model);
List<ReportStreamEducationStatusViewModel> StreamEducationStatus(List<StreamViewModel> streams);
void SaveBlanksToWordFile(ReportBindingModel model);

View File

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.ViewModels
{
@ -17,6 +18,6 @@ namespace UniversityContracts.ViewModels
[DisplayName("Количество часов")]
public int Hours { get; set; } = 0;
[DisplayName("Тип оценки")]
public bool MarkType { get; set; } //TODO уточнить
public bool MarkType { get; set; }
}
}