Compare commits
2 Commits
270de696f7
...
fc9c3d025e
| Author | SHA1 | Date | |
|---|---|---|---|
| fc9c3d025e | |||
| 2e5fb3972e |
@@ -7,7 +7,7 @@
|
||||
{
|
||||
{ "Анкета", "/questionnaire" },
|
||||
{ "Заявление", "/statement" },
|
||||
{ "Отправка", "/otchislenie/result" },
|
||||
{ "Отправка", "/result" },
|
||||
{ "Свобода", "/otchislenie/congratulation" }
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
case "statement":
|
||||
_lvl = 2;
|
||||
break;
|
||||
case "otchislenie/result":
|
||||
case "result":
|
||||
_lvl = 3;
|
||||
break;
|
||||
case "otchislenie/congratulation":
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
<div class="flex flex-col space-y-4 w-96 sm:w-[32rem]">
|
||||
<div class="card rounded-badge bg-base-200 p-4">
|
||||
<div class="grid grid-cols-2 gap-4 p-4">
|
||||
<button id="ИКТИБ" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<button id="1" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<img src="img/iktib.jpg" alt="ИКТИБ" class="w-full h-32 object-contain rounded-md" draggable="false">
|
||||
<p class="text-center mt-2">ИКТИБ</p>
|
||||
</button>
|
||||
<button id="ИРТСУ" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<button id="2" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<img src="img/irtsu.jpg" alt="ИРТСУ" class="w-full h-32 object-contain rounded-md" draggable="false">
|
||||
<p class="text-center mt-2">ИРТСУ</p>
|
||||
</button>
|
||||
<button id="ИНЭП" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<button id="3" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<img src="img/inep.jpg" alt="ИНЭП" class="w-full h-32 object-contain rounded-md" draggable="false">
|
||||
<p class="text-center mt-2">ИНЭП</p>
|
||||
</button>
|
||||
<button id="ИУЭС" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<button id="4" class="institut-button btn h-auto card bg-white p-4 select-none">
|
||||
<img src="img/iues.jpg" alt="ИУЭС" class="w-full h-32 object-contain rounded-md" draggable="false">
|
||||
<p class="text-center mt-2">ИУЭС</p>
|
||||
</button>
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
@using Otchinslator.Components.Layout
|
||||
@layout OtchislenieLayout
|
||||
@attribute [Authorize]
|
||||
@using BlazorPageScript
|
||||
|
||||
<PageTitle>Поздравляем! | Отчислятор 3000</PageTitle>
|
||||
<PageScript Src="./Components/Pages/Congratulation.razor.js"/>
|
||||
|
||||
<div>
|
||||
<div class="text-center mx-auto mb-4 font-bold text-4xl md:text-5xl w-max justify-center italic">Поздравляем!</div>
|
||||
<img class="w-96 h-96 mx-auto" src="img/party-popper.svg" alt=""/>
|
||||
<div class="flex flex-col space-y-4 lg:flex-row lg:space-x-4 lg:space-y-0 mt-4">
|
||||
<a href="/otchislenie/result" class="btn w-full lg:w-48 h-12 btn-primary rounded-full text-2xl">
|
||||
<a href="/result" class="btn w-full lg:w-48 h-12 btn-primary rounded-full text-2xl">
|
||||
Назад
|
||||
</a>
|
||||
<a href="/" class="btn w-full lg:w-48 h-12 btn-primary rounded-full text-2xl">
|
||||
|
||||
10
src/Otchinslator/Components/Pages/Congratulation.razor.js
Normal file
10
src/Otchinslator/Components/Pages/Congratulation.razor.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export function onLoad() {
|
||||
const url = '/getStatement';
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = url;
|
||||
document.body.appendChild(iframe);
|
||||
iframe.onload = function () {
|
||||
iframe.contentWindow.print();
|
||||
};
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
</dialog>
|
||||
@* TODO: Исправить расположение названия *@
|
||||
<div class="text-center font-bold text-4xl md:text-5xl w-max absolute left-1/2 -top-1/3 transform -translate-x-1/2 italic"><br>Отчислятор 3000<br><p class="text-2xl text-red-500">pre-alpha</p></div>
|
||||
<div class="text-center font-bold text-4xl md:text-5xl w-max absolute left-1/2 -top-1/3 transform -translate-x-1/2 italic"><br>Отчислятор 3000<br><p class="text-2xl text-red-500">alpha</p></div>
|
||||
<div class="flex flex-col space-y-4 w-96">
|
||||
<div class="card rounded-badge bg-base-200 p-4">
|
||||
<h2 class="card-title text-center text-3xl justify-center my-4">Мне нужно...</h2>
|
||||
|
||||
@@ -114,12 +114,11 @@
|
||||
|
||||
<div class="relative">
|
||||
<div
|
||||
class="text-center font-bold text-4xl md:text-5xl w-max absolute left-1/2 -top-1/3 transform -translate-x-1/2 italic">
|
||||
<br>Небольшая анкета
|
||||
class="text-center font-bold text-4xl md:text-5xl w-max absolute left-1/2 -top-1/4 transform -translate-x-1/2 italic">
|
||||
<br>Кто ты воин?
|
||||
</div>
|
||||
<div class="flex flex-col space-y-4 w-96">
|
||||
<div class="card rounded-badge bg-base-200 p-4">
|
||||
<h2 class="card-title text-center text-3xl justify-center my-4">Кто ты воин?</h2>
|
||||
<div class="join rounded-full justify-center">
|
||||
<input class="join-item btn bg-white w-1/3" type="radio" name="options" aria-label="Баклан"/>
|
||||
<input class="join-item btn bg-white w-1/3" type="radio" name="options" aria-label="Спец"/>
|
||||
@@ -133,6 +132,10 @@
|
||||
<input class="join-item btn bg-white w-1/5" type="radio" name="kurs" aria-label="4"/>
|
||||
<input class="join-item btn bg-white w-1/5" type="radio" name="kurs" aria-label="5"/>
|
||||
</div>
|
||||
<h2 class="text-center text-2xl justify-center my-4">Направление</h2>
|
||||
<select id="speciality" class="select rounded-full justify-center bg-white border-none">
|
||||
<option value="0" disabled selected>Выберите направление</option>
|
||||
</select>
|
||||
<div class="flex justify-center gap-12 items-center">
|
||||
<div>
|
||||
<h2 class="text-center text-2xl justify-center my-4">Платник?</h2>
|
||||
|
||||
@@ -19,6 +19,7 @@ export function onLoad() {
|
||||
}
|
||||
});
|
||||
|
||||
const specialitySelect = document.getElementById('speciality');
|
||||
const continueButton = document.querySelector('a[href="/statement"]');
|
||||
const options = document.querySelectorAll('input[name="options"]');
|
||||
const kursElements = document.querySelectorAll('input[name="kurs"]');
|
||||
@@ -31,6 +32,26 @@ export function onLoad() {
|
||||
const kursElement4 = Array.from(kursElements).find(k => k.getAttribute('aria-label') === '4');
|
||||
const kursElement5 = Array.from(kursElements).find(k => k.getAttribute('aria-label') === '5');
|
||||
|
||||
fetch('/api/getSpecialities?institutId=' + localStorage.getItem('institut'))
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const specialities = data.filter(speciality => speciality.name === 'Программная инженерия');
|
||||
const otherSpecialities = data.filter(speciality => speciality.name !== 'Программная инженерия');
|
||||
|
||||
specialities.concat(otherSpecialities).forEach(speciality => {
|
||||
const option = document.createElement('option');
|
||||
option.value = speciality.id;
|
||||
option.text = speciality.code + " " + (speciality.name.includes('Программная инженерия') ? '🏆 ' + speciality.name : speciality.name);
|
||||
specialitySelect.add(option);
|
||||
});
|
||||
|
||||
let specialityData = localStorage.getItem('speciality');
|
||||
if (specialityData) {
|
||||
specialitySelect.value = specialityData;
|
||||
}
|
||||
validateForm();
|
||||
});
|
||||
|
||||
// Загрузка данных из хранилища если данные есть
|
||||
function loadFromLocalStorage() {
|
||||
const phoneNumber = localStorage.getItem('phoneNumber');
|
||||
@@ -71,6 +92,7 @@ export function onLoad() {
|
||||
const isKursSelected = Array.from(kursElements).some(k => k.checked);
|
||||
const isPhoneNumberValid = phoneNumberInput.value.length === 12;
|
||||
|
||||
// Блокировка курсов в зависимости от выбранного типа обучения
|
||||
if (isOptionSelected) {
|
||||
var typeOfEducation = (Array.from(options).find(option => option.checked).getAttribute('aria-label'));
|
||||
if (typeOfEducation === "Баклан") {
|
||||
@@ -101,25 +123,27 @@ export function onLoad() {
|
||||
}
|
||||
}
|
||||
|
||||
if (isOptionSelected && isKursSelected && isPhoneNumberValid) {
|
||||
|
||||
if (isOptionSelected && isKursSelected && isPhoneNumberValid && specialitySelect.value !== '0') {
|
||||
continueButton.classList.remove('btn-disabled');
|
||||
localStorage.setItem('phoneNumber', phoneNumberInput.value);
|
||||
localStorage.setItem('paid', checkboxPaid.checked);
|
||||
localStorage.setItem('ochno', !checkboxOchno.checked);
|
||||
localStorage.setItem('option', typeOfEducation);
|
||||
localStorage.setItem('kurs', Array.from(kursElements).find(k => k.checked).getAttribute('aria-label'));
|
||||
localStorage.setItem('speciality', specialitySelect.value);
|
||||
} else {
|
||||
continueButton.classList.add('btn-disabled');
|
||||
}
|
||||
}
|
||||
|
||||
loadFromLocalStorage();
|
||||
|
||||
options.forEach(option => option.addEventListener('change', validateForm));
|
||||
kursElements.forEach(k => k.addEventListener('change', validateForm));
|
||||
phoneNumberInput.addEventListener('input', validateForm);
|
||||
checkboxPaid.addEventListener('change', validateForm);
|
||||
checkboxOchno.addEventListener('change', validateForm);
|
||||
specialitySelect.addEventListener('change', validateForm);
|
||||
|
||||
loadFromLocalStorage();
|
||||
validateForm();
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
@page "/otchislenie/result"
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@page "/result"
|
||||
@using Otchinslator.Components.Layout
|
||||
@layout OtchislenieLayout
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageTitle>Уже почти | Отчислятор 3000</PageTitle>
|
||||
|
||||
<dialog id="SendToDirectorModal" class="modal modal-bottom sm:modal-middle">
|
||||
<div class="modal-box">
|
||||
<h3 class="text-lg font-bold">Отправка письма</h3>
|
||||
<p class="py-4">Вы уверены что хотите отправить ваше заявление директору?<br>Отменить отправку невозможно!</p>
|
||||
<div class="modal-action">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-primary">Нет</button>
|
||||
<a href="/otchislenie/congratulation" class="btn btn-error">Да</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
@* <dialog id="SendToDirectorModal" class="modal modal-bottom sm:modal-middle"> *@
|
||||
@* <div class="modal-box"> *@
|
||||
@* <h3 class="text-lg font-bold">Отправка письма</h3> *@
|
||||
@* <p class="py-4">Вы уверены что хотите отправить ваше заявление директору?<br>Отменить отправку невозможно!</p> *@
|
||||
@* <div class="modal-action"> *@
|
||||
@* <form method="dialog"> *@
|
||||
@* <button class="btn btn-primary">Нет</button> *@
|
||||
@* <a href="/otchislenie/congratulation" class="btn btn-error">Да</a> *@
|
||||
@* </form> *@
|
||||
@* </div> *@
|
||||
@* </div> *@
|
||||
@* </dialog> *@
|
||||
|
||||
<div class="relative">
|
||||
<div
|
||||
@@ -25,16 +25,15 @@
|
||||
<br>Заявление готово
|
||||
</div>
|
||||
<object data="/getStatement" type="application/pdf" class="w-96 sm:w-[32rem] h-[30rem] rounded-2xl">
|
||||
<p class="text-center">Не удалось отобразить заявление, попробуйте скачать <a href="/getStatement">(тык)</a></p>
|
||||
<p class="text-center">Не удалось отобразить заявление, попробуйте скачать <a href="/getStatement">(тык) или открыть в браузере на основе Firefox</a></p>
|
||||
</object>
|
||||
<div class="join w-full mt-4 flex gap-2">
|
||||
<a href="/" class="relative btn btn-primary rounded-full flex-grow-0 w-[3rem] h-[3rem]">
|
||||
<img class="absolute p-3" src="img/exit.svg" alt=""/>
|
||||
</a>
|
||||
<button onclick="SendToDirectorModal.showModal()"
|
||||
class="btn btn-primary rounded-full flex-grow w-30">
|
||||
Отправить директору
|
||||
</button>
|
||||
<a href="/otchislenie/congratulation" class="btn btn-primary rounded-full flex-grow w-30">
|
||||
Печать
|
||||
</a>
|
||||
<a id="downloadPDF" target="_blank" href="/getStatement"
|
||||
class="btn btn-primary bg-base-200 border-base-200 rounded-full flex-grow-0 w-[3rem]">
|
||||
@* Скачать PDF *@
|
||||
@@ -43,37 +42,4 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@* <div class="card rounded-badge bg-base-200 p-4"> *@
|
||||
@* <div class="flex flex-col space-y-4 mt-1"> *@
|
||||
@* <button onclick="SendToDirectorModal.showModal()" *@
|
||||
@* class="btn h-16 btn-primary rounded-full text-2xl relative"> *@
|
||||
@* Отправить директору *@
|
||||
@* </button> *@
|
||||
@* <a id="downloadPDF" target="_blank" href="/getStatement" *@
|
||||
@* class="btn h-16 btn-primary rounded-full text-2xl relative"> *@
|
||||
@* Скачать PDF *@
|
||||
@* <div class="absolute bg-base-200 rounded-full right-1 w-14 h-14"> *@
|
||||
@* <img class="p-3" src="img/pdf.svg" alt=""/> *@
|
||||
@* </div> *@
|
||||
@* </a> *@
|
||||
@* </div> *@
|
||||
@* </div> *@
|
||||
@* </div> *@
|
||||
@* $1$ TODO: Сделать адаптив #1# *@
|
||||
@* <div class="mt-9 flex flex-col space-y-4 lg:flex-row lg:space-x-4 lg:space-y-0 w-96 mx-auto" > *@
|
||||
@* <div class="mt-9 flex flex-col space-y-4 w-96 mx-auto"> *@
|
||||
@* <a href="/statement" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@
|
||||
@* Назад *@
|
||||
@* </a> *@
|
||||
@* <a href="/" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@
|
||||
@* Выход *@
|
||||
@* </a> *@
|
||||
@* </div> *@
|
||||
<div class="w-96 mx-auto mt-6">
|
||||
<a id="congratulation" href="/otchislenie/congratulation"
|
||||
class="btn w-full h-16 btn-primary rounded-full text-2xl hidden">
|
||||
Страница поздравления
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,13 +27,17 @@ export function onLoad() {
|
||||
console.log('Начата генерация заявления');
|
||||
generateStatementModal.showModal();
|
||||
|
||||
console.log(localStorage.getItem('ochno'))
|
||||
|
||||
const data = {
|
||||
"phone": "+7 " + localStorage.getItem('phoneNumber'),
|
||||
"kurs": localStorage.getItem('kurs'),
|
||||
"isFreeEducation": localStorage.getItem('paid') === "false",
|
||||
"isOchno": localStorage.getItem('ochno') === true,
|
||||
"speciality": optionMapping[localStorage.getItem('option')],
|
||||
"reason": localStorage.getItem('statement')
|
||||
"isOchno": localStorage.getItem('ochno') === "true",
|
||||
"typeOfEducation": optionMapping[localStorage.getItem('option')],
|
||||
"reason": localStorage.getItem('statement'),
|
||||
"institut": localStorage.getItem('institut'),
|
||||
"direction": localStorage.getItem('speciality')
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -47,7 +51,7 @@ export function onLoad() {
|
||||
|
||||
if (response.ok) {
|
||||
console.log('Заявление успешно сгенерировано');
|
||||
location.href='otchislenie/result';
|
||||
location.href='/result';
|
||||
} else {
|
||||
hideLoadingModal();
|
||||
console.log('Ошибка при генерации заявления');
|
||||
|
||||
26
src/Otchinslator/Controllers/PublicDataController.cs
Normal file
26
src/Otchinslator/Controllers/PublicDataController.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Otchinslator.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class PublicDataController(DatabaseContext db) : Controller
|
||||
{
|
||||
[HttpGet("/api/getSpecialities")]
|
||||
public IActionResult GetSpecialities(int institutId)
|
||||
{
|
||||
if (institutId <= 0 || institutId > 4)
|
||||
{
|
||||
return BadRequest("Некорректный институт\nДоступные институты: 1 - ИКТИБ, 2 - ИРТСУ, 3 - ИУЭС, 4 - ИНЭП");
|
||||
}
|
||||
|
||||
var specialities = db.Specialties.Where(s => s.InstitutId == institutId).ToList();
|
||||
var specialitiesDto = specialities.Select(s => new
|
||||
{
|
||||
s.Id,
|
||||
s.Name,
|
||||
s.Code,
|
||||
});
|
||||
|
||||
return Ok(specialitiesDto);
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@ namespace Otchinslator;
|
||||
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class StatementController(IStatementGenerator statementGenerator, IConfiguration configuration) : Controller
|
||||
public class StatementController(IStatementGenerator statementGenerator, IConfiguration configuration, DatabaseContext db) : Controller
|
||||
{
|
||||
[HttpPost("/generateStatement")]
|
||||
public async Task<IActionResult> GenerateStatement(UserDTO userDto)
|
||||
{
|
||||
var speciality = userDto.speciality switch
|
||||
var speciality = userDto.typeOfEducation switch
|
||||
{
|
||||
1 => SpecialityType.Bakalavriat,
|
||||
2 => SpecialityType.Magistatura,
|
||||
3 => SpecialityType.Specialitet,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
_ => throw new ArgumentOutOfRangeException() // Модель валидации не позволит передать некорректное значение
|
||||
};
|
||||
|
||||
if (speciality == SpecialityType.Bakalavriat && userDto.kurs > 4)
|
||||
@@ -45,6 +45,13 @@ public class StatementController(IStatementGenerator statementGenerator, IConfig
|
||||
|
||||
userFIO = petrovich.InflectFirstNameTo(Case.Genitive) + " " + petrovich.InflectLastNameTo(Case.Genitive) + " " + petrovich.InflectMiddleNameTo(Case.Genitive);
|
||||
|
||||
var direction = db.Specialties.FirstOrDefault(x => x.Id == userDto.direction);
|
||||
if (direction == null)
|
||||
{
|
||||
Utils.LogToTg("Походу ломают `direction == null`", configuration);
|
||||
return BadRequest("Некорректное направление");
|
||||
}
|
||||
|
||||
var userData = new UserData
|
||||
{
|
||||
reason = userDto.reason,
|
||||
@@ -54,7 +61,8 @@ public class StatementController(IStatementGenerator statementGenerator, IConfig
|
||||
kurs = userDto.kurs,
|
||||
isFreeEducation = userDto.isFreeEducation,
|
||||
isOchno = userDto.isOchno,
|
||||
speciality = speciality
|
||||
speciality = speciality,
|
||||
direction = direction.Code + " " + direction.Name.ToLower()
|
||||
};
|
||||
var statement = await statementGenerator.GenerateStatementAsync(userData);
|
||||
var pdf = await statementGenerator.ConvertToPDFAsync(statement);
|
||||
@@ -80,11 +88,4 @@ public class StatementController(IStatementGenerator statementGenerator, IConfig
|
||||
return File(outStream, "application/pdf");
|
||||
}
|
||||
|
||||
// [HttpGet("/getUserData")]
|
||||
// public async Task<IActionResult> getUserdata()
|
||||
// {
|
||||
// var userFIO = User.Claims.FirstOrDefault(x => x.Type == "name")?.Value;
|
||||
// var userdata = User.Identities.FirstOrDefault()?.Claims.Select(x => new {x.Type, x.Value});
|
||||
// return Ok(userdata);
|
||||
// }
|
||||
}
|
||||
@@ -20,6 +20,11 @@ public class UserDTO
|
||||
public bool isOchno { get; set; }
|
||||
[Required]
|
||||
[Range(1, 3, ErrorMessage = "Некорректный тип специальности")]
|
||||
public int speciality { get; set; }
|
||||
public int typeOfEducation { get; set; }
|
||||
[Required]
|
||||
[Range(1, 4, ErrorMessage = "Некорректный институт")]
|
||||
public int institut { get; set; }
|
||||
[Required]
|
||||
public int direction { get; set; }
|
||||
|
||||
}
|
||||
|
||||
53
src/Otchinslator/DatabaseContext.cs
Normal file
53
src/Otchinslator/DatabaseContext.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Otchinslator.Tables;
|
||||
|
||||
namespace Otchinslator;
|
||||
|
||||
public class DatabaseContext : DbContext
|
||||
{
|
||||
public DbSet<Institut> Instituts { get; set; }
|
||||
public DbSet<Specialty> Specialties { get; set; }
|
||||
public string DbPath { get; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Institut>().HasKey(i => i.Id);
|
||||
modelBuilder.Entity<Specialty>().HasKey(s => s.Id);
|
||||
|
||||
modelBuilder.Entity<Institut>().HasData(
|
||||
new Institut() { Id = 1, ShortName = "ИКТИБ", Name = "Институт компьютерных технологий и информационной безопасности" },
|
||||
new Institut() { Id = 2, ShortName = "ИРТСУ", Name = "Институт радиотехнических систем и управления" },
|
||||
new Institut() { Id = 3, ShortName = "ИУЭС", Name = "Институт управления в экономических, экологических и социальных системах" },
|
||||
new Institut() { Id = 4, ShortName = "ИНЭП", Name = "Институт нанотехнологий, электроники и приборостроения" }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<Specialty>().HasData(
|
||||
// ИКТИБ
|
||||
// Бакалавриат
|
||||
new Specialty() { Id = 1, Name = "Математическое обеспечение и администрирование информационных систем", Code = "02.03.03", InstitutId = 1 },
|
||||
new Specialty() { Id = 2, Name = "Информатика и вычислительная техника", Code = "09.03.01", InstitutId = 1 }, // + заочка
|
||||
new Specialty() { Id = 3, Name = "Информационные системы и технологии", Code = "09.03.02", InstitutId = 1 },
|
||||
new Specialty() { Id = 4, Name = "Программная инженерия", Code = "09.03.04", InstitutId = 1 },
|
||||
new Specialty() { Id = 5, Name = "Информационная безопасность", Code = "10.03.01", InstitutId = 1 },
|
||||
new Specialty() { Id = 6, Name = "Системный анализ и управление", Code = "27.03.03", InstitutId = 1 },
|
||||
// Специалитет
|
||||
new Specialty() { Id = 7, Name = "Применение и эксплуатация автоматизированных систем специального назначения", Code = "09.05.01", InstitutId = 1 },
|
||||
new Specialty() { Id = 8, Name = "Информационная безопасность телекоммуникационных систем", Code = "10.05.02", InstitutId = 1 },
|
||||
new Specialty() { Id = 9, Name = "Информационная безопасность автоматизированных систем", Code = "10.05.03", InstitutId = 1 },
|
||||
new Specialty() { Id = 10, Name = "Безопасность информационных технологий в правоохранительной сфере", Code = "10.05.05", InstitutId = 1 }
|
||||
);
|
||||
}
|
||||
|
||||
public DatabaseContext()
|
||||
{
|
||||
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var folder = Path.Join(baseDirectory, "Data");
|
||||
if (!Directory.Exists(folder))
|
||||
Directory.CreateDirectory(folder);
|
||||
|
||||
DbPath = Path.Join(folder, "database.db");
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
=> options.UseSqlite($"Data Source={DbPath}");
|
||||
}
|
||||
@@ -4,8 +4,10 @@ using Gotenberg.Sharp.API.Client.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Identity.Web;
|
||||
using Microsoft.Identity.Web.UI;
|
||||
using Otchinslator;
|
||||
using Otchinslator.Components;
|
||||
using Otchinslator.Services;
|
||||
|
||||
@@ -26,6 +28,9 @@ builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
options.KnownProxies.Clear();
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
});
|
||||
|
||||
builder.Services.AddDbContext<DatabaseContext>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
@@ -18,7 +18,7 @@ public class StatementGenerator(GotenbergSharpClient gotenbergSharpClient) : ISt
|
||||
private const string SpecialitetText = "специалитета по специальности";
|
||||
private const string BakalavriatText = "бакалавриата по направлению подготовки";
|
||||
private const string MagistaturaText = "магистратуры по направлению подготовки";
|
||||
private const string FreeEducationText = "обучение за счет ассигнований федерального бюджета";
|
||||
private const string FreeEducationText = "за счет ассигнований федерального бюджета";
|
||||
private const string PaidEducationText = "на договорной (платной) основе";
|
||||
|
||||
public async Task<MemoryStream> GenerateStatementAsync(UserData userData)
|
||||
@@ -68,7 +68,7 @@ public class StatementGenerator(GotenbergSharpClient gotenbergSharpClient) : ISt
|
||||
SpecialityType.Magistatura => MagistaturaText,
|
||||
SpecialityType.Specialitet => SpecialitetText,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
} + " ничего не делания";
|
||||
} + " " + userData.direction;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
10
src/Otchinslator/Tables/Institut.cs
Normal file
10
src/Otchinslator/Tables/Institut.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Otchinslator.Tables;
|
||||
|
||||
public class Institut
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
|
||||
public List<Specialty> Specialties { get; } = new();
|
||||
}
|
||||
10
src/Otchinslator/Tables/Specialty.cs
Normal file
10
src/Otchinslator/Tables/Specialty.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Otchinslator.Tables;
|
||||
|
||||
public class Specialty
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int InstitutId { get; set; }
|
||||
public Institut Institut { get; set; }
|
||||
}
|
||||
Binary file not shown.
@@ -12,7 +12,8 @@ public class UserData
|
||||
int kurs,
|
||||
bool isFreeEducation,
|
||||
bool isOchno,
|
||||
SpecialityType speciality)
|
||||
SpecialityType speciality,
|
||||
string direction)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,6 +29,7 @@ public class UserData
|
||||
public bool isFreeEducation { get; set; }
|
||||
public bool isOchno { get; set; }
|
||||
public SpecialityType speciality { get; set; }
|
||||
public string direction { get; set; }
|
||||
}
|
||||
|
||||
public enum SpecialityType
|
||||
|
||||
Reference in New Issue
Block a user