Compare commits

..

No commits in common. "aef6c7fcd404853ea339fb78af928b06b307b8dc" and "2a09fd2ffeedfa3a65c694da74c4d6e2f22b2da6" have entirely different histories.

6 changed files with 47 additions and 559 deletions

View File

@ -8,7 +8,7 @@ namespace LawFirmExecutorApp
public class APIClient
{
private static readonly HttpClient _client = new();
public static ExecutorViewModel? User { get; set; } = null;
public static ExecutorViewModel? Executor { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);

View File

@ -1,106 +1,12 @@
using LawFimDataModels.Enums;
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace LawFirmExecutorApp.Controllers
{
public class CaseController : Controller
{
[HttpGet]
public IActionResult AddClient()
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
//ViewBag.Cases = APIClient.GetRequest<List<CaseViewModel>>($"api/case/getcaselist?companyId={APIClient.User.CompanyId}");
//ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?companyId={APIClient.User.CompanyId}");
return View();
}
[HttpPost]
public void AddClient(int id, int clientId)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/case/addclienttocase", Tuple.Create(new CaseSearchModel { Id = id }, new ClientViewModel { Id = clientId }));
Response.Redirect("/Home/Cases");
}
[HttpGet]
public IActionResult CreateCase()
public IActionResult Index()
{
return View();
}
[HttpPost]
public void CreateCase(string name)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/case/createcase", new
CaseBindingModel
{
Name = name,
DateCreate = DateTime.Now,
});
Response.Redirect("/Home/Cases");
}
[HttpPost]
public void DeleteCase(int id)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/case/deletecase", new
CaseSearchModel
{
Name = "name",
Id = id
});
Response.Redirect("/Home/Cases");
}
[HttpGet]
public IActionResult UpdateCase()
{
return View();
}
[HttpPost]
public void UpdateCase(int id, string name, int statusId)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/case/updatecase", new
CaseBindingModel
{
Id = id,
Name = name,
Status = (CaseStatus)statusId
});
Response.Redirect("/Home/Cases");
}
[HttpGet]
public IActionResult CaseClients(int id)
{
if (APIClient.User == null)
{
return Redirect("/Home/EnterLawyer");
}
return
View(APIClient.GetRequest<List<ClientViewModel>>($"api/case/getclientlisttocase?caseId={id}"));
}
}
}

View File

@ -1,74 +1,12 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace LawFirmExecutorApp.Controllers
{
public class ClientController : Controller
{
[HttpGet]
public IActionResult CreateClient()
public IActionResult Index()
{
return View();
}
[HttpPost]
public void CreateClient(string fio, string phone, string email)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/client/createclient", new
ClientBindingModel
{
FIO = fio,
Phone = phone,
Email = email
});
Response.Redirect("~/Client/Clients");
}
[HttpPost]
public void DeleteClient(int id)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/client/deleteclient", new
ClientSearchModel
{
Email = "g",
Phone = "g",
FIO = "g",
Id = id
});
Response.Redirect("/Home/Clients");
}
[HttpGet]
public IActionResult UpdateClient()
{
return View();
}
[HttpPost]
public void UpdateClient(int id, string fio, string email, string phone)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/client/updateclient", new
ClientBindingModel
{
Id = id,
FIO = fio,
Email = email,
Phone = phone
});
Response.Redirect("/Home/Clients");
}
}
}

View File

@ -1,6 +1,4 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmExecutorApp.Models;
using LawFirmExecutorApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
@ -15,144 +13,15 @@ namespace LawFirmExecutorApp.Controllers
_logger = logger;
}
// СТРАНИЦА ДЕЛ
public IActionResult Cases()
public IActionResult Index()
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIClient.GetRequest<List<CaseViewModel>>($"api/case/getcaselist?executorid={APIClient.User.Id}"));
}
// СТРАНИЦА КЛИЕНТОВ
public IActionResult Clients()
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?executorid={APIClient.User}"));
}
// СТРАНИЦА ВИЗИТОВ
public IActionResult Visits()
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIClient.GetRequest<List<VisitViewModel>>($"api/visit/getvisitlist?executorid={APIClient.User}"));
}
// Отчёт pdf исполнителя
public IActionResult CreateReportClients()
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return View();
}
[HttpGet]
public IActionResult Privacy()
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
//ViewBag.Companies = APIClient.GetRequest<List<CompanyViewModel>>($"api/company/getcompanylist");
return View(APIClient.User);
}
[HttpPost]
public void Privacy(string login, string password, string fio)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) ||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/user/updatedata", new
ExecutorBindingModel
{
Id = APIClient.User.Id,
FIO = fio,
Email = login,
Password = password
});
APIClient.User.FIO = fio;
APIClient.User.Email = login;
APIClient.User.Password = password;
Response.Redirect("Cases");
}
// РЕГИСТРАЦИЯ ИСПОЛНИТЕЛЯ
[HttpGet]
public IActionResult Register()
{
//ViewBag.Companies = APIClient.GetRequest<List<CompanyViewModel>>($"api/company/getcompanylist");
return View();
}
[HttpPost]
public void Register(string login, string password, string fio)
{
if (string.IsNullOrEmpty(login) ||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/user/register", new
ExecutorBindingModel
{
FIO = fio,
Email = login,
Password = password
});
Response.Redirect("Enter");
return;
}
// ВХОД ДЛЯ ИСПОЛНИТЕЛЯ
[HttpGet]
public IActionResult Enter()
{
return View();
}
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) ||
string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APIClient.User = APIClient.GetRequest<ExecutorViewModel>($"api/user/login?login={login}&password={password}");
if (APIClient.User == null)
{
Response.Redirect("Enter");
}
else
{
/*if (APIClient.User.RoleId == 1) { Response.Redirect("/Home/Cases"); }
else */
throw new Exception();
}
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()

View File

@ -1,130 +0,0 @@
using LawFirmContracts.BindingModels.Mails;
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace LawFirmExecutorApp.Controllers
{
public class ReportController : Controller
{
/*[HttpGet]
public void CreateReportClients(DateTime dateFrom, DateTime dateTo)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport", new ReportBindingModel
{
DateFrom = dateFrom,
DateTo = dateTo
Response.Redirect("CreateReportClients");
}*/
[HttpPost]
public void LoadReportClients(DateTime dateFrom, DateTime dateTo)
{
if (APIClient.User == null)
{
Redirect("~/Home/Enter");
}
APIClient.PostRequest($"api/report/saveclientspdffile", new ReportBindingModel
{
DateFrom = dateFrom,
DateTo = dateTo,
CompanyId = APIClient.User.CompanyId
});
}
[HttpPost]
public void LoadReportClientsHearingWord(int clientId)
{
if (APIClient.User == null)
{
Redirect("~/Home/Enter");
}
APIClient.PostRequest($"api/report/saveclientswordfile", new ReportBindingModel
{
CompanyId = APIClient.User.CompanyId,
ClientId = clientId
});
}
[HttpGet]
public IActionResult GetReportClientsHearing(int clientId)
{
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?companyId={APIClient.User.CompanyId}");
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<ReportClientsHearingViewModel>>($"api/report/getclientsreporthearing?clientid={clientId}&companyId={APIClient.User.CompanyId}"));
}
[HttpGet]
public IActionResult LoadReportClients(DateTime dateFrom, DateTime dateTo, string a)
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport?datefrom={dateFrom}&dateTo={dateTo}&companyId={APIClient.User.CompanyId}"));
}
[HttpGet]
public IActionResult CreateReportClients(DateTime dateFrom, DateTime dateTo)
{
if (APIClient.User == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport?datefrom={dateFrom}&dateTo={dateTo}&companyId={APIClient.User.CompanyId}"));
}
[HttpPost]
public void LoadReportClientsHearingExcel(int clientId)
{
if (APIClient.User == null)
{
Redirect("~/Home/Enter");
}
APIClient.PostRequest($"api/report/saveclientsexcelfile", new ReportBindingModel
{
CompanyId = APIClient.User.CompanyId,
ClientId = clientId
});
}
[HttpPost]
public void SendClientsPdf(DateTime dateFrom, DateTime dateTo, string organiserEmail)
{
APIClient.PostRequest($"api/report/saveclientspdffile", new ReportBindingModel
{
DateFrom = dateFrom,
DateTo = dateTo,
CompanyId = APIClient.User.CompanyId
});
APIClient.PostRequest("api/report/mailsend", new MailSendInfoBindingModel
{
MailAddress = "dimazhelovanov@gmail.com",
Subject = "Отчет по клиентам",
Text = "Отчет по клиентам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
});
}
}
}

View File

@ -1,107 +1,12 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.SearchModels;
using LawFirmContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace LawFirmExecutorApp.Controllers
{
public class VisitController : Controller
public class VizitController : Controller
{
[HttpGet]
public IActionResult AddClient()
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
//ViewBag.Visits = APIClient.GetRequest<List<VisitViewModel>>($"api/visit/getvisitlist?companyId={APIClient.User.CompanyId}");
//ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?companyId={APIClient.User.CompanyId}");
return View();
}
[HttpPost]
public void AddClient(int visitId, int clientId)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/visit/addclienttovisit", Tuple.Create(new VisitSearchModel { Id = visitId }, clientId));
Response.Redirect("/Home/Visits");
}
[HttpGet]
public IActionResult CreateVisit()
{
//ViewBag.Consultations = APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/getconsultationlist?companyId={APIClient.User.CompanyId}");
return View();
}
[HttpPost]
public void CreateVisit(DateTime visitDate, int hearingId)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
//ViewBag.Consultations = APIClient.GetRequest<List<ConsultationViewModel>>($"api/consultation/getconsultationlist?companyId={APIClient.User.CompanyId}");
APIClient.PostRequest("api/visit/createvisit", new
VisitBindingModel
{
VisitDate = visitDate,
HearingId = hearingId
});
Response.Redirect("/Home/Visits");
}
[HttpPost]
public void DeleteVisit(int id)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/visit/deletevisit", new
VisitSearchModel
{
Id = id
});
Response.Redirect("/Home/Visits");
}
[HttpGet]
public IActionResult UpdateVisit()
public IActionResult Index()
{
return View();
}
[HttpPost]
public void UpdateVisit(int id, DateTime visitDate, int hearingId)
{
if (APIClient.User == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
APIClient.PostRequest("api/visit/updatevisit", new
VisitBindingModel
{
Id = id,
VisitDate = visitDate,
HearingId = hearingId
});
Response.Redirect("/Home/Visits");
}
[HttpGet]
public IActionResult VisitClients(int id)
{
if (APIClient.User == null)
{
return Redirect("~/Home/EnterLawyer");
}
return
View(APIClient.GetRequest<List<ClientViewModel>>($"api/visit/getclientlisttovisit?visitId={id}"));
}
}
}