2024-05-29 11:23:13 +04:00
|
|
|
|
using VeterinaryClinicBusinessLogics.BusinessLogics;
|
2024-05-29 23:12:32 +04:00
|
|
|
|
using VeterinaryClinicBusinessLogics.OfficePackage.Implements;
|
|
|
|
|
using VeterinaryClinicBusinessLogics.OfficePackage;
|
2024-05-29 11:23:13 +04:00
|
|
|
|
using VeterinaryClinicContracts.BusinessLogicsContracts;
|
|
|
|
|
using VeterinaryClinicContracts.StoragesContracts;
|
|
|
|
|
using VeterinaryClinicDatabaseImplement.Implements;
|
2024-05-01 23:10:05 +04:00
|
|
|
|
using VeterinaryClinicWebApp;
|
2024-05-29 23:12:32 +04:00
|
|
|
|
using VeterinaryClinicBusinessLogics.MailWorker;
|
2024-05-29 23:48:13 +04:00
|
|
|
|
using System.Text;
|
2024-05-30 01:20:47 +04:00
|
|
|
|
using VeterinaryClinicContracts.BindingModels;
|
2024-05-01 23:10:05 +04:00
|
|
|
|
|
2024-04-30 12:46:36 +04:00
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
2024-05-01 03:06:53 +04:00
|
|
|
|
|
2024-05-29 23:48:13 +04:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
|
|
|
2024-05-01 03:06:53 +04:00
|
|
|
|
// Add services to the container.
|
|
|
|
|
builder.Services.AddControllersWithViews();
|
|
|
|
|
|
2024-05-29 11:23:13 +04:00
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IAnimalStorage, AnimalStorage>();
|
|
|
|
|
builder.Services.AddTransient<IMedicationStorage, MedicationStorage>();
|
|
|
|
|
builder.Services.AddTransient<IServiceStorage, ServiceStorage>();
|
|
|
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
|
builder.Services.AddTransient<IVaccinationStorage, VaccinationStorage>();
|
|
|
|
|
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
|
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IAnimalLogic, AnimalLogic>();
|
|
|
|
|
builder.Services.AddTransient<IMedicationLogic, MedicationLogic>();
|
|
|
|
|
builder.Services.AddTransient<IServiceLogic, ServiceLogic>();
|
|
|
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
|
builder.Services.AddTransient<IVaccinationLogic, VaccinationLogic>();
|
|
|
|
|
builder.Services.AddTransient<IVisitLogic, VisitLogic>();
|
|
|
|
|
|
2024-05-29 23:12:32 +04:00
|
|
|
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
|
|
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
|
|
|
|
|
2024-05-29 11:23:13 +04:00
|
|
|
|
builder.Services.AddSession(options =>
|
|
|
|
|
{
|
|
|
|
|
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
|
|
|
|
options.Cookie.HttpOnly = true;
|
|
|
|
|
options.Cookie.IsEssential = true;
|
|
|
|
|
});
|
|
|
|
|
|
2024-04-30 12:46:36 +04:00
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
2024-05-30 01:20:47 +04:00
|
|
|
|
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
|
|
|
|
|
|
|
|
|
mailSender?.MailConfig(new MailConfigBindingModel
|
|
|
|
|
{
|
|
|
|
|
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
|
|
|
|
|
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
|
|
|
|
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
|
|
|
|
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
|
|
|
|
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
|
|
|
|
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-01 03:06:53 +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?}");
|
2024-04-30 12:46:36 +04:00
|
|
|
|
|
|
|
|
|
app.Run();
|