Промежуточное
This commit is contained in:
parent
9736b196cf
commit
4e4d3ff5e1
@ -5,6 +5,7 @@ using UniversityContracts.BusinessLogicContracts;
|
|||||||
using UniversityContracts.SearchModels;
|
using UniversityContracts.SearchModels;
|
||||||
using UniversityContracts.StorageContracts;
|
using UniversityContracts.StorageContracts;
|
||||||
using UniversityContracts.ViewModels;
|
using UniversityContracts.ViewModels;
|
||||||
|
using UniversityBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
|
||||||
namespace UniversityBusinessLogics.BusinessLogics;
|
namespace UniversityBusinessLogics.BusinessLogics;
|
||||||
|
|
||||||
@ -206,17 +207,25 @@ public class ReportLogic : IReportLogic
|
|||||||
}
|
}
|
||||||
public void SavePlanOfStudyToExcel(ReportBindingModel option)
|
public void SavePlanOfStudyToExcel(ReportBindingModel option)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
/*_saveToExcelWorker.CreateReport(new ExcelInfoWorker
|
||||||
|
{
|
||||||
|
|
||||||
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePlanOfStudyToWord(ReportBindingModel option)
|
public void SavePlanOfStudyToWord(ReportBindingModel option)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_saveToWordWorker.CreateDoc(new WordInfoWorker
|
||||||
|
{
|
||||||
|
FileName = option.FileName,
|
||||||
|
Title = "Список планов обучения",
|
||||||
|
PlanOfStudys = GetPlanOfStudyAndDisciplines()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveTeachersToWord(ReportBindingModel option)
|
public void SaveTeachersToWord(ReportBindingModel option)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email)
|
public void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email)
|
||||||
@ -226,6 +235,9 @@ public class ReportLogic : IReportLogic
|
|||||||
|
|
||||||
public void SendPlanOfStudyToEmail(ReportDateRangeBindingModel option, string email)
|
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 abstract class AbstractSaveToExcelWorker
|
||||||
{
|
{
|
||||||
public void CreateReport(ExcelInfo info)
|
/*public void CreateReport(ExcelInfoWorker info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateExcel(info);
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
@ -73,10 +73,10 @@ namespace UniversityBusinessLogic.OfficePackage
|
|||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
SaveExcel(info);
|
SaveExcel(info);
|
||||||
}
|
}*/
|
||||||
protected abstract void CreateExcel(ExcelInfo info);
|
protected abstract void CreateExcel(ExcelInfoWorker info);
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
protected abstract void MergeCells(ExcelMergeParameters 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 abstract class AbstractSaveToPdfWorker
|
||||||
{
|
{
|
||||||
public void CreateDoc(PdfInfo info)
|
/*public void CreateDoc(PdfInfoWorker info)
|
||||||
{
|
{
|
||||||
CreatePdf(info);
|
CreatePdf(info);
|
||||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
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 });
|
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
||||||
|
|
||||||
SavePdf(info);
|
SavePdf(info);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Создание doc-файла
|
/// Создание doc-файла
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <param name="info"></param>
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
protected abstract void CreatePdf(PdfInfoWorker info);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Создание параграфа с текстом
|
/// Создание параграфа с текстом
|
||||||
@ -64,6 +64,6 @@ namespace UniversityBusinessLogic.OfficePackage
|
|||||||
/// Сохранение файла
|
/// Сохранение файла
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UniversityBusinessLogic.OfficePackage.HelperModels;
|
using UniversityBusinessLogic.OfficePackage.HelperModels;
|
||||||
using UniversityBusinessLogics.OfficePackage.HelperEnums;
|
using UniversityBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
namespace UniversityBusinessLogic.OfficePackage
|
namespace UniversityBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class ExcelInfo
|
public class ExcelInfoWorker
|
||||||
{
|
{
|
||||||
public string? FileName { get; set; }
|
public string? FileName { get; set; }
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
namespace UniversityBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class PdfInfo
|
public class PdfInfoWorker
|
||||||
{
|
{
|
||||||
public string? FileName { get; set; }
|
public string? FileName { get; set; }
|
||||||
public Stream? Stream { get; set; }
|
public Stream? Stream { get; set; }
|
@ -211,7 +211,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
|||||||
_ => 0U,
|
_ => 0U,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
protected override void CreateExcel(ExcelInfo info)
|
protected override void CreateExcel(ExcelInfoWorker info)
|
||||||
{
|
{
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
||||||
SpreadsheetDocumentType.Workbook);
|
SpreadsheetDocumentType.Workbook);
|
||||||
@ -343,7 +343,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
|||||||
};
|
};
|
||||||
mergeCells.Append(mergeCell);
|
mergeCells.Append(mergeCell);
|
||||||
}
|
}
|
||||||
protected override void SaveExcel(ExcelInfo info)
|
protected override void SaveExcel(ExcelInfoWorker info)
|
||||||
{
|
{
|
||||||
if (_spreadsheetDocument == null)
|
if (_spreadsheetDocument == null)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ namespace UniversityBusinessLogic.OfficePackage.Implements
|
|||||||
style.Font.Bold = true;
|
style.Font.Bold = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreatePdf(PdfInfo info)
|
protected override void CreatePdf(PdfInfoWorker info)
|
||||||
{
|
{
|
||||||
_document = new Document();
|
_document = new Document();
|
||||||
DefineStyles(_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)
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
{
|
{
|
||||||
|
@ -17,16 +17,6 @@ namespace UniversityClientAppWorker.Controllers
|
|||||||
{
|
{
|
||||||
_logger = logger;
|
_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]
|
[HttpGet]
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
@ -243,5 +233,14 @@ namespace UniversityClientAppWorker.Controllers
|
|||||||
Response.Redirect("Enter");
|
Response.Redirect("Enter");
|
||||||
return;
|
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">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home"
|
||||||
|
asp-action="ReportPlanOfStudyViewModel">Отчёт по планам обучения</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using University.ViewModels;
|
using University.ViewModels;
|
||||||
using UniversityContracts.BindingModels;
|
using UniversityContracts.BindingModels;
|
||||||
|
using UniversityContracts.ViewModels;
|
||||||
|
|
||||||
namespace UniversityContracts.BusinessLogicContracts
|
namespace UniversityContracts.BusinessLogicContracts
|
||||||
{
|
{
|
||||||
@ -17,10 +18,15 @@ namespace UniversityContracts.BusinessLogicContracts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<ReportTeacherViewModel> GetTeachers();
|
List<ReportTeacherViewModel> GetTeachers();
|
||||||
List<ReportDisciplineViewModel> GetDisciplines(ReportBindingModel model);
|
List<ReportDisciplineViewModel> GetDisciplines(ReportBindingModel model);
|
||||||
|
List<ReportPlanOfStudyViewModel> GetPlanOfStudyAndDisciplines();
|
||||||
|
List<ReportPlanOfStudyAndStudentViewModel> GetPlanOfStudyAndStudents(ReportDateRangeBindingModel model);
|
||||||
|
|
||||||
void SaveTeachersToWord(ReportBindingModel option);
|
void SaveTeachersToWord(ReportBindingModel option);
|
||||||
|
void SavePlanOfStudyToWord(ReportBindingModel option);
|
||||||
void SaveTeachersToExcel(ReportBindingModel option);
|
void SaveTeachersToExcel(ReportBindingModel option);
|
||||||
|
void SavePlanOfStudyToExcel(ReportBindingModel option);
|
||||||
void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email);
|
void SendDisciplinesToEmail(ReportDateRangeBindingModel option, string email);
|
||||||
|
public void SendPlanOfStudyToEmail(ReportDateRangeBindingModel option, string email);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using UniversityContracts.BindingModels;
|
using UniversityContracts.BindingModels;
|
||||||
|
using UniversityContracts.BusinessLogicContracts;
|
||||||
using UniversityContracts.BusinessLogicsContracts;
|
using UniversityContracts.BusinessLogicsContracts;
|
||||||
using UniversityContracts.SearchModels;
|
using UniversityContracts.SearchModels;
|
||||||
using UniversityContracts.ViewModels;
|
using UniversityContracts.ViewModels;
|
||||||
@ -13,10 +14,12 @@ namespace UniversityRestApi.Controllers
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IPlanOfStudyLogic _logic;
|
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;
|
_logic = logic;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_reportLogic = reportLogic;
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public List<PlanOfStudyViewModel>? GetPlanOfStudys(int userId)
|
public List<PlanOfStudyViewModel>? GetPlanOfStudys(int userId)
|
||||||
@ -44,6 +47,19 @@ namespace UniversityRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public List<ReportPlanOfStudyViewModel>? GetPlanOfStudyAndDisciplines()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _reportLogic.GetPlanOfStudyAndDisciplines();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения списка планов обучения");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreatePlanOfStudy(PlanOfStudyBindingModel model)
|
public void CreatePlanOfStudy(PlanOfStudyBindingModel model)
|
||||||
{
|
{
|
||||||
@ -83,18 +99,5 @@ namespace UniversityRestApi.Controllers
|
|||||||
throw;
|
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 Microsoft.OpenApi.Models;
|
||||||
using UniversityBusinessLogic.BusinessLogics;
|
using UniversityBusinessLogic.BusinessLogics;
|
||||||
|
using UniversityBusinessLogic.OfficePackage;
|
||||||
|
using UniversityBusinessLogic.OfficePackage.Implements;
|
||||||
|
using UniversityBusinessLogics.BusinessLogics;
|
||||||
|
using UniversityContracts.BusinessLogicContracts;
|
||||||
using UniversityContracts.BusinessLogicsContracts;
|
using UniversityContracts.BusinessLogicsContracts;
|
||||||
using UniversityContracts.StorageContracts;
|
using UniversityContracts.StorageContracts;
|
||||||
using UniversityDatabaseImplement.Implements;
|
using UniversityDatabaseImplement.Implements;
|
||||||
@ -19,6 +23,10 @@ builder.Services.AddTransient<IAttestationStorage, AttestationStorage>();
|
|||||||
builder.Services.AddTransient<IStatementStorage, StatementStorage>();
|
builder.Services.AddTransient<IStatementStorage, StatementStorage>();
|
||||||
builder.Services.AddTransient<IStudentStorage, StudentStorage>();
|
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<IUserLogic, UserLogic>();
|
||||||
builder.Services.AddTransient<IDisciplineLogic, DisciplineLogic>();
|
builder.Services.AddTransient<IDisciplineLogic, DisciplineLogic>();
|
||||||
builder.Services.AddTransient<ITeacherLogic, TeacherLogic>();
|
builder.Services.AddTransient<ITeacherLogic, TeacherLogic>();
|
||||||
|
Loading…
Reference in New Issue
Block a user