From 3cf880832c1e7e95a419f7120f6e1beb2776e3b6 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 19 Dec 2023 12:28:41 +0500 Subject: [PATCH] =?UTF-8?q?1.=20=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D1=8F=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=20=D0=BA=D0=BB=D1=8E=D1=87=D0=BE=D0=BC=2020000=202.=20?= =?UTF-8?q?=D0=9A=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=BD=D1=8B=D1=85=20=D1=83=D0=B2?= =?UTF-8?q?=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9=20=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D1=8F=D1=82=D0=B0=D0=BD=D0=B0=20=D0=B2=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/DefaultData/EntityNotificationCategory.cs | 2 +- AsbCloudDb/Model/NotificationCategory.cs | 8 +++++++- .../Services/DrillingProgram/DrillingProgramService.cs | 7 +++---- .../Services/WellFinalDocumentsService.cs | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs b/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs index f65bd4e1..2a2e5eab 100644 --- a/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs +++ b/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs @@ -4,6 +4,6 @@ public class EntityNotificationCategory : EntityFiller { public override NotificationCategory[] GetData() => new NotificationCategory[] { - new() { Id = 1, Name = "Системные уведомления" } + new() { Id = NotificationCategory.IdSystemNotificationCategory, Name = "Системные уведомления" } }; } \ No newline at end of file diff --git a/AsbCloudDb/Model/NotificationCategory.cs b/AsbCloudDb/Model/NotificationCategory.cs index 3da37e30..879b59d8 100644 --- a/AsbCloudDb/Model/NotificationCategory.cs +++ b/AsbCloudDb/Model/NotificationCategory.cs @@ -8,7 +8,13 @@ namespace AsbCloudDb.Model; [Table("t_notification_category"), Comment("Категории уведомлений")] public class NotificationCategory : IId { - [Key] + #region constants category notifications ids + /// + /// СИСТЕМНЫЕ УВЕДОМЛЕНИЯ + /// + public const int IdSystemNotificationCategory = 1; + + [Key] [Column("id")] public int Id { get; set; } diff --git a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs index c91689a3..c7fc2f5d 100644 --- a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs +++ b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs @@ -35,7 +35,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram private readonly BackgroundWorker backgroundWorker; private readonly NotificationService notificationService; - private const int idNotificationCategory = 20000; private const int idTransportType = 1; private const int idFileCategoryDrillingProgram = 1000; @@ -398,7 +397,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType @@ -422,7 +421,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType @@ -442,7 +441,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType diff --git a/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs b/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs index 8ac7c15c..7a736ba9 100644 --- a/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs +++ b/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using AsbCloudApp.Services.Notifications; +using AsbCloudDb.Model; namespace AsbCloudInfrastructure.Services { @@ -136,7 +137,6 @@ namespace AsbCloudInfrastructure.Services private async Task SendMessageAsync(WellDto well, UserDto user, string documentCategory, string message, CancellationToken cancellationToken) { - const int idNotificationCategory = 20000; const int idTransportType = 1; var factory = new WellFinalDocumentMailBodyFactory(configuration); @@ -151,7 +151,7 @@ namespace AsbCloudInfrastructure.Services await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType