Compare commits
2 Commits
2a09fd2ffe
...
aef6c7fcd4
Author | SHA1 | Date | |
---|---|---|---|
aef6c7fcd4 | |||
0258bb94e2 |
@ -8,7 +8,7 @@ namespace LawFirmExecutorApp
|
||||
public class APIClient
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
public static ExecutorViewModel? Executor { get; set; } = null;
|
||||
public static ExecutorViewModel? User { get; set; } = null;
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||
|
@ -1,12 +1,106 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LawFimDataModels.Enums;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmExecutorApp.Controllers
|
||||
{
|
||||
public class CaseController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
[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()
|
||||
{
|
||||
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}"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,74 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmExecutorApp.Controllers
|
||||
{
|
||||
public class ClientController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
[HttpGet]
|
||||
public IActionResult CreateClient()
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using LawFirmExecutorApp.Models;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmExecutorApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
@ -13,14 +15,143 @@ namespace LawFirmExecutorApp.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
// СТРАНИЦА ДЕЛ
|
||||
public IActionResult Cases()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
return View();
|
||||
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)]
|
||||
|
130
LawFim/LawFirmExecutorApp/Controllers/ReportController.cs
Normal file
130
LawFim/LawFirmExecutorApp/Controllers/ReportController.cs
Normal file
@ -0,0 +1,130 @@
|
||||
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()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +1,107 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LawFirmExecutorApp.Controllers
|
||||
{
|
||||
public class VizitController : Controller
|
||||
public class VisitController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
|
||||
[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()
|
||||
{
|
||||
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}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user