Вывод сообщений аунтефикации у "Заказчика"
This commit is contained in:
parent
85c1a88c19
commit
e60309c7dd
@ -48,7 +48,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Operator);
|
||||
}
|
||||
@ -58,7 +59,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(lastname) || string.IsNullOrEmpty(firstname) || string.IsNullOrEmpty(middleName))
|
||||
{
|
||||
@ -136,6 +138,11 @@ namespace OperatorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult CreateDeal()
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -144,7 +151,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return;
|
||||
}
|
||||
_dealLogic.Create(new DealBindingModel
|
||||
{
|
||||
@ -157,13 +165,19 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View(_paymentLogic.ReadList(new PaymentSearchModel { OperatorId = APIClient.Operator.Id }));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreatePayment()
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
ViewBag.Deals = _dealLogic.ReadList(new DealSearchModel { OperatorId = APIClient.Operator.Id });
|
||||
return View();
|
||||
}
|
||||
@ -172,7 +186,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return;
|
||||
}
|
||||
Dictionary<int, IDealModel> DealPayments = new();
|
||||
foreach (int id in deals)
|
||||
@ -186,6 +201,11 @@ namespace OperatorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Payment(int id)
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View(_paymentLogic.ReadElement(new PaymentSearchModel { Id = id }));
|
||||
}
|
||||
[HttpGet]
|
||||
@ -193,7 +213,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View(_transferLogic.ReadList(new TransferSearchModel { OperatorId = APIClient.Operator.Id }));
|
||||
}
|
||||
@ -202,7 +223,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
ViewBag.Payments = _paymentLogic.ReadList(new PaymentSearchModel { OperatorId = APIClient.Operator.Id });
|
||||
return View();
|
||||
@ -212,7 +234,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return;
|
||||
}
|
||||
|
||||
_transferLogic.Create(new TransferBindingModel { OperatorId = APIClient.Operator.Id, Amount = (float)Convert.ToDouble(amount), PaymentId = payment });
|
||||
@ -222,7 +245,7 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
}
|
||||
_transferLogic.Delete(new TransferBindingModel { Id = id });
|
||||
Response.Redirect("/Home/Transfers");
|
||||
@ -233,8 +256,8 @@ namespace OperatorApp.Controllers
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');</script>");
|
||||
Response.Redirect("/Home/Enter");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
ViewBag.Payments = _paymentLogic.ReadList(new PaymentSearchModel { OperatorId = APIClient.Operator.Id });
|
||||
return View();
|
||||
@ -271,23 +294,34 @@ namespace OperatorApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult TransfersReport()
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return Redirect("/Home/Enter");
|
||||
}
|
||||
return View(new ReportBindingModel());
|
||||
}
|
||||
[HttpPost]
|
||||
public void TransfersReport(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.Operator == null)
|
||||
{
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||
return;
|
||||
}
|
||||
MemoryStream report = _reportLogic.SaveTransferPurchaseToPDF(new ReportBindingModel { DateFrom = dateFrom, DateTo = dateTo });
|
||||
try
|
||||
{
|
||||
_mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
Subject = "Отчёт о закупках",
|
||||
Text = "От банка \"Вы банкрот\"",
|
||||
Text = "Для оператора " + APIClient.Operator.LastName + APIClient.Operator.FirstName,
|
||||
MailAddress = "",
|
||||
FileName = "test.pdf",
|
||||
Attachment = report
|
||||
});
|
||||
Response.Redirect("/");
|
||||
Response.WriteAsync($"<script language=\"javascript\">alert('Mail sent!');window.location.replace('/');</script>");
|
||||
Redirect("/");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user