Привязка "сделка-программа".
This commit is contained in:
parent
fa9ade8941
commit
56f7e44dd4
@ -18,6 +18,7 @@ namespace BankOperatorApp.Controllers
|
|||||||
private readonly ICreditProgramLogic _creditProgramLogic;
|
private readonly ICreditProgramLogic _creditProgramLogic;
|
||||||
private readonly ICurrencyLogic _currencyLogic;
|
private readonly ICurrencyLogic _currencyLogic;
|
||||||
private readonly ICurrencyPurchaseLogic _currencyPurchaseLogic;
|
private readonly ICurrencyPurchaseLogic _currencyPurchaseLogic;
|
||||||
|
private readonly IDealLogic _dealLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
private readonly AbstractMailWorker _mailWorker;
|
private readonly AbstractMailWorker _mailWorker;
|
||||||
public static BankOperatorViewModel? BankOperator { get; set; } = null;
|
public static BankOperatorViewModel? BankOperator { get; set; } = null;
|
||||||
@ -25,7 +26,8 @@ namespace BankOperatorApp.Controllers
|
|||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger, IBankOperatorLogic bankOperatorLogic,
|
public HomeController(ILogger<HomeController> logger, IBankOperatorLogic bankOperatorLogic,
|
||||||
ICreditProgramLogic creditProgramLogic, ICurrencyLogic currencyLogic,
|
ICreditProgramLogic creditProgramLogic, ICurrencyLogic currencyLogic,
|
||||||
ICurrencyPurchaseLogic currencyPurchaseLogic, IReportLogic reportLogic, AbstractMailWorker mailWorker)
|
ICurrencyPurchaseLogic currencyPurchaseLogic, IReportLogic reportLogic,
|
||||||
|
IDealLogic dealLogic, AbstractMailWorker mailWorker)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_bankOperatorLogic = bankOperatorLogic;
|
_bankOperatorLogic = bankOperatorLogic;
|
||||||
@ -33,6 +35,7 @@ namespace BankOperatorApp.Controllers
|
|||||||
_currencyLogic = currencyLogic;
|
_currencyLogic = currencyLogic;
|
||||||
_currencyPurchaseLogic = currencyPurchaseLogic;
|
_currencyPurchaseLogic = currencyPurchaseLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
|
_dealLogic = dealLogic;
|
||||||
_mailWorker = mailWorker;
|
_mailWorker = mailWorker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +113,8 @@ namespace BankOperatorApp.Controllers
|
|||||||
(new BankOperatorSearchModel { Login = login, Password = password });
|
(new BankOperatorSearchModel { Login = login, Password = password });
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Неверный логин/пароль");
|
Response.WriteAsync($"<script language=\"javascript\">alert('Wrong login or password!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Index");
|
||||||
}
|
}
|
||||||
@ -153,7 +157,9 @@ namespace BankOperatorApp.Controllers
|
|||||||
{
|
{
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
Response.WriteAsync($"<script language=\"javascript\">" +
|
||||||
|
$"alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
Redirect("/Home/Enter");
|
||||||
}
|
}
|
||||||
_currencyLogic.Create(new CurrencyBindingModel
|
_currencyLogic.Create(new CurrencyBindingModel
|
||||||
{
|
{
|
||||||
@ -182,7 +188,9 @@ namespace BankOperatorApp.Controllers
|
|||||||
{
|
{
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
Response.WriteAsync($"<script language=\"javascript\">" +
|
||||||
|
$"alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
Redirect("/Home/Enter");
|
||||||
}
|
}
|
||||||
Dictionary<int, ICurrencyModel> CurrencyCreditPrograms = new();
|
Dictionary<int, ICurrencyModel> CurrencyCreditPrograms = new();
|
||||||
foreach (int id in currencies)
|
foreach (int id in currencies)
|
||||||
@ -205,7 +213,9 @@ namespace BankOperatorApp.Controllers
|
|||||||
{
|
{
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == 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(_currencyPurchaseLogic.ReadList
|
return View(_currencyPurchaseLogic.ReadList
|
||||||
(new CurrencyPurchaseSearchModel { BankOperatorId = HomeController.BankOperator.Id }));
|
(new CurrencyPurchaseSearchModel { BankOperatorId = HomeController.BankOperator.Id }));
|
||||||
@ -215,7 +225,9 @@ namespace BankOperatorApp.Controllers
|
|||||||
{
|
{
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == 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.Currencies = _currencyLogic.ReadList(null);
|
ViewBag.Currencies = _currencyLogic.ReadList(null);
|
||||||
return View();
|
return View();
|
||||||
@ -225,7 +237,9 @@ namespace BankOperatorApp.Controllers
|
|||||||
{
|
{
|
||||||
if (HomeController.BankOperator == null)
|
if (HomeController.BankOperator == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
Response.WriteAsync($"<script language=\"javascript\">" +
|
||||||
|
$"alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
Redirect("/Home/Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
_currencyPurchaseLogic.Create(new CurrencyPurchaseBindingModel
|
_currencyPurchaseLogic.Create(new CurrencyPurchaseBindingModel
|
||||||
@ -345,5 +359,35 @@ namespace BankOperatorApp.Controllers
|
|||||||
return Redirect("/");
|
return Redirect("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult AddDealsToCreditProgram()
|
||||||
|
{
|
||||||
|
if (HomeController.BankOperator == null)
|
||||||
|
{
|
||||||
|
Response.WriteAsync($"<script language=\"javascript\">" +
|
||||||
|
$"alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
return Redirect("/Home/Enter");
|
||||||
|
}
|
||||||
|
ViewBag.CreditPrograms = _creditProgramLogic.ReadList(new CreditProgramSearchModel { BankOperatorId = HomeController.BankOperator.Id});
|
||||||
|
ViewBag.Deals = _dealLogic.ReadList(null);
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void AddDealsToCreditProgram(int creditProgram, List<int> deals)
|
||||||
|
{
|
||||||
|
if (HomeController.BankOperator == null)
|
||||||
|
{
|
||||||
|
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
|
||||||
|
Redirect("/Home/Enter");
|
||||||
|
}
|
||||||
|
foreach (var dealId in deals)
|
||||||
|
{
|
||||||
|
var deal = _dealLogic.ReadElement(new DealSearchModel { Id = dealId });
|
||||||
|
if (deal != null) _dealLogic.Update(new DealBindingModel { Id = deal.Id, ClientId = deal.ClientId, CreditProgramId = creditProgram });
|
||||||
|
}
|
||||||
|
Response.WriteAsync($"<script language=\"javascript\">alert('Success!');window.location.replace('/');</script>");
|
||||||
|
Redirect("/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,6 +33,7 @@ builder.Services.AddTransient<ICurrencyLogic, CurrencyLogic>();
|
|||||||
builder.Services.AddTransient<ICreditProgramLogic, CreditProgramLogic>();
|
builder.Services.AddTransient<ICreditProgramLogic, CreditProgramLogic>();
|
||||||
builder.Services.AddTransient<IBankOperatorLogic, BankOperatorLogic>();
|
builder.Services.AddTransient<IBankOperatorLogic, BankOperatorLogic>();
|
||||||
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
builder.Services.AddTransient<IDealLogic, DealLogic>();
|
||||||
|
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "CreatePayment";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Привязка сделок</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Выплата:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="creditProgram" name="creditProgram" class="form-control" required asp-items="@(new SelectList(@ViewBag.CreditPrograms,"Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Сделки:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="deals" name="deals" class="form-control" required multiple asp-items="@(new SelectList(@ViewBag.Deals,"Id", "DealDate"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -33,6 +33,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CurrencyPurchasePaymentsReport">Отчет по закупкам</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CurrencyPurchasePaymentsReport">Отчет по закупкам</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="AddDealsToCreditProgram">Привязка "сделка-программа"</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user