From 82028c2fdd664f37d9d9178b2d778192003844c5 Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Thu, 18 May 2023 23:32:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B0=D0=BB=D0=B5=D0=BA=D0=BE=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=BA=D1=82,=20=D1=87=D1=82=D0=BE=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/HearingViewModel.cs | 1 + .../CaseAccountingProviderView/APIUser.cs | 47 +++++++ .../CaseAccountingProviderView.csproj | 8 ++ .../Controllers/CaseController.cs | 123 ++++++++++++++++++ .../Controllers/DealController.cs | 123 ++++++++++++++++++ .../Controllers/HearingController.cs | 123 ++++++++++++++++++ .../Controllers/HomeController.cs | 88 ++++++++++++- .../CaseAccountingProviderView/Program.cs | 4 + .../Views/Case/Create.cshtml | 32 +++++ .../Views/Case/Update.cshtml | 43 ++++++ .../Views/Deal/Create.cshtml | 24 ++++ .../Views/Deal/Update.cshtml | 34 +++++ .../Views/Hearing/Create.cshtml | 26 ++++ .../Views/Hearing/Update.cshtml | 36 +++++ .../Views/Home/Cases.cshtml | 89 +++++++++++++ .../Views/Home/Deals.cshtml | 65 +++++++++ .../Views/Home/Hearings.cshtml | 71 ++++++++++ .../Views/Home/Index.cshtml | 5 +- .../Views/Home/Login.cshtml | 27 ++++ .../Views/Home/Privacy.cshtml | 6 - .../Views/Home/Registration.cshtml | 27 ++++ .../Views/Shared/_Layout.cshtml | 38 ++---- .../appsettings.json | 3 +- .../wwwroot/js/case/case-create.js | 69 ++++++++++ .../wwwroot/js/case/case-update.js | 71 ++++++++++ .../wwwroot/js/case/cases.js | 20 +++ .../wwwroot/js/deal/deal-create.js | 40 ++++++ .../wwwroot/js/deal/deal-update.js | 42 ++++++ .../wwwroot/js/deal/deals.js | 20 +++ .../wwwroot/js/hearing/hearing-create.js | 40 ++++++ .../wwwroot/js/hearing/hearing-update.js | 42 ++++++ .../wwwroot/js/hearing/hearings.js | 20 +++ 32 files changed, 1371 insertions(+), 36 deletions(-) create mode 100644 CaseAccounting/CaseAccountingProviderView/APIUser.cs create mode 100644 CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs create mode 100644 CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs create mode 100644 CaseAccounting/CaseAccountingProviderView/Controllers/HearingController.cs create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Cases.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Hearings.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Login.cshtml delete mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Privacy.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/Views/Home/Registration.cshtml create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-create.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-update.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/cases.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-create.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-update.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deals.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-create.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-update.js create mode 100644 CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearings.js diff --git a/CaseAccounting/CaseAccountingContracts/ViewModels/HearingViewModel.cs b/CaseAccounting/CaseAccountingContracts/ViewModels/HearingViewModel.cs index a0df77a..5c3e570 100644 --- a/CaseAccounting/CaseAccountingContracts/ViewModels/HearingViewModel.cs +++ b/CaseAccounting/CaseAccountingContracts/ViewModels/HearingViewModel.cs @@ -17,6 +17,7 @@ namespace CaseAccountingContracts.ViewModels [DisplayName("Номер дела")] public int CaseId { get; set; } public int UserId { get; set; } + [DisplayName("Номер слушания")] public int Id { get; set; } } } diff --git a/CaseAccounting/CaseAccountingProviderView/APIUser.cs b/CaseAccounting/CaseAccountingProviderView/APIUser.cs new file mode 100644 index 0000000..b162554 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/APIUser.cs @@ -0,0 +1,47 @@ +using CaseAccountingContracts.ViewModels; +using Newtonsoft.Json; +using System.Net.Http.Headers; +using System.Text; + +namespace CaseAccountingProviderView +{ + public static class APIUser + { + private static readonly HttpClient _user = new(); + + public static UserViewModel? User { get; set; } = null; + + public static void Connect(IConfiguration configuration) + { + _user.BaseAddress = new Uri(configuration["IPAddress"]); + _user.DefaultRequestHeaders.Accept.Clear(); + _user.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + } + + public static T? GetRequest(string requestUrl) + { + var response = _user.GetAsync(requestUrl); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + else + { + throw new Exception(result); + } + } + + public static void PostRequest(string requestUrl, T model) + { + var json = JsonConvert.SerializeObject(model); + var data = new StringContent(json, Encoding.UTF8, "application/json"); + var response = _user.PostAsync(requestUrl, data); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (!response.Result.IsSuccessStatusCode) + { + throw new Exception(result); + } + } + } +} diff --git a/CaseAccounting/CaseAccountingProviderView/CaseAccountingProviderView.csproj b/CaseAccounting/CaseAccountingProviderView/CaseAccountingProviderView.csproj index c78c9c7..083008b 100644 --- a/CaseAccounting/CaseAccountingProviderView/CaseAccountingProviderView.csproj +++ b/CaseAccounting/CaseAccountingProviderView/CaseAccountingProviderView.csproj @@ -6,4 +6,12 @@ enable + + + + + + + + diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs new file mode 100644 index 0000000..8ef7313 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/CaseController.cs @@ -0,0 +1,123 @@ +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; + +namespace CaseAccountingProviderView.Controllers +{ + public class CaseController : Controller + { + public IActionResult Create() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + return View(); + } + + [HttpPost] + public void Create([FromBody] CaseBindingModel caseModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + caseModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/case/create", caseModel); + Response.Redirect("/Home/Cases"); + } + + public IActionResult Update(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Case = APIUser.GetRequest($"api/case/get?id={id}"); + return View(); + } + + [HttpPost] + public void Update([FromBody] CaseBindingModel caseModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + caseModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/case/update", caseModel); + Response.Redirect("/Home/Cases"); + } + + public IActionResult AddCase(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.CaseId = id; + return View(); + } + + [HttpPost] + public void AddCase([FromBody] CaseBindingModel caseModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/case/update", caseModel); + } + + public IActionResult Bind(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Case = APIUser.GetRequest($"api/case/get?id={id}"); + return View(); + } + + [HttpPost] + public void Bind([FromBody] CaseBindingModel caseModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/case/update", caseModel); + } + + [HttpPost] + public void Delete(int id) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest($"api/case/delete", new CaseBindingModel() { Id = id }); + Response.Redirect("/Home/Cases"); + } + + public List GetAllByUser() + { + if (APIUser.User == null) + { + return new(); + } + List? caseModel = APIUser.GetRequest>($"api/case/getallbyuser?userId={APIUser.User.Id}"); + return caseModel ?? new(); + } + + public CaseViewModel? Get(int id) + { + if (APIUser.User == null) + { + return new(); + } + CaseViewModel? caseModel = APIUser.GetRequest($"api/case/get?id={id}"); + return caseModel; + } + } +} diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs new file mode 100644 index 0000000..b8a5296 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/DealController.cs @@ -0,0 +1,123 @@ +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; + +namespace CaseAccountingProviderView.Controllers +{ + public class DealController : Controller + { + public IActionResult Create() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + return View(); + } + + [HttpPost] + public void Create([FromBody] DealBindingModel dealModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + dealModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/deal/create", dealModel); + Response.Redirect("/Home/Deals"); + } + + public IActionResult Update(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Deal = APIUser.GetRequest($"api/deal/get?id={id}"); + return View(); + } + + [HttpPost] + public void Update([FromBody] DealBindingModel dealModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + dealModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/deal/update", dealModel); + Response.Redirect("/Home/Deals"); + } + + public IActionResult AddDeal(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.DealId = id; + return View(); + } + + [HttpPost] + public void AddDeal([FromBody] DealBindingModel dealModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/deal/update", dealModel); + } + + public IActionResult Bind(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Deal = APIUser.GetRequest($"api/deal/get?id={id}"); + return View(); + } + + [HttpPost] + public void Bind([FromBody] DealBindingModel dealModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/deal/update", dealModel); + } + + [HttpPost] + public void Delete(int id) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest($"api/deal/delete", new DealBindingModel() { Id = id }); + Response.Redirect("/Home/Deals"); + } + + public List GetAllByUser() + { + if (APIUser.User == null) + { + return new(); + } + List? dealModel = APIUser.GetRequest>($"api/deal/getallbyuser?userId={APIUser.User.Id}"); + return dealModel ?? new(); + } + + public DealViewModel? Get(int id) + { + if (APIUser.User == null) + { + return new(); + } + DealViewModel? dealModel = APIUser.GetRequest($"api/deal/get?id={id}"); + return dealModel; + } + } +} diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/HearingController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/HearingController.cs new file mode 100644 index 0000000..a6db238 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/HearingController.cs @@ -0,0 +1,123 @@ +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; + +namespace CaseAccountingProviderView.Controllers +{ + public class HearingController : Controller + { + public IActionResult Create() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + return View(); + } + + [HttpPost] + public void Create([FromBody] HearingBindingModel hearingModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + hearingModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/hearing/create", hearingModel); + Response.Redirect("/Home/Hearings"); + } + + public IActionResult Update(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Hearing = APIUser.GetRequest($"api/hearing/get?id={id}"); + return View(); + } + + [HttpPost] + public void Update([FromBody] HearingBindingModel hearingModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + hearingModel.UserId = APIUser.User.Id; + APIUser.PostRequest("api/hearing/update", hearingModel); + Response.Redirect("/Home/Hearings"); + } + + public IActionResult AddHearing(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.HearingId = id; + return View(); + } + + [HttpPost] + public void AddHearing([FromBody] HearingBindingModel hearingModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/hearing/update", hearingModel); + } + + public IActionResult Bind(int id) + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Hearing = APIUser.GetRequest($"api/hearing/get?id={id}"); + return View(); + } + + [HttpPost] + public void Bind([FromBody] HearingBindingModel hearingModel) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest("api/hearing/update", hearingModel); + } + + [HttpPost] + public void Delete(int id) + { + if (APIUser.User == null) + { + throw new Exception("403"); + } + APIUser.PostRequest($"api/hearing/delete", new HearingBindingModel() { Id = id }); + Response.Redirect("/Home/Hearings"); + } + + public List GetAllByUser() + { + if (APIUser.User == null) + { + return new(); + } + List? hearingModel = APIUser.GetRequest>($"api/hearing/getallbyuser?userId={APIUser.User.Id}"); + return hearingModel ?? new(); + } + + public HearingViewModel? Get(int id) + { + if (APIUser.User == null) + { + return new(); + } + HearingViewModel? hearingModel = APIUser.GetRequest($"api/hearing/get?id={id}"); + return hearingModel; + } + } +} diff --git a/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs b/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs index 6ec03ab..241b445 100644 --- a/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs +++ b/CaseAccounting/CaseAccountingProviderView/Controllers/HomeController.cs @@ -1,4 +1,7 @@ -using CaseAccountingProviderView.Models; +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.ViewModels; +using CaseAccountingDataModels.Enum; +using CaseAccountingProviderView.Models; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; @@ -15,14 +18,95 @@ namespace CaseAccountingProviderView.Controllers public IActionResult Index() { + if (APIUser.User == null) + { + return Redirect("~/Home/Login"); + } return View(); } - public IActionResult Privacy() + public IActionResult Login() { return View(); } + public IActionResult Registration() + { + return View(); + } + + [HttpPost] + public void Login(string login, string password) + { + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) + { + throw new Exception("Введите логин и пароль"); + } + APIUser.User = APIUser.GetRequest($"api/user/login?login={login}&password={password}&role={Role.Provider}"); + if (APIUser.User == null) + { + throw new Exception("Неверный логин/пароль"); + } + Response.Redirect("Index"); + } + + [HttpPost] + public void Registration(string login, string password) + { + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) + { + throw new Exception("Введите логин и пароль"); + } + APIUser.PostRequest("api/user/register", new UserBindingModel + { + Login = login, + Password = password, + Role = Role.Provider + }); + Response.Redirect("Login"); + return; + } + + public IActionResult Cases() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + /*if (page == 0) + { + page = 1; + }*/ + ViewBag.Cases = APIUser.GetRequest> + ($"api/case/getallbyuser?userId={APIUser.User.Id}"); + /*ViewBag.Page = page; + ViewBag.NumberOfPages = APIUser.GetRequest + ($"api/student/getnumberofpages?userId={APIUser.User.Id}");*/ + return View(); + } + + public IActionResult Deals() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Deals = APIUser.GetRequest> + ($"api/deal/getallbyuser?userId={APIUser.User.Id}"); + return View(); + } + + public IActionResult Hearings() + { + if (APIUser.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Hearings = APIUser.GetRequest> + ($"api/hearing/getallbyuser?userId={APIUser.User.Id}"); + return View(); + } + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { diff --git a/CaseAccounting/CaseAccountingProviderView/Program.cs b/CaseAccounting/CaseAccountingProviderView/Program.cs index 559dd3a..2dc2217 100644 --- a/CaseAccounting/CaseAccountingProviderView/Program.cs +++ b/CaseAccounting/CaseAccountingProviderView/Program.cs @@ -1,3 +1,5 @@ +using CaseAccountingProviderView; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -5,6 +7,8 @@ builder.Services.AddControllersWithViews(); var app = builder.Build(); +APIUser.Connect(builder.Configuration); + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml new file mode 100644 index 0000000..c31f8f4 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Case/Create.cshtml @@ -0,0 +1,32 @@ +@{ + ViewData["Title"] = "Дело"; +} + +

Создание дела

+ +
+
+

+
+
+ +

Название:

+ +

Истец:

+ +

Ответчик:

+ +

Дата составления:

+ +

Примечание:

+ +

Специализация:

+ + + + + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml new file mode 100644 index 0000000..8d604be --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Case/Update.cshtml @@ -0,0 +1,43 @@ +@{ + ViewData["Title"] = "Дело"; +} + +@{ + +

Изменение дела

+ + if (ViewBag.Case == null) + { +

Войдите в аккаунт

+ return; + } + +
+
+

+
+
+ +

Название:

+ +

Истец:

+ +

Ответчик:

+ +

Дата составления:

+ +

Примечание:

+ +

Специализация:

+ + + + +} + + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml new file mode 100644 index 0000000..b9dbbc0 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Create.cshtml @@ -0,0 +1,24 @@ +@{ + ViewData["Title"] = "Договор"; +} + +

Создание договора

+ +
+
+

+
+
+ +

Объект договора:

+ +

Обязаности:

+ +

Дата составления:

+ + + + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml new file mode 100644 index 0000000..023284b --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Deal/Update.cshtml @@ -0,0 +1,34 @@ +@{ + ViewData["Title"] = "Договор"; +} + +@{ + +

Изменение договора

+ + if (ViewBag.Deal == null) + { +

Войдите в аккаунт

+ return; + } + +
+
+

+
+
+ +

Объект договора:

+ +

Обязаности:

+ +

Дата составления:

+ + + + +} + + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml new file mode 100644 index 0000000..dd83249 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Create.cshtml @@ -0,0 +1,26 @@ +@{ + ViewData["Title"] = "Слушание"; +} + +

Создание слушания

+ +
+
+

+
+
+ +

Информация по слушанию:

+ +

Дата проведения:

+ +

Дело:

+ + + + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml new file mode 100644 index 0000000..e1fe2f4 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Hearing/Update.cshtml @@ -0,0 +1,36 @@ +@{ + ViewData["Title"] = "Слушание"; +} + +@{ + +

Изменение слушания

+ + if (ViewBag.Hearing == null) + { +

Войдите в аккаунт

+ return; + } + +
+
+

+
+
+ +

Информация по слушанию:

+ +

Дата проведения:

+ +

Дело:

+ + + + +} + + diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Cases.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Cases.cshtml new file mode 100644 index 0000000..e5afbfb --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Cases.cshtml @@ -0,0 +1,89 @@ +@{ + ViewData["Title"] = "Дела"; +} + +
+

Дела

+
+ +
+ @{ + if (ViewBag.Cases == null) + { +

Войдите в аккаунт

+ return; + } + + + + + + + + + + + + + + + + + @foreach (var item in ViewBag.Cases) + { + + + + + + + + + + + + } + +
+ Номер Дела + + Название + + Истец + + Ответчик + + Примечание + + Дата оформления + + Специализация + + Изменить запись + + Удалить запись +
+ @item.Id + + @item.Name + + @item.Applicant + + @item.Defendant + + @item.Annotation + + @item.Date.ToString("yyyy-MM-dd") + + @item.Specialization + + Изменить + + Удалить +
+ } +
+ + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml new file mode 100644 index 0000000..e077efd --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Deals.cshtml @@ -0,0 +1,65 @@ +@{ + ViewData["Title"] = "Договора"; +} + +
+

Договора

+
+ +
+ @{ + if (ViewBag.Deals == null) + { +

Войдите в аккаунт

+ return; + } + + + + + + + + + + + + + @foreach (var item in ViewBag.Deals) + { + + + + + + + + } + +
+ Предмет договора + + Обязанности + + Дата составления + + Изменить запись + + Удалить запись +
+ @item.Subject + + @item.Responsibilities + + @item.Date.ToString("yyyy-MM-dd") + + Изменить + + Удалить +
+ } +
+ + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Hearings.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Hearings.cshtml new file mode 100644 index 0000000..b42947e --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Hearings.cshtml @@ -0,0 +1,71 @@ +@{ + ViewData["Title"] = "Слушания"; +} + +
+

Слушания

+
+ +
+ @{ + if (ViewBag.Hearings == null) + { +

Войдите в аккаунт

+ return; + } + + + + + + + + + + + + + + @foreach (var item in ViewBag.Hearings) + { + + + + + + + + + } + +
+ Номер + + Информация + + Номер Дела + + Дата слушания + + Изменить запись + + Удалить запись +
+ @item.Id + + @item.Information + + @item.CaseId + + @item.Date.ToString("yyyy-MM-dd") + + Изменить + + Удалить +
+ } +
+ + \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Index.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Index.cshtml index d2d19bd..a988bac 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Home/Index.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Index.cshtml @@ -1,8 +1,7 @@ @{ - ViewData["Title"] = "Home Page"; + ViewData["Title"] = "Домашняя сраница"; }
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

+

Добро пожаловать в курсовую работу!!!

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Login.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Login.cshtml new file mode 100644 index 0000000..3ea6e87 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Login.cshtml @@ -0,0 +1,27 @@ +@{ + ViewData["Title"] = "Вход"; +} + +
+

Вход в приложение

+
+
+
+
Логин:
+
+
+
+
Пароль:
+
+
+ +
diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Privacy.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Privacy.cshtml deleted file mode 100644 index af4fb19..0000000 --- a/CaseAccounting/CaseAccountingProviderView/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -

@ViewData["Title"]

- -

Use this page to detail your site's privacy policy.

diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Home/Registration.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Home/Registration.cshtml new file mode 100644 index 0000000..feaa68f --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/Views/Home/Registration.cshtml @@ -0,0 +1,27 @@ +@{ + ViewData["Title"] = "Регистрация"; +} + +
+

Регистрация

+
+
+
+
Логин (эл.почта):
+
+
+
+
Пароль:
+
+
+ +
diff --git a/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml b/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml index 9477c49..7acda13 100644 --- a/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml +++ b/CaseAccounting/CaseAccountingProviderView/Views/Shared/_Layout.cshtml @@ -1,5 +1,5 @@  - + @@ -10,24 +10,20 @@
-
@@ -35,12 +31,6 @@ @RenderBody()
- -
-
- © 2023 - CaseAccountingProviderView - Privacy -
-
diff --git a/CaseAccounting/CaseAccountingProviderView/appsettings.json b/CaseAccounting/CaseAccountingProviderView/appsettings.json index 10f68b8..7f20ca6 100644 --- a/CaseAccounting/CaseAccountingProviderView/appsettings.json +++ b/CaseAccounting/CaseAccountingProviderView/appsettings.json @@ -5,5 +5,6 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "IPAddress": "http://localhost:5146" } diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-create.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-create.js new file mode 100644 index 0000000..c66b8d4 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-create.js @@ -0,0 +1,69 @@ +const createBtn = document.getElementById("create-button"); +const nameInput = document.getElementById("name-input"); +const applicantInput = document.getElementById("applicant-input"); +const defendantInput = document.getElementById("defendant-input"); +const annotationInput = document.getElementById("annotation-input"); +const dateInput = document.getElementById("date-input"); +const specializationSelect = document.getElementById("specialization-select"); + +var specializations = []; + +window.addEventListener("load", async () => { + try { + const specializationsResponse = await $.ajax({ + url: `/specialization/getall`, + type: "GET", + contentType: "json" + }); + specializations = specializationsResponse; + + specializations.forEach((specialization) => { + const option = document.createElement("option"); + option.value = specialization.id; + option.innerHTML = specialization.name; + specializationSelect.appendChild(option); + specializationSelect.selectedIndex = -1; + }); + } catch (error) { + console.error(error); + } +}); + +createBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +createBtn.addEventListener("click", () => { + let caseModel = { + "Name": nameInput.value, + "Applicant": applicantInput.value, + "Defendant": defendantInput.value, + "Date": new Date(dateInput.value), + "Annotation": annotationInput.value, + "SpecializationId": parseInt(specializationSelect.value), + }; + console.log(caseModel) + $.ajax({ + url: "/case/create", + type: "POST", + contentType: "application/json", + data: JSON.stringify(caseModel) + }).done(() => { + window.location.href = "/Home/Cases"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-update.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-update.js new file mode 100644 index 0000000..a440e4a --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/case-update.js @@ -0,0 +1,71 @@ +const updateBtn = document.getElementById("update-button"); +const nameInput = document.getElementById("name-input"); +const applicantInput = document.getElementById("applicant-input"); +const defendantInput = document.getElementById("defendant-input"); +const annotationInput = document.getElementById("annotation-input"); +const dateInput = document.getElementById("date-input"); +const specializationSelect = document.getElementById("specialization-select"); +const caseId = document.getElementById("vb-id").dataset.id; + +var specializations = []; + +window.addEventListener("load", async () => { + try { + const specializationsResponse = await $.ajax({ + url: `/specialization/getall`, + type: "GET", + contentType: "json" + }); + specializations = specializationsResponse; + + specializations.forEach((specialization) => { + const option = document.createElement("option"); + option.value = specialization.id; + option.innerHTML = specialization.name; + specializationSelect.appendChild(option); + specializationSelect.selectedIndex = -1; + }); + } catch (error) { + console.error(error); + } +}); + +updateBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +updateBtn.addEventListener("click", () => { + let caseModel = { + "Id": parseInt(caseId), + "Name": nameInput.value, + "Applicant": applicantInput.value, + "Defendant": defendantInput.value, + "Date": new Date(dateInput.value), + "Annotation": annotationInput.value, + "SpecializationId": parseInt(specializationSelect.value), + }; + console.log(caseModel) + $.ajax({ + url: "/case/update", + type: "POST", + contentType: "application/json", + data: JSON.stringify(caseModel) + }).done(() => { + window.location.href = "/Home/Cases"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/cases.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/cases.js new file mode 100644 index 0000000..3d8029f --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/case/cases.js @@ -0,0 +1,20 @@ +const removeButtons = document.querySelectorAll(".remove-btn"); + +console.log(removeButtons) + +removeButtons.forEach(function (button) { + button.addEventListener("click", function (event) { + var id = this.dataset.id; + console.log(id) + var result = confirm("Вы уверены, что хотите удалить эту запись?"); + if (result) { + $.ajax({ + url: "/case/delete", + type: "POST", + data: { Id: id } + }).done(() => { + window.location.reload(); + }); + } + }); +}); diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-create.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-create.js new file mode 100644 index 0000000..e2db6f9 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-create.js @@ -0,0 +1,40 @@ +const createBtn = document.getElementById("create-button"); +const subjectInput = document.getElementById("subject-input"); +const responsibilitiesInput = document.getElementById("responsibilities-input"); +const dateInput = document.getElementById("date-input"); + +createBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +createBtn.addEventListener("click", () => { + let dealModel = { + "Subject": subjectInput.value, + "Responsibilities": responsibilitiesInput.value, + "Date": new Date(dateInput.value) + }; + console.log(dealModel) + $.ajax({ + url: "/deal/create", + type: "POST", + contentType: "application/json", + data: JSON.stringify(dealModel) + }).done(() => { + window.location.href = "/Home/Deals"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-update.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-update.js new file mode 100644 index 0000000..9ca9a0f --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deal-update.js @@ -0,0 +1,42 @@ +const updateBtn = document.getElementById("update-button"); +const subjectInput = document.getElementById("subject-input"); +const responsibilitiesInput = document.getElementById("responsibilities-input"); +const dateInput = document.getElementById("date-input"); +const dealId = document.getElementById("vb-id").dataset.id; + +updateBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +updateBtn.addEventListener("click", () => { + let dealModel = { + "Id": parseInt(dealId), + "Subject": subjectInput.value, + "Responsibilities": responsibilitiesInput.value, + "Date": new Date(dateInput.value) + }; + console.log(dealModel) + $.ajax({ + url: "/deal/update", + type: "POST", + contentType: "application/json", + data: JSON.stringify(dealModel) + }).done(() => { + window.location.href = "/Home/Deals"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deals.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deals.js new file mode 100644 index 0000000..ea9060f --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/deal/deals.js @@ -0,0 +1,20 @@ +const removeButtons = document.querySelectorAll(".remove-btn"); + +console.log(removeButtons) + +removeButtons.forEach(function (button) { + button.addEventListener("click", function (event) { + var id = this.dataset.id; + console.log(id) + var result = confirm("Вы уверены, что хотите удалить эту запись?"); + if (result) { + $.ajax({ + url: "/deal/delete", + type: "POST", + data: { Id: id } + }).done(() => { + window.location.reload(); + }); + } + }); +}); diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-create.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-create.js new file mode 100644 index 0000000..8dc63f4 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-create.js @@ -0,0 +1,40 @@ +const createBtn = document.getElementById("create-button"); +const informationInput = document.getElementById("information-input"); +const dateInput = document.getElementById("date-input"); +const caseSelect = document.getElementById("case-select"); + +createBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +createBtn.addEventListener("click", () => { + let hearingModel = { + "Information": informationInput.value, + "CaseId": parseInt(caseSelect.value), + "Date": new Date(dateInput.value) + }; + console.log(dealModel) + $.ajax({ + url: "/hearing/create", + type: "POST", + contentType: "application/json", + data: JSON.stringify(hearingModel) + }).done(() => { + window.location.href = "/Home/Hearings"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-update.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-update.js new file mode 100644 index 0000000..a74b7b3 --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearing-update.js @@ -0,0 +1,42 @@ +const updateBtn = document.getElementById("update-button"); +const informationInput = document.getElementById("information-input"); +const dateInput = document.getElementById("date-input"); +const caseSelect = document.getElementById("case-select"); +const hearingId = document.getElementById("vb-id").dataset.id; + +updateBtn.addEventListener("click", () => { + if (!correctData()) { + return; + } + if (!validate()) { + return; + } +}); + +const correctData = function () { + + return true; +}; + +const validate = function () { + + return true; +}; + +updateBtn.addEventListener("click", () => { + let hearingModel = { + "Id": parseInt(hearingId), + "Information": informationInput.value, + "CaseId": parseInt(caseSelect.value), + "Date": new Date(dateInput.value) + }; + console.log(hearingModel) + $.ajax({ + url: "/hearing/update", + type: "POST", + contentType: "application/json", + data: JSON.stringify(hearingModel) + }).done(() => { + window.location.href = "/Home/Hearings"; + }); +}); \ No newline at end of file diff --git a/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearings.js b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearings.js new file mode 100644 index 0000000..8651beb --- /dev/null +++ b/CaseAccounting/CaseAccountingProviderView/wwwroot/js/hearing/hearings.js @@ -0,0 +1,20 @@ +const removeButtons = document.querySelectorAll(".remove-btn"); + +console.log(removeButtons) + +removeButtons.forEach(function (button) { + button.addEventListener("click", function (event) { + var id = this.dataset.id; + console.log(id) + var result = confirm("Вы уверены, что хотите удалить эту запись?"); + if (result) { + $.ajax({ + url: "/hearing/delete", + type: "POST", + data: { Id: id } + }).done(() => { + window.location.reload(); + }); + } + }); +});