213 lines
6.6 KiB
C#
213 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Hangfire.Server;
|
|
using Kreta.Job.Tasks.Core;
|
|
using Kreta.Job.Tasks.Helpers.Email;
|
|
using Kreta.Job.Tasks.Helpers.Notification;
|
|
using Kreta.Resources;
|
|
|
|
namespace Kreta.Job.Tasks
|
|
{
|
|
public class NotificationJob : INotificationJob
|
|
{
|
|
public void SendErtekelesNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
ErtekelesNotificationHelper.SendErtekelesNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendRendszerUzenetNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
RendszeruzenetNotificationHelper.SendRendszeruzenetNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendMulasztasNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
MulasztasNotificationHelper.SendMulasztasNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendBejelentettSzamonkeresNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
BejelentettSzamonkeresNotificationHelper.SendBejelentettSzamonkeresNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
private static string NapFelirat(int nap) => nap == 3 ? FogadooraResource.Harom : FogadooraResource.Ot;
|
|
|
|
public void SendNemNaplozottTanorakMail()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
NemNaplozottTanorakEmailHelper.SendNemNaplozottTanorakMail(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendHazifeladatNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
HazifeladatNotificationHelper.SendHazifeladatNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendFeljegyzesNotification()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
FeljegyzesNotificationHelper.SendFeljegyzesNotification(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendKozelgoFogadooraMail()
|
|
{
|
|
var exceptions = new List<Exception>();
|
|
|
|
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
|
|
{
|
|
try
|
|
{
|
|
KozelgoFogadooraMailHelper.SendKozelgoFogadooraMail(connectionString);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
exceptions.Add(e);
|
|
}
|
|
}
|
|
|
|
if (exceptions.Any())
|
|
{
|
|
var aggregateException = new AggregateException(exceptions);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
|
|
public void SendOrarendValtozasNotification(PerformContext context)
|
|
{
|
|
try
|
|
{
|
|
OrarendValtozasNotificationHelper.SendOrarendValtozasNotification(context);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
var aggregateException = new AggregateException(e);
|
|
throw aggregateException.Flatten();
|
|
}
|
|
}
|
|
}
|
|
}
|