2024-05-29 21:59:17 +04:00
|
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
2024-05-30 00:22:02 +04:00
|
|
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
2024-04-29 19:06:11 +04:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-05-27 00:50:40 +04:00
|
|
|
|
using PlumbingRepairClientApp;
|
2024-04-29 19:06:11 +04:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using UniversityClientAppWorker.Models;
|
2024-05-27 00:50:40 +04:00
|
|
|
|
using UniversityContracts.BindingModels;
|
|
|
|
|
using UniversityContracts.ViewModels;
|
2024-05-30 00:22:02 +04:00
|
|
|
|
using UniversityDatabaseImplement.Models;
|
2024-04-29 19:06:11 +04:00
|
|
|
|
using UniversityDataModels.Enums;
|
2024-05-28 17:08:06 +04:00
|
|
|
|
using UniversityDataModels.Models;
|
2024-05-29 19:26:11 +04:00
|
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
2024-04-29 19:06:11 +04:00
|
|
|
|
|
|
|
|
|
namespace UniversityClientAppWorker.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<HomeController> _logger;
|
|
|
|
|
|
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
2024-05-28 19:50:44 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<IActionResult> Index()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Teachers = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
|
|
|
|
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
|
|
|
|
|
|
|
|
|
return View(planOfStudys);
|
2024-04-29 19:06:11 +04:00
|
|
|
|
}
|
2024-05-28 19:50:44 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<IActionResult> InfoPlanOfStudy(int id)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
var obj1 = APIClient.GetRequest<List<TeacherViewModel>>($"api/teacher/getallteachers");
|
|
|
|
|
ViewBag.Teachers = obj1;
|
|
|
|
|
|
|
|
|
|
var obj = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={id}&userId={APIClient.User.Id}");
|
|
|
|
|
return View(obj);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreatePlanOfStudy(string profile, string formOfStudy, List<int> teacherIds)
|
2024-04-29 19:06:11 +04:00
|
|
|
|
{
|
2024-05-27 00:50:40 +04:00
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(formOfStudy) || string.IsNullOrEmpty(profile))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/planofstudys/createplanofstudy", new PlanOfStudyBindingModel
|
|
|
|
|
{
|
|
|
|
|
Profile = profile,
|
|
|
|
|
FormOfStudy = formOfStudy,
|
2024-05-28 19:50:44 +04:00
|
|
|
|
UserId = APIClient.User.Id,
|
|
|
|
|
PlanOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null)
|
|
|
|
|
});
|
2024-05-27 00:50:40 +04:00
|
|
|
|
Response.Redirect("Index");
|
2024-04-29 19:06:11 +04:00
|
|
|
|
}
|
2024-05-27 17:32:21 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeletePlanOfStudy(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/planofstudys/deleteplanofstudy", new PlanOfStudyBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
}
|
2024-05-28 17:08:06 +04:00
|
|
|
|
[HttpPost]
|
2024-05-28 19:50:44 +04:00
|
|
|
|
public void UpdatePlanOfStudy(int id, string profile, string formOfStudy, List<int> teacherIds)
|
2024-05-27 17:32:21 +04:00
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
2024-05-29 02:49:07 +04:00
|
|
|
|
var planOfStudyTeachers = teacherIds.ToDictionary(id => id, id => (ITeacherModel)null);
|
2024-05-27 17:32:21 +04:00
|
|
|
|
APIClient.PostRequest("api/planofstudys/updateplanofstudy", new PlanOfStudyBindingModel
|
|
|
|
|
{
|
2024-05-28 17:08:06 +04:00
|
|
|
|
Id = id,
|
|
|
|
|
Profile = profile,
|
2024-05-28 19:50:44 +04:00
|
|
|
|
FormOfStudy = formOfStudy,
|
2024-05-29 02:49:07 +04:00
|
|
|
|
PlanOfStudyTeachers = planOfStudyTeachers
|
|
|
|
|
});
|
2024-05-27 17:32:21 +04:00
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
}
|
2024-05-28 17:08:06 +04:00
|
|
|
|
[HttpGet]
|
2024-05-27 00:50:40 +04:00
|
|
|
|
public IActionResult Privacy()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIClient.User);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Privacy(string login, string password, string email)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/user/updatedata", new UserViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = APIClient.User.Id,
|
|
|
|
|
Email = email,
|
|
|
|
|
Login = login,
|
|
|
|
|
Password = password
|
|
|
|
|
});
|
2024-04-29 19:06:11 +04:00
|
|
|
|
|
2024-05-27 00:50:40 +04:00
|
|
|
|
APIClient.User.Login = login;
|
|
|
|
|
APIClient.User.Email = email;
|
|
|
|
|
APIClient.User.Password = password;
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Attestations()
|
2024-04-29 19:06:11 +04:00
|
|
|
|
{
|
2024-05-27 00:50:40 +04:00
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-28 00:44:23 +04:00
|
|
|
|
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
|
|
|
|
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
2024-05-29 02:49:07 +04:00
|
|
|
|
var obj = APIClient.GetRequest<List<AttestationViewModel>>($"api/attestation/getattestations?userId={APIClient.User.Id}");
|
|
|
|
|
return View(obj);
|
2024-04-29 19:06:11 +04:00
|
|
|
|
}
|
2024-05-28 00:44:23 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateAttestation(string formOfEvaluation, int student, AttestationScore score)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-29 21:59:17 +04:00
|
|
|
|
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
|
|
|
|
|
|
|
|
|
if(Student == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-28 00:44:23 +04:00
|
|
|
|
APIClient.PostRequest("api/attestation/createattestation", new AttestationBindingModel
|
|
|
|
|
{
|
|
|
|
|
UserId = APIClient.User.Id,
|
|
|
|
|
FormOfEvaluation = formOfEvaluation,
|
|
|
|
|
StudentId = student,
|
2024-05-29 21:59:17 +04:00
|
|
|
|
StudentName = Student.Name,
|
2024-05-28 00:44:23 +04:00
|
|
|
|
Score = score
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Attestations");
|
2024-05-29 21:59:17 +04:00
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
2024-05-29 22:48:30 +04:00
|
|
|
|
public IActionResult InfoAttestation(int id)
|
2024-05-29 21:59:17 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Students = APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}");
|
|
|
|
|
ViewBag.AttestationScore = Enum.GetValues(typeof(AttestationScore)).Cast<AttestationScore>();
|
2024-05-29 22:48:30 +04:00
|
|
|
|
var obj = APIClient.GetRequest<AttestationViewModel>($"api/attestation/getattestation?userId={APIClient.User.Id}&id={id}");
|
2024-05-29 21:59:17 +04:00
|
|
|
|
return View(obj);
|
2024-05-28 00:44:23 +04:00
|
|
|
|
}
|
2024-05-29 22:48:30 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateAttestation(int id, string formOfEvaluation, int student, AttestationScore score)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(formOfEvaluation) || student == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
var Student = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={student}");
|
|
|
|
|
|
|
|
|
|
if (Student == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/attestation/updateattestation", new AttestationBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
FormOfEvaluation = formOfEvaluation,
|
|
|
|
|
StudentId = student,
|
|
|
|
|
StudentName = Student.Name,
|
|
|
|
|
Score = score
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Attestations");
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteAttestation(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/attestation/deleteattestation", new PlanOfStudyBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Attestations");
|
|
|
|
|
}
|
2024-05-28 00:44:23 +04:00
|
|
|
|
[HttpGet]
|
2024-05-29 02:49:07 +04:00
|
|
|
|
public async Task<IActionResult> Students()
|
2024-05-27 00:50:40 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-29 02:49:07 +04:00
|
|
|
|
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
2024-05-27 22:35:38 +04:00
|
|
|
|
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
2024-05-29 02:49:07 +04:00
|
|
|
|
ViewBag.PlanOfStudys = planOfStudys;
|
2024-05-27 17:32:21 +04:00
|
|
|
|
return View(APIClient.GetRequest<List<StudentViewModel>>($"api/student/getstudents?userId={APIClient.User.Id}"));
|
2024-05-27 00:50:40 +04:00
|
|
|
|
}
|
2024-05-27 22:35:38 +04:00
|
|
|
|
[HttpPost]
|
2024-05-30 00:22:02 +04:00
|
|
|
|
public async Task<IActionResult> CreateStudent(string name, int planOfStudy, string phoneNumber)
|
2024-05-27 22:35:38 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-30 00:22:02 +04:00
|
|
|
|
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
|
|
|
|
if(PlanOfStudy == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-27 22:35:38 +04:00
|
|
|
|
APIClient.PostRequest("api/student/createstudent", new StudentBindingModel
|
|
|
|
|
{
|
|
|
|
|
UserId = APIClient.User.Id,
|
|
|
|
|
Name = name,
|
|
|
|
|
PlanOfStudyId = planOfStudy,
|
2024-05-30 00:22:02 +04:00
|
|
|
|
PlanOfStudyProfile = PlanOfStudy.Profile,
|
2024-05-27 22:35:38 +04:00
|
|
|
|
PhoneNumber = phoneNumber,
|
|
|
|
|
|
|
|
|
|
});
|
2024-05-30 00:22:02 +04:00
|
|
|
|
return Redirect("/Home/Students");
|
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<IActionResult> InfoStudent(int id)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
if(id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
var planOfStudys = await APIClient.GetRequestPlanOfStudyAsync<List<PlanOfStudyViewModel>>
|
|
|
|
|
($"api/planofstudys/getplanofstudys?userId={APIClient.User.Id}");
|
|
|
|
|
ViewBag.PlanOfStudys = planOfStudys;
|
|
|
|
|
var obj = APIClient.GetRequest<StudentViewModel>($"api/student/getstudent?userId={APIClient.User.Id}&studentId={id}");
|
|
|
|
|
return View(obj);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<IActionResult> UpdateStudent(int id, string name, int planOfStudy, string phoneNumber)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if(id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(name) || planOfStudy == 0 || string.IsNullOrEmpty(phoneNumber))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
var PlanOfStudy = await APIClient.GetRequestPlanOfStudyAsync<PlanOfStudyViewModel>($"api/planofstudys/getplanofstudy?id={planOfStudy}");
|
|
|
|
|
if (PlanOfStudy == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/student/updatestudent", new StudentBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name,
|
|
|
|
|
PlanOfStudyId = planOfStudy,
|
|
|
|
|
PlanOfStudyProfile = PlanOfStudy.Profile,
|
|
|
|
|
PhoneNumber = phoneNumber,
|
|
|
|
|
});
|
|
|
|
|
return Redirect("/Home/Students");
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteStudent(int id)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("id <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/student/deletestudent", new StudentBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Students");
|
2024-05-27 22:35:38 +04:00
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
2024-05-27 00:50:40 +04:00
|
|
|
|
public IActionResult Enter()
|
2024-04-29 19:06:11 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2024-05-27 00:50:40 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Register()
|
2024-04-29 19:06:11 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
|
public IActionResult Error()
|
|
|
|
|
{
|
|
|
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
|
|
|
}
|
2024-05-27 00:50:40 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Enter(string login, string password)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/user/loginworker?login={login}&password={password}");
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Register(string login, string password, string email)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/user/registerworker", new UserBindingModel
|
|
|
|
|
{
|
|
|
|
|
Email = email,
|
|
|
|
|
Login = login,
|
|
|
|
|
Password = password
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("Enter");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-05-28 21:40:18 +04:00
|
|
|
|
[HttpGet]
|
2024-05-29 20:33:49 +04:00
|
|
|
|
public IActionResult GetWordFile()
|
|
|
|
|
{
|
|
|
|
|
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\<5C><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.docx",
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
|
|
"<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.docx");
|
|
|
|
|
}
|
|
|
|
|
public IActionResult GetExcelFile()
|
|
|
|
|
{
|
|
|
|
|
return PhysicalFile($"C:\\Users\\{Environment.UserName}\\Downloads\\<5C><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.xlsx",
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
"<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.xlsx");
|
|
|
|
|
}
|
|
|
|
|
[HttpGet]
|
2024-05-29 02:49:07 +04:00
|
|
|
|
public IActionResult ReportPlanOfStudys()
|
2024-05-28 21:40:18 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2024-05-29 02:49:07 +04:00
|
|
|
|
return View("ReportPlanOfStudys", APIClient.GetRequest<List<ReportPlanOfStudyViewModel>>($"api/planofstudys/getplanofstudyanddisciplines?userId={APIClient.User.Id}"));
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
2024-05-29 20:33:49 +04:00
|
|
|
|
public IActionResult ReportPlanOfStudys(string type)
|
2024-05-29 02:49:07 +04:00
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(type))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == "docx")
|
|
|
|
|
{
|
|
|
|
|
APIClient.PostRequest("api/planofstudys/loadreporttoword", new ReportBindingModel
|
|
|
|
|
{
|
2024-05-29 21:06:39 +04:00
|
|
|
|
FileName = "C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<5C><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.docx"
|
2024-05-29 02:49:07 +04:00
|
|
|
|
});
|
2024-05-29 20:33:49 +04:00
|
|
|
|
return GetWordFile();
|
2024-05-29 02:49:07 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == "xlsx")
|
|
|
|
|
{
|
|
|
|
|
APIClient.PostRequest("api/planofstudys/loadreporttoexcel", new ReportBindingModel
|
|
|
|
|
{
|
2024-05-29 21:06:39 +04:00
|
|
|
|
FileName = "C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<5C><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.xlsx"
|
2024-05-29 02:49:07 +04:00
|
|
|
|
});
|
2024-05-29 20:33:49 +04:00
|
|
|
|
return GetExcelFile();
|
2024-05-29 02:49:07 +04:00
|
|
|
|
}
|
2024-05-29 20:33:49 +04:00
|
|
|
|
return Redirect("Index");
|
2024-05-28 21:40:18 +04:00
|
|
|
|
}
|
2024-05-29 19:26:11 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult ReportPlanOfStudyAndStudents()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View("ReportPlanOfStudyAndStudents", APIClient.GetRequest<List<ReportPlanOfStudyAndStudentViewModel>>($"api/planofstudys/getplanofstudyandstudents"));
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void ReportPlanOfStudyAndStudents(string type)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.User == null)
|
|
|
|
|
{
|
|
|
|
|
Redirect("~/Home/Enter");
|
|
|
|
|
throw new Exception("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if (type == "pdf")
|
|
|
|
|
{
|
|
|
|
|
APIClient.PostRequest("api/planofstudys/createreporttopdffile", new ReportBindingModel
|
|
|
|
|
{
|
2024-05-29 21:06:39 +04:00
|
|
|
|
FileName = "C:\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.pdf"
|
2024-05-29 19:26:11 +04:00
|
|
|
|
});
|
2024-05-29 21:06:39 +04:00
|
|
|
|
APIClient.PostRequest("api/planofstudys/sendpdftomail", new MailSendInfoBindingModel
|
2024-05-29 19:26:11 +04:00
|
|
|
|
{
|
|
|
|
|
MailAddress = APIClient.User.Email,
|
|
|
|
|
Subject = "<22><><EFBFBD><EFBFBD><EFBFBD>",
|
2024-05-29 21:06:39 +04:00
|
|
|
|
Text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2024-05-29 19:26:11 +04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Response.Redirect("Index");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-05-28 21:40:18 +04:00
|
|
|
|
}
|
2024-04-29 19:06:11 +04:00
|
|
|
|
}
|