фикс ошибок

This commit is contained in:
bekodeg 2024-05-22 09:46:17 +04:00
parent cd2a61c62f
commit 9d823692aa
4 changed files with 11 additions and 9 deletions

8
.gitignore vendored
View File

@ -371,8 +371,6 @@ healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017 # Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/ MigrationBackup/
*/Migrations/*
# Ionide (cross platform F# VS Code tools) working folder # Ionide (cross platform F# VS Code tools) working folder
.ionide/ .ionide/
@ -400,8 +398,4 @@ FodyWeavers.xsd
# JetBrains Rider # JetBrains Rider
*.sln.iml *.sln.iml
/SushiBar/SushiBarDatabaseImplement/Migrations/20240522053944_lab7.Designer.cs /SushiBar/SushiBarDatabaseImplement/Migrations/
/SushiBar/SushiBarDatabaseImplement/Migrations/20240522053944_lab7.cs
/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs
/SushiBar/SushiBarDatabaseImplement/Migrations/20240507181620_lab6.Designer.cs
/SushiBar/SushiBarDatabaseImplement/Migrations/20240507181620_lab6.cs

View File

@ -30,6 +30,7 @@ namespace SushiBar
var services = new ServiceCollection(); var services = new ServiceCollection();
ConfigureServices(services); ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider(); _serviceProvider = services.BuildServiceProvider();
try try
{ {
var mailSender = _serviceProvider.GetService<AbstractMailWorker>(); var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
@ -45,6 +46,12 @@ namespace SushiBar
var timer = new System.Threading.Timer(new var timer = new System.Threading.Timer(new
TimerCallback(MailCheck!), null, 0, 100000); TimerCallback(MailCheck!), null, 0, 100000);
} }
catch (Exception ex)
{
var logger = _serviceProvider.GetService<ILogger>();
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
}
Application.Run(_serviceProvider.GetRequiredService<FormMain>()); Application.Run(_serviceProvider.GetRequiredService<FormMain>());
} }
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)

View File

@ -59,7 +59,8 @@ namespace SushiBarBusinessLogic.BusinessLogics
return false; return false;
} }
model.Status = OrderStatus.Принят; model.Status = OrderStatus.Принят;
if (_orderStorage.Insert(model) == null) var res = _orderStorage.Insert(model);
if (res == null)
{ {
_logger.LogWarning("Insert operation failed"); _logger.LogWarning("Insert operation failed");
return false; return false;

View File

@ -9,7 +9,7 @@ namespace SushiBarDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db6;Username=postgres;Password=postgres"); optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db7;Username=postgres;Password=postgres");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);