init
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.MessageBroker.Client.MobileNotification;
|
||||
using Kreta.Resources;
|
||||
using Serilog;
|
||||
using Serilog.Core.Enrichers;
|
||||
|
||||
namespace Kreta.Job.Tasks.Helpers.Notification
|
||||
{
|
||||
internal static class BejelentettSzamonkeresNotificationHelper
|
||||
{
|
||||
/// INFO @DevKornel: Mobil használja
|
||||
internal static void SendBejelentettSzamonkeresNotification(string connectionString)
|
||||
{
|
||||
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
|
||||
Dal.ServiceSystemConnection.Run(connectionString, h =>
|
||||
{
|
||||
var szamonkeresElorejelzesDal = h.SzamonkeresElorejelzes();
|
||||
try
|
||||
{
|
||||
var szamonkeresek = szamonkeresElorejelzesDal.GetAllSchemaBejelentettSzamonkeresNotification();
|
||||
szamonkeresElorejelzesDal.SetBejelentettSzamonkeresAsKikuldott(szamonkeresek.Select(x => x.SzamonkeresId).Distinct());
|
||||
|
||||
var mobileNotificationMessages = szamonkeresek.Select(item => MobileNotificationMessageHelper.CreateMessage(
|
||||
item.IntezmenyAzonosito,
|
||||
item.TanuloId,
|
||||
MobileNotificationMessageType.Exam,
|
||||
item.SzamonkeresId,
|
||||
string.Format(NotificationResource.BejelentettSzamonkeresNotificationMessage, item.TanuloNeve, item.TantargyNeve, item.SzamonkeresModId.GetItemNameFromCache(item.TanevId, item.IntezmenyAzonosito)),
|
||||
NotificationResource.BejelentettSzamonkeresTitle)
|
||||
).ToArray();
|
||||
|
||||
if (mobileNotificationMessages.Length > 0)
|
||||
{
|
||||
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Fatal(ex, ex.GetType().FullName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user