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

View File

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

View File

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

View File

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