2023-05-17 11:10:25 +04:00
|
|
|
|
using BankBusinessLogic.BusinessLogics;
|
|
|
|
|
using BankContracts.BusinessLogicsContracts;
|
|
|
|
|
using BankContracts.StoragesContracts;
|
|
|
|
|
using BankDatabaseImplement.Implements;
|
2023-05-19 23:50:03 +04:00
|
|
|
|
using BankBusinessLogic.OfficePackage;
|
|
|
|
|
using BankBusinessLogic.OfficePackage.Implements;
|
2023-04-07 18:04:25 +04:00
|
|
|
|
using OperatorApp;
|
2023-05-19 23:50:03 +04:00
|
|
|
|
using BankBusinessLogic.MailWorker;
|
|
|
|
|
using BankContracts.BindingModels;
|
2023-04-07 18:04:25 +04:00
|
|
|
|
|
2023-04-07 11:58:10 +04:00
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
|
builder.Services.AddControllersWithViews();
|
|
|
|
|
|
2023-05-17 11:10:25 +04:00
|
|
|
|
builder.Services.AddTransient<IDealStorage, DealStorage>();
|
|
|
|
|
builder.Services.AddTransient<IPaymentStorage, PaymentStorage>();
|
|
|
|
|
builder.Services.AddTransient<ITransferStorage, TransferStorage>();
|
|
|
|
|
builder.Services.AddTransient<IOperatorStorage, OperatorStorage>();
|
|
|
|
|
|
2023-05-19 19:00:15 +04:00
|
|
|
|
builder.Services.AddTransient<ICurrencyPurchaseStorage, CurrencyPurchaseStorage>();
|
|
|
|
|
builder.Services.AddTransient<ICurrencyStorage, CurrencyStorage>();
|
|
|
|
|
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
2023-05-19 23:50:03 +04:00
|
|
|
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
2023-05-19 19:00:15 +04:00
|
|
|
|
|
2023-05-17 11:10:25 +04:00
|
|
|
|
builder.Services.AddTransient<IDealLogic, DealLogic>();
|
|
|
|
|
builder.Services.AddTransient<IPaymentLogic, PaymentLogic>();
|
|
|
|
|
builder.Services.AddTransient<ITransferLogic, TransferLogic>();
|
|
|
|
|
builder.Services.AddTransient<IOperatorLogic, OperatorLogic>();
|
2023-05-19 19:00:15 +04:00
|
|
|
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
2023-05-20 05:14:55 +04:00
|
|
|
|
builder.Services.AddTransient<ICurrencyLogic, CurrencyLogic>();
|
2023-05-17 11:10:25 +04:00
|
|
|
|
|
2023-04-07 11:58:10 +04:00
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
2023-05-19 23:50:03 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
|
|
|
|
mailSender?.MailConfig(new MailConfigBindingModel
|
|
|
|
|
{
|
|
|
|
|
MailLogin = builder.Configuration["MailLogin"] ?? string.Empty,
|
|
|
|
|
MailPassword = builder.Configuration["MailPassword"] ?? string.Empty,
|
|
|
|
|
SmtpClientHost = builder.Configuration["SmtpClientHost"] ?? string.Empty,
|
|
|
|
|
SmtpClientPort = Convert.ToInt32(builder.Configuration["SmtpClientPort"]),
|
|
|
|
|
PopHost = builder.Configuration["PopHost"] ?? string.Empty,
|
|
|
|
|
PopPort = Convert.ToInt32(builder.Configuration["PopPort"])
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
var logger = app.Services.GetService<ILogger>();
|
|
|
|
|
logger?.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-07 11:58:10 +04:00
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
|
|
|
app.UseHsts();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
app.MapControllerRoute(
|
|
|
|
|
name: "default",
|
|
|
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
|
|
|
|
|
|
app.Run();
|