Слияние чреслами
This commit is contained in:
commit
6f0ef7d77c
@ -210,12 +210,20 @@ public class ReportLogic : IReportLogic
|
||||
}
|
||||
public void SavePlanOfStudyToExcel(ReportBindingModel option)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
/*_saveToExcelWorker.CreateReport(new ExcelInfoWorker
|
||||
{
|
||||
|
||||
});*/
|
||||
}
|
||||
|
||||
public void SavePlanOfStudyToWord(ReportBindingModel option)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToWordWorker.CreateDoc(new WordInfoWorker
|
||||
{
|
||||
FileName = option.FileName,
|
||||
Title = "Список планов обучения",
|
||||
PlanOfStudys = GetPlanOfStudyAndDisciplines()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveTeachersToWord(ReportBindingModel option)
|
||||
@ -235,6 +243,9 @@ public class ReportLogic : IReportLogic
|
||||
|
||||
public void SendPlanOfStudyToEmail(ReportDateRangeBindingModel option, string email)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
/*_saveToPdfWorker.CreateDoc(new PdfInfoWorker
|
||||
{
|
||||
|
||||
});*/
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace UniversityBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcelWorker
|
||||
{
|
||||
public void CreateReport(ExcelInfo info)
|
||||
/*public void CreateReport(ExcelInfoWorker info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
@ -73,10 +73,10 @@ namespace UniversityBusinessLogic.OfficePackage
|
||||
rowIndex++;
|
||||
}
|
||||
SaveExcel(info);
|
||||
}
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
}*/
|
||||
protected abstract void CreateExcel(ExcelInfoWorker info);
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
protected abstract void SaveExcel(ExcelInfo info);
|
||||
protected abstract void SaveExcel(ExcelInfoWorker info);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace UniversityBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToPdfWorker
|
||||
{
|
||||
public void CreateDoc(PdfInfo info)
|
||||
/*public void CreateDoc(PdfInfoWorker info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
@ -32,13 +32,13 @@ namespace UniversityBusinessLogic.OfficePackage
|
||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
||||
|
||||
SavePdf(info);
|
||||
}
|
||||
}*/
|
||||
|
||||
/// <summary>
|
||||
/// Создание doc-файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void CreatePdf(PdfInfo info);
|
||||
protected abstract void CreatePdf(PdfInfoWorker info);
|
||||
|
||||
/// <summary>
|
||||
/// Создание параграфа с текстом
|
||||
@ -64,6 +64,6 @@ namespace UniversityBusinessLogic.OfficePackage
|
||||
/// Сохранение файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void SavePdf(PdfInfo info);
|
||||
protected abstract void SavePdf(PdfInfoWorker info);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UniversityBusinessLogic.OfficePackage.HelperModels;
|
||||
using UniversityBusinessLogics.OfficePackage.HelperEnums;
|
||||
using UniversityBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace UniversityBusinessLogic.OfficePackage
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfo
|
||||
public class ExcelInfoWorker
|
||||
{
|
||||
public string? FileName { get; set; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
public class PdfInfoWorker
|
||||
{
|
||||
public string? FileName { get; set; }
|
||||
public Stream? Stream { get; set; }
|
@ -211,7 +211,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
protected override void CreateExcel(ExcelInfo info)
|
||||
protected override void CreateExcel(ExcelInfoWorker info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
||||
SpreadsheetDocumentType.Workbook);
|
||||
@ -343,7 +343,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
protected override void SaveExcel(ExcelInfo info)
|
||||
protected override void SaveExcel(ExcelInfoWorker info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
||||
style.Font.Bold = true;
|
||||
}
|
||||
|
||||
protected override void CreatePdf(PdfInfo info)
|
||||
protected override void CreatePdf(PdfInfoWorker info)
|
||||
{
|
||||
_document = new Document();
|
||||
DefineStyles(_document);
|
||||
@ -101,7 +101,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SavePdf(PdfInfo info)
|
||||
protected override void SavePdf(PdfInfoWorker info)
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
|
@ -17,16 +17,6 @@ namespace UniversityClientAppWorker.Controllers
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
/*[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Teachers = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
||||
return View(APIClient.GetRequest<List<PlanOfStudyViewModel>>($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}"));
|
||||
}*/
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
@ -243,5 +233,14 @@ namespace UniversityClientAppWorker.Controllers
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ReportPlanOfStudyViewModel()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ReportPlanOfStudyViewModel>>($"api/planofstudys/GetPlanOfStudyAndDisciplines"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
@using UniversityContracts.ViewModels
|
||||
@model List<ReportPlanOfStudyViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Отчёт по планам обучения";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">@ViewData["Title"]</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4 mt-2">
|
||||
<input type="submit" value="сохранить ворд" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>План обучения</th>
|
||||
<th>Форма обучения</th>
|
||||
<th>Дисциплины</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PlanOfStudyName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.FormOfStudy)
|
||||
</td>
|
||||
<td>
|
||||
@foreach (var discipline in item.Disciplines)
|
||||
{
|
||||
@Html.DisplayFor(modelItem => discipline)
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -37,6 +37,10 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home"
|
||||
asp-action="ReportPlanOfStudyViewModel">Отчёт по планам обучения</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using University.ViewModels;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
|
||||
namespace UniversityContracts.BusinessLogicContracts
|
||||
{
|
||||
@ -17,10 +18,15 @@ namespace UniversityContracts.BusinessLogicContracts
|
||||
/// <returns></returns>
|
||||
List<ReportTeacherViewModel> GetTeachers();
|
||||
List<ReportDisciplineViewModel> GetDisciplines(ReportBindingModel model);
|
||||
void SaveTeachersToWord(ReportBindingModel option);
|
||||
List<ReportPlanOfStudyViewModel> GetPlanOfStudyAndDisciplines();
|
||||
List<ReportPlanOfStudyAndStudentViewModel> GetPlanOfStudyAndStudents(ReportDateRangeBindingModel model);
|
||||
|
||||
void SaveTeachersToExcel(ReportBindingModel option);
|
||||
void SaveTeachersToWord(ReportBindingModel option);
|
||||
void SavePlanOfStudyToWord(ReportBindingModel option);
|
||||
void SaveTeachersToExcel(ReportBindingModel option);
|
||||
void SavePlanOfStudyToExcel(ReportBindingModel option);
|
||||
void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email);
|
||||
public void SendPlanOfStudyToEmail(ReportDateRangeBindingModel option, string email);
|
||||
|
||||
void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.BusinessLogicContracts;
|
||||
using UniversityContracts.BusinessLogicsContracts;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
@ -13,10 +14,12 @@ namespace UniversityRestApi.Controllers
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPlanOfStudyLogic _logic;
|
||||
public PlanOfStudysController(IPlanOfStudyLogic logic, ILogger<PlanOfStudysController> logger)
|
||||
private readonly IReportLogic _reportLogic;
|
||||
public PlanOfStudysController(IPlanOfStudyLogic logic, ILogger<PlanOfStudysController> logger, IReportLogic reportLogic)
|
||||
{
|
||||
_logic = logic;
|
||||
_logger = logger;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
[HttpGet]
|
||||
public List<PlanOfStudyViewModel>? GetPlanOfStudys(int userId)
|
||||
@ -44,7 +47,20 @@ namespace UniversityRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
[HttpGet]
|
||||
public List<ReportPlanOfStudyViewModel>? GetPlanOfStudyAndDisciplines()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportLogic.GetPlanOfStudyAndDisciplines();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка планов обучения");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreatePlanOfStudy(PlanOfStudyBindingModel model)
|
||||
{
|
||||
try
|
||||
@ -83,18 +99,5 @@ namespace UniversityRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void LinkTeacherToPlanOfStudy(int planOfStudyId, int teacherId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при связывании преподавателя с планом обучения");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
|
||||
using Microsoft.OpenApi.Models;
|
||||
using UniversityBusinessLogic.BusinessLogics;
|
||||
using UniversityBusinessLogic.OfficePackage;
|
||||
using UniversityBusinessLogic.OfficePackage.Implements;
|
||||
using UniversityBusinessLogics.BusinessLogics;
|
||||
using UniversityContracts.BusinessLogicContracts;
|
||||
using UniversityContracts.BusinessLogicsContracts;
|
||||
using UniversityContracts.StorageContracts;
|
||||
using UniversityDatabaseImplement.Implements;
|
||||
@ -19,6 +23,10 @@ builder.Services.AddTransient<IAttestationStorage, AttestationStorage>();
|
||||
builder.Services.AddTransient<IStatementStorage, StatementStorage>();
|
||||
builder.Services.AddTransient<IStudentStorage, StudentStorage>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToExcelWorker, SaveToExcelWorker>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordWorker, SaveToWordWorker>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfWorker, SaveToPdfWorker>();
|
||||
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
||||
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
||||
builder.Services.AddTransient<IDisciplineLogic, DisciplineLogic>();
|
||||
builder.Services.AddTransient<ITeacherLogic, TeacherLogic>();
|
||||
|
Loading…
Reference in New Issue
Block a user