начало репортов

This commit is contained in:
GokaPek 2024-05-01 15:22:03 +04:00
parent 0b05b028f0
commit 193a465a81
4 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,15 @@
namespace UniversityContracts.BindingModels;
/// <summary>
/// Опции для сохранения отчета, при сохранении указать одно из двух
/// </summary>
public class ReportBindingModel
{
public string? FileName { get; set; }
public Stream? Stream { get; set; }
/// <summary>
/// Массив айдишников по которым происходит выборка
/// </summary>
public int[]? Ids { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.BindingModels
{
public class ReportDateRangeBindingModel
{
public string? FileName { get; set; }
public Stream? Stream { get; set; }
public DateOnly DateFrom { get; set; }
public DateOnly DateTo { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IReportLogic
{
void SaveDisciplinesToWord(ReportBindingModel option);
void SaveDisciplinesToExcel(ReportBindingModel option);
void SendAccountsToEmail(ReportDateRangeBindingModel option, string email);
void SaveClientsToWord(ReportBindingModel option);
void SaveClientsToExcel(ReportBindingModel option);
void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email);
}
}

View File

@ -12,12 +12,30 @@ namespace UniversityContracts.ViewModels
{
public int Id { get; set; }
public int UserId { get; set; }
public int StorekeeperId { get; set; }
[DisplayName("ФИО")]
public string Name { get; set; } = string.Empty;
[DisplayName("Учёная степень")]
public string AcademicDegree { get; set; } = string.Empty;
[DisplayName("Должность")]
public string Position { get; set; } = string.Empty;
public List<StudentViewModel> StudentViewModels { get; set; } = new();
/// <summary>
/// Для отчета по моделям
/// </summary>
/// <returns></returns>
public override string ToString()
{
var result = new StringBuilder(
$"Преподаватель {Name} включает в себя группу студентов:");
for (int i = 0; i < StudentViewModels.Count; i++)
{
var student = StudentViewModels[i];
result.Append($"\n\t{i + 1}. {student.Name}" +
$"{student.PhoneNumber}");
}
return result.ToString();
}
}
}