This commit is contained in:
2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions
+328
View File
@@ -0,0 +1,328 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using Aspose.Cells;
using Hangfire;
using Kreta.Core.Configuratiaton.Interface;
using Kreta.Core.Logic;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.ParameterClasses;
using Kreta.Framework;
using Kreta.Job.Tasks.Core.Models;
using Kreta.Resources;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace Kreta.Job.Tasks.Core
{
public abstract class BankszamlaIgenylesJob
{
private readonly string FINISHED_EXTENSION = "finished";
private readonly string CSV_EXTENSION = "csv";
private readonly string DATETIMEFORMAT = "MM/dd/yyyy HH:mm:ss";
public void BankszamlaIgenyles()
{
}
protected abstract string GetInPart();
protected abstract string GetErrorPart();
protected abstract string GetOkPart();
protected abstract string GetArchivePart();
protected abstract string DecryptEgyediAzonosito(string resceivedEgyediAzonosito);
protected abstract bool HasRowWithError(List<BankszamlaIgenylesPco> bankszamlaIgenylesPcos);
protected void RunBankszamlaIgenylesJob<T>() where T : IBankszamlaIgenylesConfiguration
{
foreach ((FileStream FileStream, string FileName) fileStreamAndName in GetSzamlaIgenylesFileList<T>())
{
var bankszamlaIgenylesPcoList = GetPcoListFromCsv(fileStreamAndName.FileStream);
var connectionStringList = GetBankiIntezmenyConnectionStringListFromFile();
foreach (string connectionString in connectionStringList)
{
var resultBankszamlaIgenylesPcoList = new List<BankszamlaIgenylesPco>();
foreach (BankszamlaIgenylesPco bankszamlaIgenylesPco in bankszamlaIgenylesPcoList)
{
if (!bankszamlaIgenylesPco.IsError && string.IsNullOrWhiteSpace(bankszamlaIgenylesPco.IntezmenyAzonosito))
{
Dal.ServiceSystemConnection.Run(connectionString, h => { resultBankszamlaIgenylesPcoList.Add(h.BankszamlaIgenylesDal().BankszamlaIgenyles(bankszamlaIgenylesPco)); });
}
else
{
resultBankszamlaIgenylesPcoList.Add(bankszamlaIgenylesPco);
}
}
bankszamlaIgenylesPcoList = resultBankszamlaIgenylesPcoList;
}
foreach (var bankszamlaIgenylesPco in bankszamlaIgenylesPcoList)
{
if (bankszamlaIgenylesPco.IsTanuloNemtalalhatoEgyediAzonositoAlapjan)
{
bankszamlaIgenylesPco.IsError = true;
bankszamlaIgenylesPco.ErrorText = string.Format(ErrorResource.BankiTanuloNemTalalhatoEgyediAzonositoAlapjan, bankszamlaIgenylesPco.EgyediAzonosito);
}
}
CreateFiles<T>(bankszamlaIgenylesPcoList, fileStreamAndName.FileName);
SendEmail<T>(bankszamlaIgenylesPcoList, fileStreamAndName.FileName);
}
}
protected List<BankszamlaIgenylesPco> GetPcoListFromCsv(FileStream fileStream)
{
var result = new List<BankszamlaIgenylesPco>();
var loadOptions = new TxtLoadOptions(LoadFormat.CSV)
{
Separator = '|',
Encoding = Encoding.GetEncoding("ISO-8859-1")
};
using (fileStream)
using (var workbook = new Workbook(fileStream, loadOptions))
{
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
int lastRowIndex = cells.Rows.Count;
for (int rowIndex = 2; rowIndex < lastRowIndex; rowIndex++)
{
string egyediAzonosito = cells.GetCell(rowIndex, 0) == null ? string.Empty : cells.GetCell(rowIndex, 0).Value.ToString();
string szamlaszam = cells.GetCell(rowIndex, 1) == null ? string.Empty : cells.GetCell(rowIndex, 1).Value.ToString();
string nyitasNapja = cells.GetCell(rowIndex, 2) == null ? string.Empty : cells.GetCell(rowIndex, 2).Value.ToString();
var pco = new BankszamlaIgenylesPco
{
EgyediAzonosito = egyediAzonosito,
BankszamlaSzam = szamlaszam,
NyitasNapja = nyitasNapja,
Sorszam = rowIndex - 1
};
result.Add(BankszamlaIgenylesPcoValidator(pco));
}
}
return result;
}
public List<(FileStream FileStream, string FileName)> GetSzamlaIgenylesFileList<T>() where T : IBankszamlaIgenylesConfiguration
{
var configuration = (T)ConfigurationManager.GetSection(typeof(T).Name);
var fileStreamAndNameList = new List<(FileStream, string)>();
List<string> finishedFileList = Directory.GetFiles($"{configuration.ArrivedFilePathRoot}{GetInPart()}", $"*.{FINISHED_EXTENSION}")
.Select(Path.GetFileName)
.ToList();
List<string> csvFileList = Directory.GetFiles($"{configuration.ArrivedFilePathRoot}{GetInPart()}", $"*.{CSV_EXTENSION}")
.Select(Path.GetFileName)
.ToList();
foreach (var fileName in csvFileList)
{
int index = fileName.LastIndexOf(".");
if (index > 0)
{
string fileNameWithoutExtenion = fileName.Substring(0, index);
if (finishedFileList.Any(x => x.Substring(0, index).Equals(fileNameWithoutExtenion)))
{
var file = new FileStream($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileName}", FileMode.Open, FileAccess.Read);
fileStreamAndNameList.Add((file, fileName));
}
}
}
return fileStreamAndNameList;
}
protected void CreateFiles<T>(List<BankszamlaIgenylesPco> bankszamlaIgenylesPco, string fileName) where T : IBankszamlaIgenylesConfiguration
{
var configuration = (T)ConfigurationManager.GetSection(typeof(T).Name);
if (bankszamlaIgenylesPco.Any(x => !x.IsError))
{
//NOTE:Create OK file
SaveFileFromMemoryStream(CreateFileFromPco(bankszamlaIgenylesPco.Where(x => !x.IsError).ToList(), fileName), fileName, $"{configuration.ArrivedFilePathRoot}{GetOkPart()}");
}
if (bankszamlaIgenylesPco.Any(x => x.IsError))
{
//NOTE:Create Error file
SaveFileFromMemoryStream(CreateFileFromPco(bankszamlaIgenylesPco.Where(x => x.IsError).ToList(), fileName), fileName, $"{configuration.ArrivedFilePathRoot}{GetErrorPart()}");
}
//NOTE: Az eredeti fájlok (.csv, .finished) az archive mappába kerülnek
ArchivateOldFiles(configuration, fileName);
}
private void ArchivateOldFiles(IBankszamlaIgenylesConfiguration configuration, string fileName)
{
var fileNameWithoutExtenion = string.Empty;
int index = fileName.LastIndexOf(".");
if (index > 0)
{
fileNameWithoutExtenion = fileName.Substring(0, index);
}
File.Move($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileNameWithoutExtenion}.{CSV_EXTENSION}", $"{configuration.ArrivedFilePathRoot}{GetArchivePart()}{fileNameWithoutExtenion}.{CSV_EXTENSION}");
if (File.Exists($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileNameWithoutExtenion}.{FINISHED_EXTENSION}"))
{
File.Move($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileNameWithoutExtenion}.{FINISHED_EXTENSION}", $"{configuration.ArrivedFilePathRoot}{GetArchivePart()}{fileNameWithoutExtenion}.{FINISHED_EXTENSION}");
}
if (File.Exists($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileNameWithoutExtenion}.{CSV_EXTENSION}.{FINISHED_EXTENSION}"))
{
File.Move($"{configuration.ArrivedFilePathRoot}{GetInPart()}{fileNameWithoutExtenion}.{CSV_EXTENSION}.{FINISHED_EXTENSION}", $"{configuration.ArrivedFilePathRoot}{GetArchivePart()}{fileNameWithoutExtenion}.{CSV_EXTENSION}.{FINISHED_EXTENSION}");
}
}
private MemoryStream CreateFileFromPco(List<BankszamlaIgenylesPco> bankszamlaIgenylesPco, string fileName)
{
using (var workbook = new Workbook())
{
WorksheetCollection worksheets = workbook.Worksheets;
Worksheet worksheet = worksheets.Add(fileName.Length < 32 ? fileName : fileName.Substring(0, 30));
int rowNumber = 1;
foreach (BankszamlaIgenylesPco pco in bankszamlaIgenylesPco)
{
worksheet.Cells[rowNumber, 0].Value = $"'{pco.EgyediAzonosito}";
worksheet.Cells[rowNumber, 1].Value = $"'{pco.BankszamlaSzam}";
rowNumber++;
}
var saveOptions = new TxtSaveOptions(SaveFormat.CSV)
{
Separator = '|',
Encoding = Encoding.GetEncoding("ISO-8859-1")
};
var memorystream = new MemoryStream();
workbook.Worksheets.ActiveSheetIndex = 1;
workbook.Save(memorystream, saveOptions);
memorystream.Position = 0;
return memorystream;
}
}
private void SaveFileFromMemoryStream(MemoryStream memoryStream, string fileName, string path)
{
using (var file = new FileStream($"{path}{fileName}", FileMode.Create, FileAccess.Write))
{
var bytes = new byte[memoryStream.Length];
_ = memoryStream.Read(bytes, 0, (int)memoryStream.Length);
file.Write(bytes, 0, bytes.Length);
memoryStream.Close();
file.Close();
}
}
private BankszamlaIgenylesPco BankszamlaIgenylesPcoValidator(BankszamlaIgenylesPco bankszamlaIgenylesPco)
{
var errorList = new List<string>();
bankszamlaIgenylesPco.EgyediAzonosito = DecryptEgyediAzonosito(bankszamlaIgenylesPco.EgyediAzonosito);
BankszamlaIgenylesPco pco = bankszamlaIgenylesPco;
if (string.IsNullOrWhiteSpace(bankszamlaIgenylesPco.EgyediAzonosito))
{
errorList.Add(ErrorResource.BankiEgyediAzonositoKotelezo);
}
else
{
if (!Guid.TryParse(bankszamlaIgenylesPco.EgyediAzonosito, out _))
{
errorList.Add(ErrorResource.BankiEgyediAzonositoNemMegfeleloFormatum);
}
}
if (string.IsNullOrWhiteSpace(bankszamlaIgenylesPco.NyitasNapja))
{
errorList.Add(ErrorResource.BankiNyitasNapjaKotelezo);
}
else
{
if (DateTime.TryParseExact(bankszamlaIgenylesPco.NyitasNapja, DATETIMEFORMAT, CultureInfo.InvariantCulture, DateTimeStyles.None, out _))
{
errorList.Add(ErrorResource.BankiNyitasNapjaNemMegfeleloFormatum);
}
}
if (string.IsNullOrWhiteSpace(bankszamlaIgenylesPco.BankszamlaSzam))
{
errorList.Add(ErrorResource.BankiBankszamlaSzamKotelezo);
}
else
{
bankszamlaIgenylesPco.BankszamlaSzam = bankszamlaIgenylesPco.BankszamlaSzam.Replace(" ", string.Empty).Replace("-", string.Empty);
string errorText = BankszamlaLogic.CDVValidacio(string.Join("-", BankszamlaLogic.StringSplitByChunkSize(bankszamlaIgenylesPco.BankszamlaSzam, 8)));
if (!string.IsNullOrWhiteSpace(errorText))
{
errorList.Add(errorText);
}
}
bankszamlaIgenylesPco.IsError = errorList.Count > 0;
bankszamlaIgenylesPco.ErrorText = string.Join(Environment.NewLine, errorList);
return pco;
}
protected void SendEmail<T>(List<BankszamlaIgenylesPco> bankszamlaIgenylesPcoList, string fileName) where T : IBankszamlaIgenylesConfiguration
{
if (!HasRowWithError(bankszamlaIgenylesPcoList))
{
// NOTE: OTP esetén csak akkor kell küldeni email-t, ha van hibás sor a feldolgozott állományban. MKB esetén minden esetben.
return;
}
var configuration = (T)ConfigurationManager.GetSection(typeof(T).Name);
var message = string.Empty;
int leadingZeros = bankszamlaIgenylesPcoList.Select(x => x.Sorszam).Max().ToString().Length;
foreach (var pco in bankszamlaIgenylesPcoList.OrderBy(x => x.Sorszam))
{
message += $"{pco.Sorszam.ToString($"D{leadingZeros}")}: {(pco.IsError ? pco.ErrorText : CommonResource.Ok)}<br />";
}
var emailModel = new EmailModel
{
Message = message,
Subject = $"{fileName} {EmailResource.BankszamlaIgenylesFileFeldolgozasReport}",
TargetEmail = configuration.EmailAddress
};
BackgroundJob.Enqueue<IEmailJob>(email => email.SendMailAsync(emailModel));
}
protected List<string> GetBankiIntezmenyConnectionStringListFromFile()
{
var systemConnectionStrings = new List<string>();
if (!string.IsNullOrWhiteSpace(KretaServer.KretaServer.Instance.Configuration.BankszamlaIgenylesConnectionStringFile))
{
string bankszamlaIgenylesConnectionStringFile = KretaServer.KretaServer.Instance.Configuration.BankszamlaIgenylesConnectionStringFile;
try
{
if (File.Exists(bankszamlaIgenylesConnectionStringFile))
{
JsonTextReader reader = new JsonTextReader(new StreamReader(bankszamlaIgenylesConnectionStringFile));
var builder = new Microsoft.Extensions.Configuration.ConfigurationBuilder();
builder.AddJsonFile(bankszamlaIgenylesConnectionStringFile);
IConfigurationRoot configuration = builder.Build();
systemConnectionStrings = configuration.GetSection("config:connectionStrings").GetChildren().Select(x => x.Value).ToList();
}
}
catch (Exception ex)
{
SDAServer.Instance.Logger.ExceptionThrown(ex);
}
}
return systemConnectionStrings;
}
}
}
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using Kreta.BusinessLogic.Helpers.Models;
using Kreta.Framework.Caching;
namespace Kreta.Job.Tasks.Cache
{
public class OrarendValtozasCache : GenericCache<object>
{
private static readonly string orarendValtozasCache = $"{nameof(Kreta)}_{nameof(OrarendValtozasCache)}";
public OrarendValtozasCache(CacheManager cacheManager) : base(cacheManager, nameof(OrarendValtozasCache)) { }
protected string GetCacheKey(string intezmenyAzonosito)
{
return $"{orarendValtozasCache}_{intezmenyAzonosito}";
}
public List<OrarendValtozasModel> GetOrarendValtozasok(string intezmenyAzonosito)
{
return (List<OrarendValtozasModel>)Get(GetCacheKey(intezmenyAzonosito)) ?? new List<OrarendValtozasModel>();
}
public void AddOrUpdateOrarendValtozas(List<OrarendValtozasModel> value, string intezmenyAzonosito)
{
AddOrUpdate(GetCacheKey(intezmenyAzonosito), value, k => value);
}
public void RemoveOrarendValtozasok(string intezmenyAzonosito)
{
Remove(GetCacheKey(intezmenyAzonosito));
}
}
}
@@ -0,0 +1,21 @@
using Kreta.Framework;
using Kreta.Job.Tasks.Core;
using Kreta.KretaServer.Caching;
namespace Kreta.Job.Tasks
{
public class ConnectionStringCacheJob : IConnectionStringCacheJob
{
private readonly ConnectionStringCache ConnectionStringCache;
public ConnectionStringCacheJob()
{
ConnectionStringCache = SDAServer.Instance.CacheManager.AquireCache<ConnectionStringCache>();
}
public void ResetAllConnectionString()
{
ConnectionStringCache.ResetCache();
}
}
}
+19
View File
@@ -0,0 +1,19 @@
namespace Kreta.Job.Tasks
{
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Core;
public class DeleteInvalidLinksJob : IDeleteInvalidLinksJob
{
public void DeleteInvalidLinks()
{
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
h.JelszoModositasLinkDal().DeleteInvalidLinks();
});
}
}
}
}
+152
View File
@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Text;
using Kreta.Core;
using Kreta.Core.Configuratiaton;
using Kreta.DataAccessManual;
using Kreta.EESZTInterface;
using Kreta.EESZTInterface.Processors;
using Kreta.Job.Tasks.Core;
using Kreta.Resources;
namespace Kreta.Job.Tasks
{
public class EESZTInterfaceJob : IEESZTInterfaceJob
{
public EESZTConfiguration EESZTConfiguration { get; }
public KretaJobConfig KretaJobConfig { get; set; }
public EESZTInterfaceJob(EESZTConfiguration eESZTConfiguration, KretaJobConfig kretaJobConfig)
{
EESZTConfiguration = eESZTConfiguration;
KretaJobConfig = kretaJobConfig;
}
public void GetEESZTAllomany()
{
var adat = new List<byte>();
string allomanyNev = "";
try
{
var tajProcessor = new TAJProcessor();
var stsHelper = new STSHelper();
var samlAssertion = stsHelper.GetSamlAssertion(EESZTConfiguration.InterfaceUrl);
var eFtHelper = new EFTHelper(EESZTConfiguration.InterfaceUrl);
var clientUserId = EESZTConfiguration.ClientUserId;
var organizationId = EESZTConfiguration.OrganizationId;
var getIntezmenyiAllomanyListaResponse = eFtHelper.CallIntezmenyAllomanyLista(samlAssertion, clientUserId, organizationId);
var allomany = getIntezmenyiAllomanyListaResponse.IntezmenyiAllomanyListaResponse.IntezmenyiAllomanyListaResponseBusinessContent.Allomanyok.OrderByDescending(x => x.Datum).FirstOrDefault();
if (allomany == default)
{
throw new ApplicationException(EESZTInterfaceResource.NemVoltLetolthetoAllomany);
}
allomanyNev = $"{allomany.Nev}{allomany.Kiterjesztes}";
var publikusId = allomany.PublikusId;
var sorszam = allomany.Darabszam;
for (int j = 0; j < sorszam; j++)
{
var (getAllomanyReszResponse, attachment) = eFtHelper.CallAllomanyResz(samlAssertion, clientUserId, organizationId, publikusId, j + 1);
var computedHashArray = EFTHelper.ComputeSha256Hash(attachment);
var computedHash = Convert.ToBase64String(computedHashArray);
if (computedHash != getAllomanyReszResponse.AllomanyReszResponse.AllomanyReszResponseBusinessContent.AllomanyResz.Hash)
{
throw new ApplicationException(string.Format(EESZTInterfaceResource.AllomanyReszHashKulonbozoseg, publikusId, j));
}
adat.AddRange(attachment);
}
var hashArray = EFTHelper.ComputeSha256Hash(adat.ToArray());
var hash = Convert.ToBase64String(hashArray);
if (hash != allomany.Hash)
{
throw new ApplicationException(string.Format(EESZTInterfaceResource.AllomanyHashKulonbozoseg, publikusId));
}
//File.WriteAllBytes($@"c:\temp\eFT\{allomany.Nev}_{allomany.Datum:yyMMdd_hhmmss}_{DateTime.Now:yyMMdd_hhmmss}{allomany.Kiterjesztes}", adat.ToArray());// EFTHelper.Decompress(adat.ToArray()));
var sikeresAllomanyLetoltesResponse = eFtHelper.CallSikeresAllomanyLetoltes(samlAssertion, clientUserId, organizationId, publikusId);
if (sikeresAllomanyLetoltesResponse.SikeresAllomanyLetoltesResponse.SikeresAllomanyLetoltesResponseBusinessContent != "")
{
throw new ApplicationException(string.Format(EESZTInterfaceResource.SikeresLetoltesVisszejelzesHiba, publikusId));
}
tajProcessor.AddFileContent(adat.ToArray());
var fertozottOssz = 0;
var marNemFertozottOssz = 0;
foreach (var azonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
var connectionString = KretaServer.KretaServer.Instance.GetIntezmenyConnectionString(azonosito);
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var intezmenyId = h.IntezmenyDal().GetIntezmenyIdByAzonosito(azonosito);
if (intezmenyId.HasValue)
{
var intezmeny = h.IntezmenyDal().Get(intezmenyId.Value);
var tanev = intezmeny.Tanev.SingleOrDefault(x => x.Aktiv.HasValue && x.Aktiv.Value && !x.Torolt);
if (tanev != default)
{
var (fertozott, marNemFertozott) = tajProcessor.UpdateDB(h, tanev.ID);
fertozottOssz += fertozott;
marNemFertozottOssz += marNemFertozott;
}
}
});
}
if (!string.IsNullOrWhiteSpace(EESZTConfiguration.MailToAddresses))
{
SendEESZTInterfaceEmail(true, new MemoryStream(adat.ToArray()), allomanyNev, string.Format(EESZTInterfaceResource.FertozottMarNemFertozottText, fertozottOssz, marNemFertozottOssz));
}
}
catch (Exception ex)
{
if (!string.IsNullOrWhiteSpace(EESZTConfiguration.MailToAddresses))
{
SendEESZTInterfaceEmail(false, new MemoryStream(adat.ToArray()), allomanyNev, ex.Message);
}
throw;
}
}
private void SendEESZTInterfaceEmail(bool sikeres, MemoryStream ms, string allomanynev, string bodyExtension = null)
{
var mail = new MailMessage(KretaJobConfig.DefaultEmail, KretaJobConfig.DefaultEmail)
{
Subject = sikeres ? EESZTInterfaceResource.EmailSubjectSikeres : EESZTInterfaceResource.EmailSubjectSikertelen,
SubjectEncoding = Encoding.UTF8,
Body = string.Format((sikeres ? EESZTInterfaceResource.EmailTorzsSikeres : EESZTInterfaceResource.EmailTorzsSikertelen), KretaServer.KretaServer.Instance.Configuration.SystemType),
IsBodyHtml = false,
BodyEncoding = Encoding.UTF8,
DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
};
if (!string.IsNullOrWhiteSpace(bodyExtension))
{
mail.Body += (Environment.NewLine + bodyExtension);
}
Attachment attachment = null;
if (ms.Length > 0)
{
attachment = new Attachment(ms, allomanynev);
mail.Attachments.Add(attachment);
}
foreach (var address in EESZTConfiguration.MailToAddresses.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
{
mail.To.Add(address);
}
mail.To.RemoveAt(0);
using (var client = new SmtpClient())
{
client.Send(mail);
}
if (attachment != null)
{
attachment.Dispose();
}
ms.Close();
}
}
}
+112
View File
@@ -0,0 +1,112 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Kreta.Core;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Core.Models;
namespace Kreta.Job.Tasks
{
public class EmailJob : IEmailJob
{
private KretaJobConfig KretaJobConfig { get; }
public EmailJob(KretaJobConfig kretaJobConfig)
{
KretaJobConfig = kretaJobConfig;
}
public async Task SendMailAsync(EmailModel emailModel)
{
if (KretaJobConfig.IsEmailEnabled)
{
if (string.IsNullOrWhiteSpace(emailModel.TargetEmail))
{
emailModel.TargetEmail = KretaJobConfig.DefaultEmail;
}
if (string.IsNullOrWhiteSpace(emailModel.FromEmail))
{
emailModel.FromEmail = KretaJobConfig.DefaultEmail;
}
if (emailModel.TargetEmail.IsValidEmail())
{
var mail = new MailMessage(emailModel.FromEmail, emailModel.TargetEmail)
{
Subject = emailModel.Subject,
SubjectEncoding = Encoding.UTF8,
Body = $"{emailModel.Message}{emailModel.Footer}",
IsBodyHtml = true,
BodyEncoding = Encoding.UTF8,
DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
};
if (emailModel.Buffer != null && emailModel.Buffer.Length > 0 && !string.IsNullOrWhiteSpace(emailModel.FileName))
{
MemoryStream ms = new MemoryStream(emailModel.Buffer);
mail.Attachments.Add(new Attachment(ms, emailModel.FileName));
}
if (!string.IsNullOrWhiteSpace(emailModel.Bcc))
mail.Bcc.Add(emailModel.Bcc);
using (var client = new SmtpClient())
{
await client.SendMailAsync(mail);
}
}
}
}
public void SendMailMessages(List<EmailModel> emailJobList)
{
if (KretaJobConfig.IsEmailEnabled)
{
foreach (var emailModel in emailJobList)
{
if (string.IsNullOrWhiteSpace(emailModel.TargetEmail))
{
emailModel.TargetEmail = KretaJobConfig.DefaultEmail;
}
if (string.IsNullOrWhiteSpace(emailModel.FromEmail))
{
emailModel.FromEmail = KretaJobConfig.DefaultEmail;
}
if (emailModel.TargetEmail.IsValidEmail())
{
var mail = new MailMessage(emailModel.FromEmail, emailModel.TargetEmail)
{
Subject = emailModel.Subject,
SubjectEncoding = Encoding.UTF8,
Body = $"{emailModel.Message}{emailModel.Footer}",
IsBodyHtml = true,
BodyEncoding = Encoding.UTF8,
DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
};
if (emailModel.Buffer != null && emailModel.Buffer.Length > 0 && !string.IsNullOrWhiteSpace(emailModel.FileName))
{
MemoryStream ms = new MemoryStream(emailModel.Buffer);
mail.Attachments.Add(new Attachment(ms, emailModel.FileName));
}
if (!string.IsNullOrWhiteSpace(emailModel.Bcc))
mail.Bcc.Add(emailModel.Bcc);
using (var client = new SmtpClient())
{
client.Send(mail);
}
}
}
}
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.Data;
namespace Kreta.Job.Tasks.Entities
{
internal class IdWithData
{
public IdWithData(int id, DataRow data)
{
Id = id;
Data = data;
}
public int Id { get; set; }
public DataRow Data { get; set; }
}
}
+77
View File
@@ -0,0 +1,77 @@
namespace Kreta.Job.Tasks
{
using Hangfire.Server;
using Kreta.Client.Eugyintezes;
using Kreta.Client.Eugyintezes.Configuration;
using Kreta.DataAccessManual;
using Kreta.Enums.ManualEnums;
using Kreta.Job.Tasks.Core;
using Kreta.Resources;
using static Kreta.Core.Constants;
public class EugyintezesJob : IEugyintezesJob
{
public void BaiSzinkronizacio(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, int kretaId, string jsonData)
{
int retryCount = context.GetJobParameter<int>("RetryCount");
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
var result = eUgyClient.PostBAIHatarozatok(jsonData);
Dal.OrganizationConnection.Run(intezmenyAzonosio, h =>
{
var dal = h.Nebulo();
if (!string.IsNullOrWhiteSpace(result) && result.Replace("\"", "").Length > 0)
{
dal.UpdateNebuloStatusz(kretaId, result, (int)EugyStatuszEnum.Sikeres);
}
else if (result == "\"\"")
{
dal.UpdateNebuloStatusz(kretaId, result.Replace("\"", ""), (int)EugyStatuszEnum.HibasRosszAStatuszHianypotlas);
}
else
{
if (General.BaiAdatszinkronRetryAttempts <= retryCount)
{
dal.UpdateNebuloStatusz(kretaId, result, (int)EugyStatuszEnum.Hibas);
}
throw new System.Exception("Ervénytelen kísérlet!");
}
});
}
public void TeremBerbeadhatoStatuszValtozas(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, string jsonData)
{
int retryCount = context.GetJobParameter<int>("RetryCount");
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
var result = eUgyClient.PostTeremBerbeadhatoStatuszValtozas(jsonData, intezmenyAzonosio);
if (General.EugySzinkronRetryAttempts <= retryCount)
{
throw new System.Exception(ErrorResource.EugySzinkronRetryAttempts);
}
}
public void TanuloOsztalyBesorolasStatuszValtozas(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, string jsonData)
{
int retryCount = context.GetJobParameter<int>("RetryCount");
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
var result = eUgyClient.PostTanuloOsztalyBesorolasStatuszValtozas(jsonData);
if (General.EugySzinkronRetryAttempts <= retryCount)
{
throw new System.Exception(ErrorResource.EugySzinkronRetryAttempts);
}
}
private class EugyConfig : IEugyintezesClientConfiguration
{
public string BaseUrl { get; set; }
public string ApiKey { get; set; }
public bool IsUzenetekEnable { get; set; }
public int UzenetekFrequencyRate { get; set; }
}
}
}
+61
View File
@@ -0,0 +1,61 @@
using System;
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
using Kreta.Core.Iktato.Poszeidon.Infrastructure.Interface;
using Kreta.DataAccessManual;
using Kreta.Framework;
using Kreta.Job.Tasks.Core;
namespace Kreta.Job.Tasks
{
public class FeltoltesJob : IktatasJobBase, IFeltoltesJob
{
public FeltoltesJob(IIktatoRepositoryFactory iktatoRepositoryFactory, IWcfServiceContext wcfServiceContext, Kreta.Core.IktatoServiceConfiguration iktatoServiceConfiguration) : base(iktatoRepositoryFactory, wcfServiceContext, iktatoServiceConfiguration)
{
}
[Hangfire.AutomaticRetry(Attempts = 2)]
[JobStateWatcher(typeof(FeltoltesJob), nameof(WriteFailedJobId))]
public void FeltoltesUjVerzioDal(int iktatottDokumentumId, string intezmenyAzonosito, int intezmenyId, int tanevId)
{
DataAccessManual.Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
var intezmeny = h.IntezmenyDal().Get(intezmenyId);
var iktatottDokumentum = h.IktatottDokumentumDal().Get(iktatottDokumentumId);
var iktatoRepositoryConfiguration = GetIktatoRepositoryConfiguration(intezmeny.IktatoSzervezetAzonosito, intezmeny.PoszeidonBejelentkezesiNev);
IktatoRepositoryFactory.GetIktatoRepository(iktatoRepositoryConfiguration).FeltoltesUjVerzio(iktatottDokumentum.FajlNev, System.IO.Path.GetExtension(iktatottDokumentum.FajlNev).Substring(1), iktatottDokumentum.Dokumentum.Tartalom, iktatottDokumentum.ElektronikusPeldanyId.Value.ToString());
iktatottDokumentum.DokumentumStatusz = (int)Enums.DokumentumStatuszEnum.Iktatva;
iktatottDokumentum.ElektronikusPeldanyFeltoltesDatuma = DateTime.Now;
iktatottDokumentum.FailedJobId = null;
iktatottDokumentum.EnqueuedJobId = null;
var nyomtatvanyokDal = h.NyomtatvanyokDal();
var dokumentum = nyomtatvanyokDal.Get(iktatottDokumentum.GeneraltDokumentumId.Value);
nyomtatvanyokDal.Delete(dokumentum);
iktatottDokumentum.GeneraltDokumentumId = null;
nyomtatvanyokDal.Update(iktatottDokumentum);
});
}
public static void WriteFailedJobId(string jobId)
{
var jobDetails = Hangfire.JobStorage.Current.GetMonitoringApi().JobDetails(jobId);
var iktatottDokumentumId = (int)jobDetails.Job.Args[0];
var intezmenyAzonosito = (string)jobDetails.Job.Args[1];
var intezmenyId = (int)jobDetails.Job.Args[2];
var tanevId = (int)jobDetails.Job.Args[3];
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var iktatottDokumentum = h.IktatottDokumentumDal().Get(iktatottDokumentumId);
iktatottDokumentum.FailedJobId = int.Parse(jobId);
iktatottDokumentum.DokumentumStatusz = (int)Enums.DokumentumStatuszEnum.Hibas;
iktatottDokumentum.ElektronikusPeldanyFeltoltesDatuma = DateTime.Now;
var dal = h.NyomtatvanyokDal();
dal.Update(iktatottDokumentum);
});
}
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace Kreta.Job.Tasks.Helpers
{
public static class Constants
{
public static class Iktatas
{
public const string IrattargyfajtaNev = "KRÉTA iratfajták";
}
}
}
@@ -0,0 +1,103 @@
using System;
using System.Data;
using System.Linq;
using System.Xml;
using Hangfire;
using Kreta.Core;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.Interfaces;
using Kreta.Framework;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Core.Models;
using Kreta.Resources;
namespace Kreta.Job.Tasks.Helpers.Email
{
internal static class KozelgoFogadooraMailHelper
{
internal static void SendKozelgoFogadooraMail(string connectionString)
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var fogadooraDal = h.Fogadoora();
try
{
var kozelgoFogadoorak = fogadooraDal.GetKozelgoFogadoorak().Tables[0].AsEnumerable().Select(f => new
{
FogadooraKezdete = f.Field<DateTime>("FogadooraKezdete"),
FogadooraVege = f.Field<DateTime>("FogadooraVege"),
NyomtatasiNev = f.Field<string>("NyomtatasiNev"),
EmailCim = f.Field<string>("EmailCim"),
EmailGuid = f.Field<Guid?>("EmailGuid"),
TeremNev = f.Field<string>("TeremNev"),
IntezmenyNev = f.Field<string>("IntezmenyNev"),
IntezmenyCim = f.Field<string>("IntezmenyCim"),
IntezmenyFenntartoEmail = f.Field<string>("IntezmenyFenntartoEmail"),
IntezmenyUrl = string.Format(CommonResource.IntezmenyUrl, f.Field<string>("IntezmenyAzon")),
IntezmenyAzon = f.Field<string>("IntezmenyAzon"),
UserId = f.Field<int>("UserId"),
OsztalyCsoportNev = f.Field<string>("OsztalyCsoportNev")
});
foreach (var kozelgoFogadoora in kozelgoFogadoorak.Where(f => f.EmailCim.IsValidEmail()))
{
if (GetProfileData(h, kozelgoFogadoora.UserId, "FogadooraEmlekeztetoEmailJelentkezes"))
{
var datum = kozelgoFogadoora.FogadooraKezdete.ToString(Kreta.Core.Constants.ToStringPattern.HungarianDate);
var idopont = string.Format("{0} - {1}",
kozelgoFogadoora.FogadooraKezdete.ToString(Kreta.Core.Constants.ToStringPattern.HungarianDateTimeWithoutSeconds),
kozelgoFogadoora.FogadooraVege.ToString(Kreta.Core.Constants.ToStringPattern.HungarianDateTimeWithoutSeconds));
var subject = string.Format(EmailResource.KozelgoFogadooraTargy, datum, kozelgoFogadoora.OsztalyCsoportNev, kozelgoFogadoora.NyomtatasiNev);
var message = string.Format(EmailResource.KozelgoFogadooraTartalom,
kozelgoFogadoora.NyomtatasiNev,
idopont,
kozelgoFogadoora.TeremNev,
kozelgoFogadoora.NyomtatasiNev,
kozelgoFogadoora.IntezmenyUrl,
kozelgoFogadoora.IntezmenyNev,
kozelgoFogadoora.IntezmenyCim,
kozelgoFogadoora.OsztalyCsoportNev
);
var emailModel = new EmailModel(kozelgoFogadoora.IntezmenyAzon, kozelgoFogadoora.EmailGuid)
{
TargetEmail = kozelgoFogadoora.EmailCim,
Subject = subject,
Message = message
+ string.Format(CommonResource.TevesCimzett, kozelgoFogadoora.IntezmenyFenntartoEmail)
+ Environment.NewLine
+ string.Format(CommonResource.IntezmenyNevEsUrlLink, kozelgoFogadoora.IntezmenyNev, kozelgoFogadoora.IntezmenyUrl)
};
BackgroundJob.Enqueue<IEmailJob>((email) => email.SendMailAsync(emailModel));
}
}
}
catch (Exception ex)
{
SDAServer.Instance.Logger.ExceptionThrown(ex);
}
});
}
private static bool GetProfileData(IDalHandler h, int felhasznaloId, string profileTipus)
{
var dal = h.Fogadoora(null);
var profileXml = dal.GetProfileData(felhasznaloId);
if (string.IsNullOrWhiteSpace(profileXml))
{
return true;
}
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(profileXml);
XmlNode node = xDoc.SelectSingleNode("UserProfile/" + profileTipus);
if (node == null)
return true;
return (bool.TryParse(node.InnerText, out bool result)) && result;
}
}
}
@@ -0,0 +1,53 @@
using System;
using System.Data;
using Hangfire;
using Kreta.Core;
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Core.Models;
using Kreta.Resources;
namespace Kreta.Job.Tasks.Helpers.Email
{
internal static class NemNaplozottTanorakEmailHelper
{
internal static void SendNemNaplozottTanorakMail(string connectionString)
{
Dal.ServiceSystemConnection.Run(connectionString, (h) =>
{
var tanarokNemNaplozottOrarendiOrakDataRows = h.OrarendiOra().GetTanarokNemNaplozottOrarendiOrakHetiEmailErtesito().Tables[0].Rows;
string kuldesNapja = DateTime.Now.Date.ToString("yyyy.MM.dd");
foreach (DataRow dr in tanarokNemNaplozottOrarendiOrakDataRows)
{
string tanarNev = dr["NyomtatasiNev"].ToString();
string tanarEmailCim = dr["Email"].ToString();
Guid tanarEmailGuid = (Guid)dr["EmailGuid"];
string intezmenyAzonosito = dr["IntezmenyAzonosito"].ToString();
string intezmenyNev = dr["IntezmenyNev"].ToString();
string intezmenyEmailCim = dr["IntezmenyEmailCim"].ToString();
int osszesNemNaplozottOra = int.Parse(dr["OsszesNemNaplozottTanorak"].ToString());
int multHetenNemNaplozottHelyettesitesek = int.Parse(dr["MultHetenNemNaplozottHelyettesitesek"].ToString());
int multHetenNemNaplozottTanorak = int.Parse(dr["MultHetenNemNaplozottTanorak"].ToString());
if (!string.IsNullOrWhiteSpace(tanarEmailCim) && tanarEmailCim.IsValidEmail())
{
var emailModel = new EmailModel(intezmenyAzonosito, tanarEmailGuid)
{
Message = string.Format(EmailResource.NemNaplozottTanorakEmailTartalom, tanarNev, intezmenyNev, string.Format(CommonResource.IntezmenyUrl, intezmenyAzonosito), multHetenNemNaplozottTanorak, multHetenNemNaplozottHelyettesitesek, osszesNemNaplozottOra)
+ string.Format(CommonResource.TevesCimzett, intezmenyEmailCim)
+ Environment.NewLine
+ string.Format(CommonResource.IntezmenyNevEsUrlLink, intezmenyNev, intezmenyAzonosito),
Subject = $"{EmailResource.NemNaplozottTanorakEmailTargy} {kuldesNapja}",
TargetEmail = tanarEmailCim
};
BackgroundJob.Enqueue<IEmailJob>((email) => email.SendMailAsync(emailModel));
}
}
});
}
}
}
@@ -0,0 +1,7 @@
namespace Kreta.Job.Tasks.Helpers.Iktatas
{
public class AlszamosIktatasData : FoszamosIktatasData
{
public int Foszam { get; set; }
}
}
@@ -0,0 +1,11 @@
namespace Kreta.Job.Tasks.Helpers.Iktatas
{
public class FeltoltesUjVerzioData
{
public string PoszeidonAzonosito { get; set; }
public string DokumentumNev { get; set; }
public string DokumentumTipus { get; set; }
public byte[] Tartalom { get; set; }
public string ElektronikusPeldanyId { get; set; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
namespace Kreta.Job.Tasks.Helpers.Iktatas
{
[Serializable]
public class FoszamosIktatasData
{
public string PoszeidonAzonosito { get; set; }
public string Targy { get; set; }
public Dictionary<string, string> Kulcsszavak { get; set; }
public string DokumentumNev { get; set; }
public string DokumentumTipus { get; set; }
public byte[] Tartalom { get; set; }
public int IktatoId { get; set; }
public int PartnerId { get; set; }
public string ParentJobId { get; set; }
}
}
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
namespace Kreta.Job.Tasks.Helpers.Iktatas
{
public class WordIktatoszamVonalkodTextReplacer : Aspose.Words.Replacing.IReplacingCallback
{
public List<Aspose.Words.Run> nodes = new List<Aspose.Words.Run>();
Aspose.Words.Replacing.ReplaceAction Aspose.Words.Replacing.IReplacingCallback.Replacing(Aspose.Words.Replacing.ReplacingArgs e)
{
// This is a Run node that contains either the beginning or the complete match.
Aspose.Words.Node currentNode = e.MatchNode;
// The first (and may be the only) run can contain text before the match,
// in this case it is necessary to split the run.
if (e.MatchOffset > 0)
currentNode = SplitRun((Aspose.Words.Run)currentNode, e.MatchOffset);
System.Collections.ArrayList runs = new System.Collections.ArrayList();
// Find all runs that contain parts of the match string.
int remainingLength = e.Match.Value.Length;
while (
(remainingLength > 0) &&
(currentNode != null) &&
(currentNode.GetText().Length <= remainingLength))
{
runs.Add(currentNode);
remainingLength -= currentNode.GetText().Length;
// Select the next Run node.
// Have to loop because there could be other nodes such as BookmarkStart etc.
do
{
currentNode = currentNode.NextSibling;
}
while ((currentNode != null) && (currentNode.NodeType != Aspose.Words.NodeType.Run));
}
// Split the last run that contains the match if there is any text left.
if ((currentNode != null) && (remainingLength > 0))
{
SplitRun((Aspose.Words.Run)currentNode, remainingLength);
runs.Add(currentNode);
}
String runText = "";
foreach (Aspose.Words.Run run in runs)
runText += run.Text;
((Aspose.Words.Run)runs[0]).Text = runText;
for (int i = 1; i < runs.Count; i++)
{
((Aspose.Words.Run)runs[i]).Remove();
}
((Aspose.Words.Run)runs[0]).Font.Color = System.Drawing.Color.Black;
if (e.Match.Value == "{vonalkod}")
{
((Aspose.Words.Run)runs[0]).Font.Name = "Code 128";
}
nodes.Add((Aspose.Words.Run)runs[0]);
return Aspose.Words.Replacing.ReplaceAction.Replace;
}
private static Aspose.Words.Run SplitRun(Aspose.Words.Run run, int position)
{
Aspose.Words.Run afterRun = (Aspose.Words.Run)run.Clone(true);
afterRun.Text = run.Text.Substring(position);
run.Text = run.Text.Substring(0, position);
run.ParentNode.InsertAfter(afterRun, run);
return afterRun;
}
}
}
@@ -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);
}
});
}
}
}
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Kreta.Core;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
using Kreta.DataAccessManual;
using Kreta.Enums;
using Kreta.Job.Tasks.Entities;
using Kreta.MessageBroker.Client.MobileNotification;
using Kreta.Resources;
using Newtonsoft.Json;
using Serilog;
using Serilog.Core.Enrichers;
namespace Kreta.Job.Tasks.Helpers.Notification
{
internal static class ErtekelesNotificationHelper
{
internal static void SendErtekelesNotification(string connectionString)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
try
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var ertekelesDal = h.TanuloErtekelesDal();
var ertekelesek = ertekelesDal.GetAllSchemaErtekelesNotification(DateTime.Now);
List<IdWithData> ertekelesList = new List<IdWithData>();
foreach (DataRow row in ertekelesek.Tables[0].Rows)
{
if (!int.TryParse(row["ID"] == DBNull.Value ? string.Empty : row["ID"].ToString(), out int ertekelesId))
{ continue; }
ertekelesList.Add(new IdWithData(ertekelesId, row));
}
if (ertekelesList.Count > 0)
{
ertekelesDal.SetErtekelesAsKikuldott(ertekelesList.Select(x => x.Id).Distinct());
var mobileNotificationMessages = new List<MobileNotificationMessage>();
ertekelesList.ForEach(item => ProcessErtekelesNotification(item.Data, item.Id, mobileNotificationMessages));
if (mobileNotificationMessages.Count > 0)
{
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages.ToArray());
}
}
});
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
}
private static void ProcessErtekelesNotification(DataRow row, int ertekelesId, List<MobileNotificationMessage> mobileNotificationMessages)
{
if (!int.TryParse(row["TanuloId"] == DBNull.Value ? string.Empty : row["TanuloId"].ToString(), out int tanuloId))
{ return; }
Guid.TryParse(row["IdpUniqueId"] == DBNull.Value ? string.Empty : row["IdpUniqueId"].ToString(), out Guid idpUniqueId);
int.TryParse(row["ErtekelesOsztalyzatId"] == DBNull.Value ? string.Empty : row["ErtekelesOsztalyzatId"].ToString(), out int ertekelesOsztalyzatId);
var ertekelesSzazalek = row["ErtekelesSzazalek"] == DBNull.Value ? null : row["ErtekelesSzazalek"].ToString();
var osztalyzatSzoveg = row["Osztalyzat"] == DBNull.Value ? string.Empty : row["Osztalyzat"].ToString();
var ertekelesSzoveg = row["ErtekelesSzoveg"] == DBNull.Value ? string.Empty : row["ErtekelesSzoveg"].ToString();
var instituteCode = row["IntezmenyAzonosito"] == DBNull.Value ? string.Empty : row["IntezmenyAzonosito"].ToString();
var tanuloNev = row["TanuloNev"] == DBNull.Value ? string.Empty : row["TanuloNev"].ToString();
var tantargyNev = row["TantargyNev"] == DBNull.Value ? string.Empty : row["TantargyNev"].ToString();
var ertekelesTipusId = row["ErtekelesTipusId"];
var ertekelesTipus = Enum.GetName(typeof(ErtekelesTipusEnum), ertekelesTipusId);
var data = new { ErtekelesTipus = ertekelesTipus };
var message = CreateErtekelesMessage(tanuloNev, tantargyNev, ertekelesOsztalyzatId, ertekelesSzazalek, ertekelesSzoveg, osztalyzatSzoveg);
if (string.IsNullOrWhiteSpace(message))
{ return; }
mobileNotificationMessages.Add(MobileNotificationMessageHelper.CreateMessage(instituteCode, tanuloId, MobileNotificationMessageType.Evaluation, ertekelesId, message, NotificationResource.ErtekelesTitle, JsonConvert.SerializeObject(data)));
}
private static string CreateErtekelesMessage(string tanuloNev, string tantargyNev, int ertekelesOsztalyzatId, string ertekelesSzazalek, string ertekelesSzoveg, string osztalyzatSzoveg)
{
if (ertekelesOsztalyzatId.IsEntityId())
{
return string.Format(NotificationResource.ErdemjegyErtekelesNotificationMessage, tanuloNev, osztalyzatSzoveg, tantargyNev);
}
if (!string.IsNullOrWhiteSpace(ertekelesSzoveg))
{
return string.Format(NotificationResource.SzovegesErtekelesNotificationMessage, tanuloNev, tantargyNev);
}
if (!string.IsNullOrWhiteSpace(ertekelesSzazalek))
{
return string.Format(NotificationResource.SzazalekosErtekelesNotificationMessage, tanuloNev, ertekelesSzazalek, tantargyNev);
}
return string.Empty;
}
}
}
@@ -0,0 +1,49 @@
using System;
using System.Data;
using System.Linq;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
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 FeljegyzesNotificationHelper
{
/// INFO @DevKornel: Mobil használja
internal static void SendFeljegyzesNotification(string connectionString)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var dal = h.Feljegyzes();
try
{
var entities = dal.GetAllSchemaFeljegyzesNotification();
dal.SetFeljegyzesAsKikuldott(entities.Select(x => x.FeljegyzesId).Distinct());
MobileNotificationMessage[] mobileNotificationMessages = entities.Select(entity => MobileNotificationMessageHelper.CreateMessage(
entity.IntezmenyAzonosito,
entity.TanuloId,
MobileNotificationMessageType.Note,
entity.FeljegyzesId,
string.Format(NotificationResource.FeljegyzesNotificationMessage, entity.TanuloNev, entity.TipusId.GetItemNameFromCache(entity.TanevId, entity.IntezmenyAzonosito)),
NotificationResource.FeljegyzesTitle)).ToArray();
if (mobileNotificationMessages.Length > 0)
{
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages);
}
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
});
}
}
}
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.Interfaces;
using Kreta.Enums.ManualEnums;
using Kreta.Job.Tasks.Entities;
using Kreta.Job.Tasks.Helpers.Utility;
using Kreta.MessageBroker.Client.MobileNotification;
using Kreta.Resources;
using Newtonsoft.Json;
using Serilog;
using Serilog.Core.Enrichers;
namespace Kreta.Job.Tasks.Helpers.Notification
{
internal static class HazifeladatNotificationHelper
{
internal static void SendHazifeladatNotification(string connectionString)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
try
{
logger.Information("SendHazifeladatNotification:Start");
Dal.ServiceSystemConnection.Run(connectionString, dalHandler =>
{
IDKT_FeladatDal dktFeladatDal = dalHandler.DKT_FeladatDal();
DataSet hazifeladatok = dktFeladatDal.GetAllSchemaHazifeladatNotification();
logger.Information("GetAllSchemaHazifeladatNotification");
var hazifeladatList = new List<IdWithData>();
foreach (DataRow row in hazifeladatok.Tables[0].Rows)
{
if (int.TryParse(row["ID"] == DBNull.Value ? string.Empty : row["ID"].ToString(), out int hazifeladatId))
{
hazifeladatList.Add(new IdWithData(hazifeladatId, row));
}
}
if (hazifeladatList.Count > 0)
{
dktFeladatDal.SetHazifeladatAsKikuldott(hazifeladatList.Select(x => x.Id).Distinct().ToList());
logger.Information("SetHazifeladatAsKikuldott");
var mobileNotificationMessages = new List<MobileNotificationMessage>();
hazifeladatList.ForEach(item => ProcessHazifeladatNotification(item.Data, item.Id, mobileNotificationMessages));
logger.Information($"ProcessHazifeladatNotification count: {mobileNotificationMessages.Count}");
if (mobileNotificationMessages.Count > 0)
{
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages.ToArray());
logger.Information($"Hazifeladat PostStudentNotification");
}
}
});
logger.Information("SendHazifeladatNotification:End");
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
}
private static void ProcessHazifeladatNotification(DataRow row, int hazifeladatId, List<MobileNotificationMessage> mobileNotificationMessages)
{
if (int.TryParse(row["TanuloId"] == DBNull.Value ? string.Empty : row["TanuloId"].ToString(), out int tanuloId))
{
Guid.TryParse(row["IdpUniqueId"] == DBNull.Value ? string.Empty : row["IdpUniqueId"].ToString(), out Guid idpUniqueId);
string instituteCode = row["IntezmenyAzonosito"] == DBNull.Value ? string.Empty : row["IntezmenyAzonosito"].ToString();
string tanuloNev = row["TanuloNev"] == DBNull.Value ? string.Empty : row["TanuloNev"].ToString();
string tantargyNev = row["TantargyNev"] == DBNull.Value ? string.Empty : row["TantargyNev"].ToString();
int feladatTipusId = Convert.ToInt32(row["FeladatTipusId"]);
int? xeropanBundleId = row["XeropanBundleId"] == DBNull.Value ? (int?)null : Convert.ToInt32(row["XeropanBundleId"]);
DateTime feladatDatum = Convert.ToDateTime(row["Datum"]);
string hetNapja = Extensions.GetHetnapja(feladatDatum, Convert.ToInt32(row["TanevId"]), instituteCode);
int? oraSzam = row["OraSzam"] == DBNull.Value ? (int?)null : Convert.ToInt32(row["OraSzam"]);
string idopont = oraSzam.HasValue ? $"{hetNapja} {oraSzam}. óra időpontra" : $"{hetNapja}i napra";
var dataObject = new { FeladatTipusId = feladatTipusId, FeladatDatum = feladatDatum.ToIso8601UtcString() };
// Azért szükséges ez a rész, mert ha egy napot a tanév rendjében tanítási napnak jelölök, akkor utána az órát
// beteszi a t_orarendiora táblába ugyan azokkal az adatokkal csak más id-val hetirend-el érvényesség kezdetével végével,
// ez viszont valid működés és az is, hogy lehet tenni tanítási napot mondjuk nem hétvégére, ennek kiküszöbölésére, hogy ne küldjön duplán push-t került ide ez a módosítás.
if (!mobileNotificationMessages.Any(m => m.ItemId == hazifeladatId && m.UserId == tanuloId) &&
(feladatTipusId != (int)FeladatTipusEnum.NyelviFeladat || feladatTipusId == (int)FeladatTipusEnum.NyelviFeladat && xeropanBundleId.HasValue))
{
mobileNotificationMessages.Add(MobileNotificationMessageHelper.CreateMessage(
instituteCode,
tanuloId,
MobileNotificationMessageType.Homework,
hazifeladatId,
string.Format(NotificationResource.HaziFeladatNotificationMessage, tanuloNev, tantargyNev, feladatDatum.ToString("yyyy.MM.dd."), idopont),
NotificationResource.HaziFeladatTitle,
data: JsonConvert.SerializeObject(dataObject)));
}
}
}
}
}
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Helpers.Utility;
using Kreta.MessageBroker.Client.MobileNotification;
using Kreta.Resources;
using Serilog;
using Serilog.Core.Enrichers;
namespace Kreta.Job.Tasks.Helpers.Notification
{
internal static class MulasztasNotificationHelper
{
/// INFO @DevKornel: Mobil használja
internal static void SendMulasztasNotification(string connectionString)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
try
{
logger.Information($"SendMulasztasNotification:Start");
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var dal = h.MulasztasDal();
var entities = dal.GetAllSchemaMulasztasNotification();
logger.Information($"GetAllSchemaMulasztasNotification");
dal.SetMulasztasAsKikuldott(entities.Select(x => x.MulasztasId).Distinct());
List<MobileNotificationMessage> mobileNotificationMessagesList = new List<MobileNotificationMessage>();
MobileNotificationMessage[] mobileNotificationMessages = entities.Select(entity => MobileNotificationMessageHelper.CreateMessage(
entity.IntezmenyAzonosito,
entity.TanuloId,
MobileNotificationMessageType.Absence,
entity.MulasztasId,
string.Format(NotificationResource.MulasztasNotificationMessage, entity.TanuloNev, entity.TantargyNev, entity.MulasztasDatuma.ToString("yyyy.MM.dd."), Extensions.GetHetnapja(entity.MulasztasDatuma, entity.TanevId, entity.IntezmenyAzonosito), entity.OraSorszama.HasValue ? " " + entity.OraSorszama.Value + ". óra időpontra" : "i napra"),
NotificationResource.MulasztasTitle)
).ToArray();
logger.Information($"Mulasztas CreateMessage count: {mobileNotificationMessages.Length}");
if (mobileNotificationMessages.Length > 0)
{
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages);
logger.Information($"Mulasztas PostStudentNotification");
}
});
logger.Information("SendMulasztasNotification:End");
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
}
}
}
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Hangfire.Server;
using Kreta.BusinessLogic.Helpers.Models;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
using Kreta.Job.Tasks.Cache;
using Kreta.Job.Tasks.Helpers.Utility;
using Kreta.MessageBroker.Client.MobileNotification;
using Kreta.Resources;
using Serilog;
using Serilog.Core.Enrichers;
namespace Kreta.Job.Tasks.Helpers.Notification
{
internal static class OrarendValtozasNotificationHelper
{
internal static void SendOrarendValtozasNotification(PerformContext context)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
try
{
var userIds = new List<int>();
foreach (var intezmenyAzonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
OrarendValtozasCache orarendValtozasCache = KretaServer.KretaServer.Instance.CacheManager.AquireCacheMobile<OrarendValtozasCache>();
if (orarendValtozasCache != null)
{
var orarendValtozasok = orarendValtozasCache.GetOrarendValtozasok(intezmenyAzonosito);
var kikuldendoOrarendValtozasok = GetKikuldendoOrarendValtozasok(orarendValtozasok);
var mobileNotificationMessages = new List<MobileNotificationMessage>();
foreach (var orarendValtozas in kikuldendoOrarendValtozasok)
{
mobileNotificationMessages.Add(MobileNotificationMessageHelper.CreateMessage(
orarendValtozas.IntezmenyAzonosito,
orarendValtozas.UserId,
MobileNotificationMessageType.OrarendValtozas,
orarendValtozas.OrarendiOraId,
orarendValtozas.Uzenet,
NotificationResource.OrarendValtozasTitle,
orarendValtozas.Datum.ToIso8601UtcString()));
userIds.Add(orarendValtozas.UserId);
}
if (mobileNotificationMessages.Any())
{
orarendValtozasCache.RemoveOrarendValtozasok(intezmenyAzonosito);
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages.ToArray());
}
}
}
context.SetJobParameter("UserIds", userIds);
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
}
private static List<OrarendValtozasModel> GetKikuldendoOrarendValtozasok(List<OrarendValtozasModel> orarendValtozasok)
{
var kikuldendoOrarendValtozasok = new List<OrarendValtozasModel>();
var userIdGroupedOrarendValtozasok = orarendValtozasok.GroupBy(x => x.UserId).Select(x => new
{
Key = x.Key,
OrarendValtozasok = x.OrderBy(c => c.Datum)
});
foreach (var orarendValtozas in userIdGroupedOrarendValtozasok)
{
var legkorabbi = orarendValtozas.OrarendValtozasok.First();
var napok = string.Concat(string.Join("i, ", orarendValtozas.OrarendValtozasok.Select(n => n.Nap).Distinct()), "i ");
kikuldendoOrarendValtozasok.Add(new OrarendValtozasModel
{
IntezmenyAzonosito = legkorabbi.IntezmenyAzonosito,
UserId = legkorabbi.UserId,
IdpUniqueId = legkorabbi.IdpUniqueId,
UserNev = legkorabbi.UserNev,
OrarendiOraId = legkorabbi.OrarendiOraId,
Uzenet = string.Format(NotificationResource.OrarendValtozasNotificationMessage, legkorabbi.UserNev, napok),
Datum = legkorabbi.Datum
});
}
return kikuldendoOrarendValtozasok;
}
}
}
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Kreta.Core.MessageBroker.Contract.MobileNotification;
using Kreta.Core.MessageBroker.Contract.MobileNotification.Enum;
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Entities;
using Kreta.MessageBroker.Client.MobileNotification;
using Kreta.Resources;
using Serilog;
using Serilog.Core.Enrichers;
namespace Kreta.Job.Tasks.Helpers.Notification
{
internal static class RendszeruzenetNotificationHelper
{
internal static void SendRendszeruzenetNotification(string connectionString)
{
var logger = Log.ForContext(new PropertyEnricher[] { new PropertyEnricher("LoggerId", Guid.NewGuid()) });
try
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var feljegyzesDal = h.Feljegyzes();
var feljegyzesek = feljegyzesDal.GetAllSchemaRendszeruzenetFeljegyzesNotification();
List<IdWithData> feljegyzesList = new List<IdWithData>();
foreach (DataRow row in feljegyzesek.Tables[0].Rows)
{
if (!int.TryParse(row["ID"] == DBNull.Value ? string.Empty : row["ID"].ToString(), out int feljegyzesId))
{ continue; }
feljegyzesList.Add(new IdWithData(feljegyzesId, row));
}
if (feljegyzesList.Count > 0)
{
feljegyzesDal.SetFeljegyzesAsKikuldott(feljegyzesList.Select(x => x.Id).Distinct());
var mobileNotificationMessages = new List<MobileNotificationMessage>();
feljegyzesList.ForEach(item => ProcessRendszeruzenetNotification(item.Data, item.Id, mobileNotificationMessages));
if (mobileNotificationMessages.Count > 0)
{
MobileNotificationMessageHelper.PostStudentNotification(mobileNotificationMessages.ToArray());
}
}
});
}
catch (Exception ex)
{
logger.Fatal(ex, ex.GetType().FullName);
}
}
internal static void ProcessRendszeruzenetNotification(DataRow row, int feljegyzesId, List<MobileNotificationMessage> mobileNotificationMessages)
{
if (!int.TryParse(row["TanuloId"] == DBNull.Value ? string.Empty : row["TanuloId"].ToString(), out int tanuloId)) { return; }
Guid.TryParse(row["IdpUniqueId"] == DBNull.Value ? string.Empty : row["IdpUniqueId"].ToString(), out Guid idpUniqueId);
var instituteCode = row["IntezmenyAzonosito"] == DBNull.Value ? string.Empty : row["IntezmenyAzonosito"].ToString();
var message = row["UzenetTargy"] == DBNull.Value ? string.Empty : row["UzenetTargy"].ToString();
if (string.IsNullOrWhiteSpace(message))
{ return; }
mobileNotificationMessages.Add(MobileNotificationMessageHelper.CreateMessage(
instituteCode,
tanuloId,
MobileNotificationMessageType.Note,
feljegyzesId,
message,
NotificationResource.RendszeruzenetTitle));
}
}
}
@@ -0,0 +1,55 @@
using System;
using System.Globalization;
using Kreta.Enums;
using Kreta.Framework.Util;
namespace Kreta.Job.Tasks.Helpers.Utility
{
public static class Extensions
{
/// UTC: 2016-10-30T20:00:00Z
/// Local: 2016-10-30T23:00:00+01:00
/// Unspecified: 2016-10-30T22:00:00
public static DateTime ToIso8601Utc(this DateTime dt)
=> new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Kind).ToUniversalTime();
/// UTC: 2016-10-30T20:00:00Z
/// Local: 2016-10-30T23:00:00+01:00
/// Unspecified: 2016-10-30T22:00:00
public static string ToIso8601UtcString(this DateTime dt)
=> dt.ToIso8601Utc().ToString("yyyy-MM-dd'T'HH:mm:ssK", CultureInfo.InvariantCulture);
public static string GetHetnapja(DateTime date, int tanevId, string intezmenyAzonosito)
=> GetHetNapja(date).GetItemNameFromCache(tanevId, intezmenyAzonosito).ToLower();
private static int GetHetNapja(DateTime date)
{
HetNapjaTipusEnum hetNapja = HetNapjaTipusEnum.na;
switch (date.DayOfWeek)
{
case DayOfWeek.Monday:
hetNapja = HetNapjaTipusEnum.Hetfo;
break;
case DayOfWeek.Tuesday:
hetNapja = HetNapjaTipusEnum.Kedd;
break;
case DayOfWeek.Wednesday:
hetNapja = HetNapjaTipusEnum.Szerda;
break;
case DayOfWeek.Thursday:
hetNapja = HetNapjaTipusEnum.Csutortok;
break;
case DayOfWeek.Friday:
hetNapja = HetNapjaTipusEnum.Pentek;
break;
case DayOfWeek.Saturday:
hetNapja = HetNapjaTipusEnum.Szombat;
break;
case DayOfWeek.Sunday:
hetNapja = HetNapjaTipusEnum.Vasarnap;
break;
}
return (int)hetNapja;
}
}
}
+419
View File
@@ -0,0 +1,419 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Reflection;
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
using Kreta.Core.Iktato.Poszeidon.Infrastructure.Interface;
using Kreta.DataAccess.Interfaces;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.Interfaces;
using Kreta.Enums;
using Kreta.Framework;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Helpers;
using Kreta.Job.Tasks.Helpers.Iktatas;
namespace Kreta.Job.Tasks
{
public class IktatasJob : IktatasJobBase, IIktatasJob
{
public IktatasJob(IIktatoRepositoryFactory iktatoRepositoryFactory, IWcfServiceContext wcfServiceContext, Kreta.Core.IktatoServiceConfiguration iktatoServiceConfiguration) : base(iktatoRepositoryFactory, wcfServiceContext, iktatoServiceConfiguration)
{
}
[Hangfire.AutomaticRetry(Attempts = 2)]
[JobStateWatcher(typeof(IktatasJob), nameof(WriteFailedJobId))]
public void FoszamosIktatasDal(int iktatottDokumentumId, int iktatoId, int partnerId, string intezmenyAzonosito, int intezmenyId, int tanevId, Hangfire.Server.PerformContext context)
{
var jobId = context.BackgroundJob.Id;
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var intezmenyDal = h.IntezmenyDal();
var intezmeny = intezmenyDal.Get(intezmenyId);
var tanevDal = h.TanevDal();
var tanev = tanevDal.Get(tanevId);
var iktatottDokumentumDal = h.IktatottDokumentumDal();
var iktatottDokumentum = iktatottDokumentumDal.Get(iktatottDokumentumId);
var iktato = iktatottDokumentum.IktatoSzemely;
var kulcsszavak = GetDokumentumKulcsszavak(h, iktatottDokumentumId, intezmenyId, tanevId, tanev.Nev, iktato.NyomtatasiNev);
string iratfajtaNev = GetIratfajtaNev(iktatottDokumentum);
var irattariTetelszam = h.AdatszotarDAL().GetAdatszotarById(iktatottDokumentum.DokumentumTipus, iktatottDokumentum.IntezmenyId, iktatottDokumentum.TanevId).Tables[0].Rows[0]["Code"].ToString();
var iratRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.IratRequest()
{
Iratfajta = Constants.Iktatas.IrattargyfajtaNev,
Irattargyfajta = iratfajtaNev,
Targy = iktatottDokumentum.DokumentumNeve,
IrattariTetelszam = irattariTetelszam + "."
};
var elektronikusPeldanyRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.ElektronikusPeldanyRequest()
{
BirtokloSzervezetKod = intezmeny.IktatoSzervezetAzonosito
};
Kreta.Core.Iktato.Poszeidon.Domain.Model.FoszamosIktatasRequest foszamosIktatasRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.FoszamosIktatasRequest()
{
IktatoSzervezetKod = intezmeny.IktatoSzervezetAzonosito,
Kulcsszavak = kulcsszavak,
IratRequest = iratRequest,
ElektronikusPeldanyRequest = elektronikusPeldanyRequest
};
var iktatoRepositoryConfiguration = GetIktatoRepositoryConfiguration(intezmeny.IktatoSzervezetAzonosito, intezmeny.PoszeidonBejelentkezesiNev);
var iktatasResponse = IktatoRepositoryFactory.GetIktatoRepository(iktatoRepositoryConfiguration).FoszamosIktatas(foszamosIktatasRequest);
iktatottDokumentum.IsFoszamos = true;
iktatottDokumentum.DokumentumStatusz = (int)DokumentumStatuszEnum.IktatasraVar;
iktatottDokumentum.ElektronikusPeldanyId = Convert.ToInt32(iktatasResponse.ElektronikusPeldanyId);
iktatottDokumentum.IktatasDatuma = DateTime.Now;
iktatottDokumentum.Iktatoszam = iktatasResponse.Iktatoszam;
iktatottDokumentum.Vonalkod = iktatasResponse.Iktatoszam;
iktatottDokumentum.FailedJobId = null;
iktatottDokumentum.IratId = iktatasResponse.IratId;
iktatottDokumentum.UgyiratId = iktatottDokumentum.UgyiratId;
#region Iktatoszám és vonalkód kitöltése
//string formatum = iktatottDokumentum.DokumentumTartalomTipus;
IDokumentum generaltDokumentum = IktatoszamVonalkodKitoltes(h, Path.GetExtension(iktatottDokumentum.FajlNev), iktatottDokumentum.GeneraltDokumentumId.Value, iktatottDokumentum.Iktatoszam, iktatottDokumentum.DokumentumTipus);
#endregion
var nyomtatvanyokDal = h.NyomtatvanyokDal();
nyomtatvanyokDal.FullUpdate(generaltDokumentum);
nyomtatvanyokDal.FullUpdate(iktatottDokumentum);
string id = Hangfire.BackgroundJob.ContinueWith<FeltoltesJob>(jobId, (iktatas) => iktatas.FeltoltesUjVerzioDal(iktatottDokumentumId, intezmenyAzonosito, intezmenyId, tanevId));
});
}
[Hangfire.AutomaticRetry(Attempts = 2)]
[JobStateWatcher(typeof(IktatasJob), nameof(WriteFailedJobId))]
public void AlszamosIktatasDal(int iktatottDokumentumId, int parentDokumentumId, int iktatoId, int partnerId, string intezmenyAzonosito, int intezmenyId, int tanevId, Hangfire.Server.PerformContext context)
{
var jobId = context.BackgroundJob.Id;
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var intezmenyDal = h.IntezmenyDal();
var intezmeny = intezmenyDal.Get(intezmenyId);
var tanevDal = h.TanevDal();
var tanev = tanevDal.Get(tanevId);
var iktatottDokumentumDal = h.IktatottDokumentumDal();
var iktatottDokumentum = iktatottDokumentumDal.Get(iktatottDokumentumId);
var parentIktatottDokumentum = iktatottDokumentumDal.Get(parentDokumentumId);
var iktato = iktatottDokumentum.IktatoSzemely;
var kulcsszavak = GetDokumentumKulcsszavak(h, iktatottDokumentumId, intezmenyId, tanevId, tanev.Nev, iktato.NyomtatasiNev);
var foszam = GetFoszam(parentIktatottDokumentum.Iktatoszam);
string iratfajtaNev = GetIratfajtaNev(iktatottDokumentum);
var irattariTetelszam = h.AdatszotarDAL().GetAdatszotarById(iktatottDokumentum.DokumentumTipus, iktatottDokumentum.IntezmenyId, iktatottDokumentum.TanevId).Tables[0].Rows[0]["Code"].ToString();
var iratRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.IratRequest()
{
Iratfajta = Constants.Iktatas.IrattargyfajtaNev,
Irattargyfajta = iratfajtaNev,
Targy = iktatottDokumentum.DokumentumNeve,
IrattariTetelszam = irattariTetelszam + "."
};
var elektronikusPeldanyRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.ElektronikusPeldanyRequest()
{
BirtokloSzervezetKod = intezmeny.IktatoSzervezetAzonosito
};
Kreta.Core.Iktato.Poszeidon.Domain.Model.AlszamosIktatasRequest alszamosIktatasRequest = new Kreta.Core.Iktato.Poszeidon.Domain.Model.AlszamosIktatasRequest()
{
IktatoSzervezetKod = intezmeny.IktatoSzervezetAzonosito,
Kulcsszavak = kulcsszavak,
Foszam = foszam,
SzovegesIktatoszam = parentIktatottDokumentum.Iktatoszam,
IratRequest = iratRequest,
ElektronikusPeldanyRequest = elektronikusPeldanyRequest
};
var iktatoRepositoryConfiguration = GetIktatoRepositoryConfiguration(intezmeny.IktatoSzervezetAzonosito, intezmeny.PoszeidonBejelentkezesiNev);
var iktatasResponse = IktatoRepositoryFactory.GetIktatoRepository(iktatoRepositoryConfiguration).AlszamosIktatas(alszamosIktatasRequest);
iktatottDokumentum.IsFoszamos = iktatasResponse.IsFoszamos;
iktatottDokumentum.DokumentumStatusz = (int)DokumentumStatuszEnum.IktatasraVar;
iktatottDokumentum.ElektronikusPeldanyId = Convert.ToInt32(iktatasResponse.ElektronikusPeldanyId);
iktatottDokumentum.IktatasDatuma = DateTime.Now;
iktatottDokumentum.Iktatoszam = iktatasResponse.Iktatoszam;
iktatottDokumentum.Vonalkod = iktatasResponse.Iktatoszam;
iktatottDokumentum.FailedJobId = null;
iktatottDokumentum.IratId = iktatasResponse.IratId;
iktatottDokumentum.UgyiratId = iktatottDokumentum.UgyiratId;
#region Iktatoszám és vonalkód kitöltése
IDokumentum generaltDokumentum = IktatoszamVonalkodKitoltes(h, Path.GetExtension(iktatottDokumentum.FajlNev), iktatottDokumentum.GeneraltDokumentumId.Value, iktatottDokumentum.Iktatoszam, iktatottDokumentum.DokumentumTipus);
#endregion
var nyomtatvanyokDal = h.NyomtatvanyokDal();
nyomtatvanyokDal.FullUpdate(generaltDokumentum);
nyomtatvanyokDal.FullUpdate(iktatottDokumentum);
string id = Hangfire.BackgroundJob.ContinueWith<FeltoltesJob>(jobId, (iktatas) => iktatas.FeltoltesUjVerzioDal(iktatottDokumentumId, intezmenyAzonosito, intezmenyId, tanevId));
});
}
private static string GetIratfajtaNev(IIktatottDokumentum iktatottDokumentum)
{
string iratfajtaNev;
switch (iktatottDokumentum.DokumentumKategoria)
{
case (int)DokumentumKategoriaEnum.Naplok:
switch (iktatottDokumentum.DokumentumTipus)
{
case (int)DokumentumTipusEnum.Osztalynaplo:
case (int)DokumentumTipusEnum.HaladasiNaplo:
case (int)DokumentumTipusEnum.OsztalyozoNaplo:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Osztalynaplo);
break;
default:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Csoportnaplo);
break;
}
break;
case (int)DokumentumKategoriaEnum.Orarendek:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Orarend);
break;
case (int)DokumentumKategoriaEnum.Tanulok:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Tanulokkal_kapcsolatos_dokumentum);
break;
case (int)DokumentumKategoriaEnum.Pedagogusok:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Pedagogusokkal_kapcsolatos_dokumentum);
break;
case (int)DokumentumKategoriaEnum.Statisztikak:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Statisztika);
break;
case (int)DokumentumKategoriaEnum.ErtesitokTorzslapBizonyitvany:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Ertesito_tozslap_bizonyitvany);
break;
case (int)DokumentumKategoriaEnum.IgazolasokMulasztasiErtesitok:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Igazolas_mulasztasi_ertesito);
break;
case (int)DokumentumKategoriaEnum.TanugyiEllenorzes:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Tanugyi_ellenorzessel_kapcsolatos_dokumentum);
break;
case (int)DokumentumKategoriaEnum.Alapdokumentumok:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Alapdokumentum);
break;
case (int)DokumentumKategoriaEnum.szemelyzeti_ugyek:
iratfajtaNev = GetDisplayName(Enums.ManualEnums.PoszeidonIratfajtakEnum.Szemelyzeti_Ugyek);
break;
default:
throw new ApplicationException(Resources.ErrorResource.HianyzoDokumentumKategoriaPoszeidonIratfajtaOsszerendeles);
}
return iratfajtaNev;
}
public int GetFoszam(string iktatoszam)
{
string[] parts = iktatoszam.Split("/".ToCharArray());
var foszamStr = parts[parts.Length - 2].Split("-".ToCharArray())[0];
if (!int.TryParse(foszamStr, out int foszam))
{
throw new FormatException(string.Format(Resources.ErrorResource.HibasformatumuFoszam, iktatoszam));
}
return foszam;
}
public static void WriteFailedJobId(string jobId)
{
var jobDetails = Hangfire.JobStorage.Current.GetMonitoringApi().JobDetails(jobId);
var offset = 0;
if (jobDetails.Job.Method.Name == nameof(AlszamosIktatasDal))
{
offset = 1;
}
var iktatottDokumentumId = (int)jobDetails.Job.Args[0];
var intezmenyAzonosito = (string)jobDetails.Job.Args[3 + offset];
var intezmenyId = (int)jobDetails.Job.Args[4 + offset];
var tanevId = (int)jobDetails.Job.Args[5 + offset];
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var iktatottDokumentumDal = h.IktatottDokumentumDal();
var iktatottDokumentum = iktatottDokumentumDal.Get(iktatottDokumentumId);
iktatottDokumentum.FailedJobId = int.Parse(jobId);
iktatottDokumentum.DokumentumStatusz = (int)DokumentumStatuszEnum.Hibas;
iktatottDokumentum.ElektronikusPeldanyFeltoltesDatuma = DateTime.Now;
var nyomtatvanyokDal = h.NyomtatvanyokDal();
nyomtatvanyokDal.Update(iktatottDokumentum);
});
}
private static IDokumentum IktatoszamVonalkodKitoltes(IDalHandler handler, string kiterjesztes, int generaltDokumentumId, string iktatoszam, int dokumentumTipus)
{
bool isLablecben;
switch (dokumentumTipus)
{
case (int)DokumentumTipusEnum.AlapitoOkirat:
case (int)DokumentumTipusEnum.SzervezetiEsMukodesiSzabalyzat:
case (int)DokumentumTipusEnum.PedagogiaiProgram:
case (int)DokumentumTipusEnum.Hazirend:
case (int)DokumentumTipusEnum.Munkaterv:
case (int)DokumentumTipusEnum.tavollet:
case (int)DokumentumTipusEnum.mukodesi_engedely:
isLablecben = true;
break;
default:
isLablecben = false;
break;
}
switch (kiterjesztes)
{
case ".xls":
return IktatoszamVonalkodExcelKitoltes(handler, generaltDokumentumId, iktatoszam);
case ".doc":
return IktatoszamVonalkodDocKitoltes(handler, generaltDokumentumId, iktatoszam, isLablecben);
case ".docx":
return IktatoszamVonalkodDocxKitoltes(handler, generaltDokumentumId, iktatoszam, isLablecben);
case ".pdf":
return IktatoszamVonalkodPlaceholderKitoltes(handler, generaltDokumentumId, iktatoszam);
case ".xlsx":
return IktatoszamVonalkodExcelXKitoltes(handler, generaltDokumentumId, iktatoszam);
default:
return handler.DokumentumDal().Get(generaltDokumentumId);
}
}
private static IDokumentum IktatoszamVonalkodDocKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam, bool isLablecben)
{
return IktatoszamVonalkodWordKitoltes(handler, generaltDokumentumId, iktatoszam, isLablecben, true);
}
private static IDokumentum IktatoszamVonalkodDocxKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam, bool isLablecben)
{
return IktatoszamVonalkodWordKitoltes(handler, generaltDokumentumId, iktatoszam, isLablecben, false);
}
private static IDokumentum IktatoszamVonalkodWordKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam, bool isLablecben, bool isDoc)
{
IDokumentum generaltDokumentum = handler.DokumentumDal().Get(generaltDokumentumId);
using (var ret = new MemoryStream())
using (var ms = new MemoryStream(generaltDokumentum.Tartalom))
{
var loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = (isDoc) ? Aspose.Words.LoadFormat.Doc : Aspose.Words.LoadFormat.Docx;
Aspose.Words.Document doc = new Aspose.Words.Document(ms, loadOptions);
Aspose.Words.Story footer = (isLablecben) ? doc.FirstSection.HeadersFooters[Aspose.Words.HeaderFooterType.FooterPrimary] : (Aspose.Words.Story)doc.FirstSection.Body;
Aspose.Words.Replacing.FindReplaceOptions options = new Aspose.Words.Replacing.FindReplaceOptions
{
MatchCase = true,
FindWholeWordsOnly = false,
ReplacingCallback = new WordIktatoszamVonalkodTextReplacer()
};
footer.Range.Replace(new System.Text.RegularExpressions.Regex("{iktatoSzam}|{vonalkod}"), iktatoszam, options);
var saveFormat = (isDoc) ? Aspose.Words.SaveFormat.Doc : Aspose.Words.SaveFormat.Docx;
doc.Save(ret, saveFormat);
ret.Position = 0;
generaltDokumentum.Tartalom = ret.ToArray();
}
return generaltDokumentum;
}
private static IDokumentum IktatoszamVonalkodExcelKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam)
{
IDokumentum generaltDokumentum = handler.DokumentumDal().Get(generaltDokumentumId);
using (var ms = new MemoryStream(generaltDokumentum.Tartalom))
{
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(ms);
foreach (var worksheet in workbook.Worksheets)
{
worksheet.PageSetup.SetFooter(0, string.Format("&16{0}", iktatoszam));
worksheet.PageSetup.SetFooter(2, string.Format("&\"Code 128\"&20{0}", iktatoszam));
}
var ret = workbook.SaveToStream();
generaltDokumentum.Tartalom = ret.GetBuffer();
}
return generaltDokumentum;
}
private static IDokumentum IktatoszamVonalkodExcelXKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam)
{
IDokumentum generaltDokumentum = handler.DokumentumDal().Get(generaltDokumentumId);
using (var ms = new MemoryStream(generaltDokumentum.Tartalom))
{
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(ms, new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Xlsx));
foreach (var worksheet in workbook.Worksheets)
{
worksheet.PageSetup.SetFooter(0, string.Format("&16{0}", iktatoszam));
worksheet.PageSetup.SetFooter(2, string.Format("&\"Code 128\"&20{0}", iktatoszam));
}
var ret = new MemoryStream();
workbook.Save(ret, Aspose.Cells.SaveFormat.Xlsx);
ret.Seek(0, SeekOrigin.Begin);
generaltDokumentum.Tartalom = ret.ToArray();
}
return generaltDokumentum;
}
private static IDokumentum IktatoszamVonalkodPlaceholderKitoltes(IDalHandler handler, int generaltDokumentumId, string iktatoszam)
{
IDokumentum generaltDokumentum = handler.DokumentumDal().Get(generaltDokumentumId);
using (var ms = new MemoryStream(generaltDokumentum.Tartalom))
using (var ret = new MemoryStream())
{
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(ms);
var fragmentAbsober = new Aspose.Pdf.Text.TextFragmentAbsorber("{iktatoSzam}");
doc.Pages.Accept(fragmentAbsober);
var fragmentCollection = fragmentAbsober.TextFragments;
foreach (var text in fragmentCollection)
{
text.Text = iktatoszam;
text.TextState.ForegroundColor = Aspose.Pdf.Color.Black;
}
fragmentAbsober.Phrase = "{vonalkod}";
doc.Pages.Accept(fragmentAbsober);
fragmentCollection = fragmentAbsober.TextFragments;
var code128Path = System.Web.Hosting.HostingEnvironment.MapPath("~/fonts/code128.ttf");
var font = Aspose.Pdf.Text.FontRepository.OpenFont(code128Path);
foreach (var text in fragmentCollection)
{
text.Text = iktatoszam;
text.TextState.Font = font;
text.TextState.ForegroundColor = Aspose.Pdf.Color.Black;
}
//foreach (var page in doc.Pages)
//{
// Aspose.Pdf.Text.TextBuilder textBuilder = new Aspose.Pdf.Text.TextBuilder(page);
// Aspose.Pdf.Text.TextFragment textFragment = new Aspose.Pdf.Text.TextFragment("Laci");
// if (page.Footer == null)
// {
// Aspose.Pdf.HeaderFooter footer = new Aspose.Pdf.HeaderFooter();
// page.Footer = footer;
// }
// page.Footer.Paragraphs.Add(textFragment);
//}
doc.Save(ret);
generaltDokumentum.Tartalom = ret.ToArray();
}
return generaltDokumentum;
}
private static string GetDisplayName<T>(T enumValue) where T : Enum
{
string result;
FieldInfo fieldInfo = enumValue.GetType().GetField(enumValue.ToString());
DisplayAttribute[] displayAttributeArray = (DisplayAttribute[])fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false);
if (displayAttributeArray.Length > 0)
{
result = displayAttributeArray[0].GetName();
return result;
}
result = enumValue.ToString();
return result;
}
}
}
+61
View File
@@ -0,0 +1,61 @@
using System.Collections.Generic;
using Kreta.Core;
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
using Kreta.Core.Iktato.Poszeidon.Infrastructure;
using Kreta.Core.Iktato.Poszeidon.Infrastructure.Interface;
using Kreta.DataAccessManual.Interfaces;
using Kreta.Framework.Util;
namespace Kreta.Job.Tasks
{
public class IktatasJobBase
{
public IIktatoRepositoryFactory IktatoRepositoryFactory { get; }
public IktatoServiceConfiguration IktatoServiceConfiguration { get; }
public IktatasJobBase(IIktatoRepositoryFactory iktatoRepositoryFactory, IWcfServiceContext wcfServiceContext, IktatoServiceConfiguration iktatoServiceConfiguration)
{
IktatoServiceConfiguration = iktatoServiceConfiguration;
IktatoRepositoryFactory = iktatoRepositoryFactory;
}
public IktatoRepositoryConfiguration GetIktatoRepositoryConfiguration(string intezmenyIktatoSzervezetAzonosito, string intezmenyPoszeidonBejelentkezesiNev)
{
return new IktatoRepositoryConfiguration()
{
EndpointAddress = string.Format(IktatoServiceConfiguration.EndpointAddress, "poszeidonai"),
Password = IktatoServiceConfiguration.Password,
Username = string.Format(IktatoServiceConfiguration.Username, intezmenyIktatoSzervezetAzonosito),
PoszeidonAzonosito = intezmenyPoszeidonBejelentkezesiNev
};
}
protected List<(string, string)> GetDokumentumKulcsszavak(IDalHandler dalHandler, int iktatottDokumentumId, int intezmenyId, int tanevId, string tanevNeve, string iktatoNeve)
{
var iktDokTipus = dalHandler.IktatottDokumentumDal().Get(iktatottDokumentumId).DokumentumTipus;
var kulcsszavak = new List<(string key, string value)>
{
(key: "Tanév", value: tanevNeve),
(key: "Iktató személy", value: iktatoNeve),
(key: "Dokumentum típus", value: iktDokTipus.GetItemNameFromCache(tanevId)),
};
System.Data.DataSet ds = dalHandler.NyomtatvanyokDal().GetKulcsszoertekekOnIktatottDokumentum(intezmenyId, tanevId, iktatottDokumentumId);
foreach (System.Data.DataRow row in ds.Tables[0].Rows)
{
var ertek = row["ertek"].ToString();
if (!string.IsNullOrWhiteSpace(ertek))
{
if (ertek.Length > Kreta.Core.Constants.MinMaxValues.MaxKulcsszoErtekLength)
{
ertek = ertek.Substring(0, Kreta.Core.Constants.MinMaxValues.MaxKulcsszoErtekLength - 3) + "...";
}
kulcsszavak.Add((key: row["tipus_DNAME"].ToString(), value: ertek));
}
}
return kulcsszavak;
}
}
}
+203
View File
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3359C4C9-E530-4996-98C4-7C3AB513E163}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kreta.Job.Tasks</RootNamespace>
<AssemblyName>Kreta.Job.Tasks</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aspose.Cells, Version=21.3.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.Cells.21.3.0\lib\net40\Aspose.Cells.dll</HintPath>
</Reference>
<Reference Include="Aspose.PDF, Version=21.3.0.0, Culture=neutral, PublicKeyToken=f0262d67fe233d63, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.PDF.21.3.0\lib\net4.0\Aspose.PDF.dll</HintPath>
</Reference>
<Reference Include="Aspose.Words, Version=21.3.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.Words.21.3.0\lib\net461\Aspose.Words.dll</HintPath>
</Reference>
<Reference Include="Aspose.Words.Pdf2Word, Version=21.3.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<HintPath>..\packages\Aspose.Words.21.3.0\lib\net461\Aspose.Words.Pdf2Word.dll</HintPath>
</Reference>
<Reference Include="Hangfire.Core, Version=1.7.27.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hangfire.Core.1.7.27\lib\net46\Hangfire.Core.dll</HintPath>
</Reference>
<Reference Include="Kreta.Core.Iktato.Poszeidon, Version=2.0.29.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kreta.Core.Iktato.Poszeidon.2.0.29\lib\net48\Kreta.Core.Iktato.Poszeidon.dll</HintPath>
</Reference>
<Reference Include="Kreta.Core.MessageBroker, Version=3.0.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kreta.Core.MessageBroker.3.0.8\lib\netstandard2.0\Kreta.Core.MessageBroker.dll</HintPath>
</Reference>
<Reference Include="Kreta.Core.MessageBroker.Contract, Version=3.0.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kreta.Core.MessageBroker.Contract.3.0.8\lib\netstandard2.0\Kreta.Core.MessageBroker.Contract.dll</HintPath>
</Reference>
<Reference Include="Kreta.Core.SAP, Version=2.0.40.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kreta.Core.SAP.2.0.40\lib\net48\Kreta.Core.SAP.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Extensions.Configuration.Json, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.8.0\lib\net46\Serilog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Tools\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BankszamlaIgenylesJob.cs" />
<Compile Include="Cache\OrarendValtozasCache.cs" />
<Compile Include="Models\OrarendValtozasModel.cs" />
<Compile Include="ConnectionStringCacheJob.cs" />
<Compile Include="EESZTInterfaceJob.cs" />
<Compile Include="Helpers\Notification\OrarendValtozasNotificationHelper.cs" />
<Compile Include="Helpers\Utility\Extensions.cs" />
<Compile Include="OtpBankszamlaIgenylesJob.cs" />
<Compile Include="UpdateTanuloDualisSzerzodeseiJob.cs" />
<Compile Include="TavolletIktatasJob.cs" />
<Compile Include="UpdateCOVIDFlagJob.cs" />
<Compile Include="MkbBankszamlaIgenylesJob.cs" />
<Compile Include="EmailJob.cs" />
<Compile Include="DeleteInvalidLinksJob.cs" />
<Compile Include="Entities\IdWithData.cs" />
<Compile Include="EugyintezesJob.cs" />
<Compile Include="FeltoltesJob.cs" />
<Compile Include="Helpers\Constants.cs" />
<Compile Include="Helpers\Email\KozelgoFogadooraMailHelper.cs" />
<Compile Include="Helpers\Email\NemNaplozottTanorakEmailHelper.cs" />
<Compile Include="Helpers\Iktatas\AlszamosIktatasData.cs" />
<Compile Include="Helpers\Iktatas\FeltoltesUjVerzioData.cs" />
<Compile Include="Helpers\Iktatas\FoszamosIktatasData.cs" />
<Compile Include="Helpers\Iktatas\WordIktatoszamVonalkodTextReplacer.cs" />
<Compile Include="Helpers\Notification\ErtekelesNotificationHelper.cs" />
<Compile Include="Helpers\Notification\HazifeladatNotificationHelper.cs" />
<Compile Include="Helpers\Notification\MulasztasNotificationHelper.cs" />
<Compile Include="Helpers\Notification\BejelentettSzamonkeresNotificationHelper.cs" />
<Compile Include="Helpers\Notification\FeljegyzesNotificationHelper.cs" />
<Compile Include="Helpers\Notification\RendszeruzenetNotificationHelper.cs" />
<Compile Include="IktatasJob.cs" />
<Compile Include="IktatasJobBase.cs" />
<Compile Include="Models\TavolletModel.cs" />
<Compile Include="NotificationJob.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SapJob.cs" />
<Compile Include="SzakkepzesiJuttatasUpdateJob.cs" />
<Compile Include="TavolletJob.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Framework\Kreta.Framework.csproj">
<Project>{320ef478-7155-441d-b1e9-47ec3e57fb45}</Project>
<Name>Kreta.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.Client\Kreta.Client.csproj">
<Project>{4b28e52b-b531-403c-a827-2cc178ff8a4f}</Project>
<Name>Kreta.Client</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.Core\Kreta.Core.csproj">
<Project>{57418d3e-caf1-482c-9b18-85d147abd495}</Project>
<Name>Kreta.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.DataAccessInterfaceGenerated\Kreta.DataAccess.Interfaces.csproj">
<Project>{68318C3F-0779-4755-848E-B270F6BAC40B}</Project>
<Name>Kreta.DataAccess.Interfaces</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.DataAccessManual\Kreta.DataAccessManual.csproj">
<Project>{3212F2BF-6883-48B4-9F7D-0DFF4C826221}</Project>
<Name>Kreta.DataAccessManual</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.EESZTInterface\Kreta.EESZTInterface.csproj">
<Project>{e87a83bb-c9d9-4a4d-99c4-32b2a7ce0cfb}</Project>
<Name>Kreta.EESZTInterface</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.Enums\Kreta.Enums.csproj">
<Project>{1D5E0AC2-DFAB-4D32-9AD1-B5788A7D06BD}</Project>
<Name>Kreta.Enums</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.Job.Tasks.Core\Kreta.Job.Tasks.Core.csproj">
<Project>{5dc12a8b-4730-400f-bbe3-0a9072d6b2ee}</Project>
<Name>Kreta.Job.Tasks.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.KretaServer\Kreta.KretaServer.csproj">
<Project>{62EB8504-1C3A-4DB1-AB86-F96B2341E201}</Project>
<Name>Kreta.KretaServer</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.MessageBroker\Kreta.MessageBroker.csproj">
<Project>{28cc34c7-0a89-4a33-ba89-8952ffeb2f9e}</Project>
<Name>Kreta.MessageBroker</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.Resources\Kreta.Resources.csproj">
<Project>{dfcb4d33-b599-42b2-98c6-b60fd220db0c}</Project>
<Name>Kreta.Resources</Name>
</ProjectReference>
<ProjectReference Include="..\Kreta.KretaServer\Kreta.KretaServer.csproj">
<Project>{62EB8504-1C3A-4DB1-AB86-F96B2341E201}</Project>
<Name>Kreta.KretaServer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,52 @@
using System.Collections.Generic;
using Kreta.Core.Configuratiaton;
using Kreta.DataAccessManual.ParameterClasses;
using Kreta.Job.Tasks.Core;
namespace Kreta.Job.Tasks
{
public class MkbBankszamlaIgenylesJob : BankszamlaIgenylesJob, IMkbBankszamlaIgenylesJob
{
private readonly string MKB_IN = "\\MKB_IN\\";
private readonly string MKB_ERROR = "\\MKB_ERROR\\";
private readonly string MKB_OK = "\\MKB_OK\\";
private readonly string MKB_ARCHIVE = "\\MKB_ARCHIVE\\";
public void MkbBankszamlaIgenyles()
{
RunBankszamlaIgenylesJob<MkbBankszamlaIgenylesConfiguration>();
}
protected override string GetInPart()
{
return MKB_IN;
}
protected override string GetErrorPart()
{
return MKB_ERROR;
}
protected override string GetOkPart()
{
return MKB_OK;
}
protected override string GetArchivePart()
{
return MKB_ARCHIVE;
}
protected override string DecryptEgyediAzonosito(string receivedEgyediAzonosito)
{
return receivedEgyediAzonosito;
}
protected override bool HasRowWithError(List<BankszamlaIgenylesPco> bankszamlaIgenylesPcos)
{
// NOTE: MKB esetén mindig kell küldeni email-t.
return true;
}
}
}
@@ -0,0 +1,17 @@
using System;
namespace Kreta.BusinessLogic.Helpers.Models
{
[Serializable]
public class OrarendValtozasModel
{
public string IntezmenyAzonosito { get; set; }
public int UserId { get; set; }
public Guid IdpUniqueId { get; set; }
public string UserNev { get; set; }
public int OrarendiOraId { get; set; }
public string Uzenet { get; set; }
public string Nap { get; set; }
public DateTime Datum { get; set; }
}
}
+52
View File
@@ -0,0 +1,52 @@
using System;
namespace Kreta.Job.Tasks.Models
{
public class TavolletModel
{
public DateTime TavolletKezdete { get; set; }
public int TavolletTipusId { get; set; } /* DictionaryItem */
public DateTime TavolletVege { get; set; }
public int? TavolletIdotartamNap { get; set; }
public int? TavolletIdotartamOra { get; set; }
public int AlkalmazottId { get; set; }
public int? ElozoTaneviAlkalmazottId { get; set; }
public int IntezmenyId { get; set; }
public int TanevId { get; set; }
public override bool Equals(object obj)
{
var co = obj as TavolletModel;
return co != null &&
TavolletKezdete == co.TavolletKezdete &&
TavolletTipusId == co.TavolletTipusId &&
TavolletVege == co.TavolletVege &&
TavolletIdotartamNap == co.TavolletIdotartamNap &&
TavolletIdotartamOra == co.TavolletIdotartamOra &&
AlkalmazottId == co.AlkalmazottId &&
IntezmenyId == co.IntezmenyId;
}
public override int GetHashCode()
{
var hashCode = 365368652;
hashCode = hashCode * -1521134295 + TavolletKezdete.GetHashCode();
hashCode = hashCode * -1521134295 + TavolletTipusId.GetHashCode();
hashCode = hashCode * -1521134295 + TavolletVege.GetHashCode();
hashCode = hashCode * -1521134295 + TavolletIdotartamNap.GetHashCode();
hashCode = hashCode * -1521134295 + TavolletIdotartamOra.GetHashCode();
hashCode = hashCode * -1521134295 + AlkalmazottId.GetHashCode();
hashCode = hashCode * -1521134295 + IntezmenyId.GetHashCode();
return hashCode;
}
}
}
+213
View File
@@ -0,0 +1,213 @@
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();
}
}
}
}
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Security.Cryptography;
using Kreta.Core.Configuratiaton;
using Kreta.Core.Logic;
using Kreta.DataAccessManual.ParameterClasses;
using Kreta.Job.Tasks.Core;
namespace Kreta.Job.Tasks
{
public class OtpBankszamlaIgenylesJob : BankszamlaIgenylesJob, IOtpBankszamlaIgenylesJob
{
private readonly string OTP_IN = "\\OTP_IN\\";
private readonly string OTP_ERROR = "\\OTP_ERROR\\";
private readonly string OTP_OK = "\\OTP_OK\\";
private readonly string OTP_ARCHIVE = "\\OTP_ARCHIVE\\";
public void OtpBankszamlaIgenyles()
{
RunBankszamlaIgenylesJob<OtpBankszamlaIgenylesConfiguration>();
}
protected override string GetArchivePart()
{
return OTP_ARCHIVE;
}
protected override string GetErrorPart()
{
return OTP_ERROR;
}
protected override string GetInPart()
{
return OTP_IN;
}
protected override string GetOkPart()
{
return OTP_OK;
}
protected override bool HasRowWithError(List<BankszamlaIgenylesPco> bankszamlaIgenylesPcos)
{
// NOTE: OTP esetén csak akkor kell küldeni email-t, ha van hibás sor a feldolgozott állományban.
return bankszamlaIgenylesPcos.Any(x => x.IsError);
}
protected override string DecryptEgyediAzonosito(string receivedEgyediAzonosito)
{
// NOTE: az OTP a titkosított tokent küldi vissza az egyedi azonosítóban, ezért azt decrypt-álni kell
var configuration = (OtpBankszamlaIgenylesConfiguration)ConfigurationManager.GetSection(nameof(OtpBankszamlaIgenylesConfiguration));
if (string.IsNullOrWhiteSpace(receivedEgyediAzonosito))
{
return "";
}
try
{
return UrlLogic.JweDecrypt(configuration.PrivateKeyFileName, configuration.PrivateKeyFilePassword, receivedEgyediAzonosito);
}
catch (CryptographicException ex)
{
return "-";
}
catch (ArgumentOutOfRangeException aorex)
{
return "-";
}
}
}
}
@@ -0,0 +1 @@

+369
View File
@@ -0,0 +1,369 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Kreta.Core;
using Kreta.Core.Exceptions;
using Kreta.Core.SAP;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.Interfaces;
using Kreta.DataAccessManual.ParameterClasses;
using Kreta.Enums.ManualEnums;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Core.Models;
using Kreta.Job.Tasks.Models;
using Kreta.Resources;
namespace Kreta.Job.Tasks
{
public class SapJob : ISapJob
{
private ISAPService SapServiceClient { get; }
private ISAPConfiguration SapConfiguration { get; }
public SapJob(ISAPService sapService, ISAPConfiguration sapConfiguration)
{
SapServiceClient = sapService ?? throw new ArgumentNullException(nameof(sapService));
SapConfiguration = sapConfiguration ?? throw new ArgumentNullException(nameof(sapService));
}
public void SyncJobKeretEsTavollet()
{
var exceptions = new List<Exception>();
var now = DateTime.Now;
foreach (var azonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
Dal.OrganizationConnection.Run(azonosito, h =>
{
try
{
var icDal = h.IntezmenyConfigDAL();
var dal = h.IntezmenyDal();
var intezmenyId = dal.GetIntezmenyIdByAzonosito(azonosito);
if (!bool.Parse(icDal.GetIntezmenyConfig(intezmenyId.Value, IntezmenyConfigModulEnum.HRModul.ToString(), IntezmenyConfigTipusEnum.IsEnabled.ToString())))
return;
var ds = dal.GetIntezmenyIdAktivTanevIdByAzonosito(azonosito);
if (ds.Tables[0].Rows.Count > 0)
{
var pco = new TavolletSearchPco
{
TanevId = ds.Tables[0].Rows[0].Field<int>("AktivTanevId"),
IntezmenyId = ds.Tables[0].Rows[0].Field<int>("IntezmenyId"),
IntezmenyAzonosito = azonosito,
NaptariEv = new int[] { now.Year },
};
SyncSzabadsagKeret(h, null, pco);
SyncTavollet(h, null, pco);
}
}
catch (BlException ex)
{
exceptions.Add(ex);
//TODO: Üzleti logika által dobott hiba egyéb kezelése! Ha kell a job-nál ezzel valamit kezdeni, akkor...
}
catch (Exception ex)
{
exceptions.Add(ex);
}
});
}
if (exceptions.Any())
{
var blExceptions = exceptions.FindAll(e => e is BlException).Cast<BlException>();
if (blExceptions.Any())
{
//UzenetekHelper.cs ??
SendNotificationEmail(blExceptions);
}
var aggregateException = new AggregateException(exceptions);
throw aggregateException.Flatten();
}
}
private void SendNotificationEmail(IEnumerable<BlException> blExceptions)
{
var aggregateBlException = new AggregateException(blExceptions).ToString();
var emailModel = new EmailModel
{
Message = aggregateBlException,
Subject = $"{EmailResource.SapSyncJob}",
Bcc = SapConfiguration.NotificationEmailsBussinessLogic
};
Hangfire.BackgroundJob.Enqueue<IEmailJob>(email => email.SendMailAsync(emailModel));
}
private int SyncSzabadsagKeret(IDalHandler dalHandler, int? alkalmazottId, TavolletSearchPco pco)
{
int missingSzTSz = 0;
var aDal = dalHandler.Alkalmazott();
DataSet ds = aDal.GetAlkalmazottakSapAzonositoi(alkalmazottId, pco.TanevId, pco.IntezmenyId);
if (ds.Tables[0].Rows.Count > 0)
{
var funkcioTeruletek = new HashSet<string>();
var keretek = new Dictionary<string, (int alkalmazottId, int keret)>();
var requestQ = new List<TavolletRequestModel>();
var now = DateTime.Now;
foreach (DataRow row in ds.Tables[0].Rows)
{
string intezmenySapAzonosito = row["IntezmenySAPKod"].ToString();
string szTSzAzonosito = row["SzTSzKod"].ToString();
if (string.IsNullOrWhiteSpace(intezmenySapAzonosito))
{
throw new BlException(string.Format(HRModulResource.IntezmenySapAzonositoHiany, pco.IntezmenyAzonosito));
}
if (string.IsNullOrWhiteSpace(szTSzAzonosito))
{
missingSzTSz++;
continue;
}
if (!keretek.ContainsKey(szTSzAzonosito))
{
keretek.Add(szTSzAzonosito, (row.Field<int>("AlkalmazottId"), row.Field<int>("SzabadsagKeret")));
}
if (!funkcioTeruletek.Contains(intezmenySapAzonosito))
{
funkcioTeruletek.Add(intezmenySapAzonosito);
for (int i = 0; i < pco.NaptariEv.Length; i++)
{
// Időszak: január 1 - ma
DateTime kezdet = new DateTime(pco.NaptariEv[i], 1, 1);
DateTime vege = pco.NaptariEv[i] == now.Year ? now : new DateTime(pco.NaptariEv[i], 1, 1);
requestQ.Add(new TavolletRequestModel
{
IntezmenyAzonosito = intezmenySapAzonosito,
SzTSzAzonosito = alkalmazottId.HasValue ? szTSzAzonosito : null,
Kezdet = kezdet,
Vege = vege
});
}
}
}
var response = SapServiceClient.LekerdezesKeret(requestQ.ToArray());
if (response != null && response.Any())
{
var updateKeretDict = new Dictionary<int, int>();
var sapErrorList = new List<string>();
foreach (var item in response)
{
if (ResultCode.Success == item.ErrCode)
{
if (keretek.TryGetValue(item.SzTSzAzonosito, out (int alkalmazottId, int keret) value) && value.keret != item.SzabadKeret)
{
updateKeretDict.Add(value.alkalmazottId, item.SzabadKeret);
}
}
else
{
// Ha hiba van, akkor egy listában gyűjtjük az üzeneteket.
sapErrorList.Add(item.ErrText);
}
}
if (sapErrorList != null && sapErrorList.Count > 0)
{
throw new BlException(HRModulResource.ASzinkronizacioNemSikerult, new BlException(string.Join(Environment.NewLine, sapErrorList)));
}
aDal.UpdateAlkalmazottSzabadsagKeret(updateKeretDict);
}
}
return missingSzTSz;
}
private int SyncTavollet(IDalHandler dalHandler, int? alkalmazottId, TavolletSearchPco pco)
{
int missingSzTSz = 0;
IAlkalmazottDal alkalmazaottDal = dalHandler.Alkalmazott();
DataSet ds = alkalmazaottDal.GetAlkalmazottakSapAzonositoi(alkalmazottId, pco.TanevId, pco.IntezmenyId);
if (ds.Tables[0].Rows.Count > 0)
{
var sztszError = new HashSet<string>(); //Adathibák!!!
var sapAzonositok = ds.Tables[0].Rows.OfType<DataRow>();
var requestQ = new List<TavolletRequestModel>();
foreach (DataRow row in sapAzonositok)
{
string intezmenySapAzonosito = row["IntezmenySAPKod"].ToString();
string szTSzAzonosito = row["SzTSzKod"].ToString();
if (string.IsNullOrWhiteSpace(intezmenySapAzonosito))
{
throw new BlException(string.Format(HRModulResource.IntezmenySapAzonositoHiany, pco.IntezmenyAzonosito));
}
if (string.IsNullOrWhiteSpace(szTSzAzonosito))
{
missingSzTSz++;
continue;
}
// Időszak: január 1 - december 31
for (int i = 0; i < pco.NaptariEv.Length; i++)
{
DateTime kezdet = new DateTime(pco.NaptariEv[i], 1, 1);
DateTime vege = kezdet.AddYears(1).AddSeconds(-1);
requestQ.Add(new TavolletRequestModel
{
IntezmenyAzonosito = intezmenySapAzonosito,
SzTSzAzonosito = szTSzAzonosito,
Kezdet = kezdet,
Vege = vege
});
}
}
var response = SapServiceClient.Lekerdezes(requestQ.ToArray());
if (response != null && response.Any())
{
ISapTavolletDal sapTavolletDal = dalHandler.SapTavolletDal();
var tavolletTipusDict = new Dictionary<string, int>();
foreach (DataRow row in sapTavolletDal.GetTavolletTipusDataSet(pco.TanevId, pco.IntezmenyId).Tables[0].Rows)
{
tavolletTipusDict.Add(row.Field<string>("SapCode"), row.Field<int>("ID"));
}
// 'Na' érték SAP kódja
string naTavollettipus = "0000";
var tavolletListDict = new Dictionary<string, List<TavolletModel>>();
var sapErrorList = new List<string>();
foreach (var item in response)
{
if (ResultCode.Success == item.ErrCode)
{
DataRow sapAzonosito;
try
{
sapAzonosito = sapAzonositok.Single(d => d.Field<string>("SzTSzKod") == item.SzTSzAzonosito);
}
catch (Exception)
{
if (!sztszError.Contains(item.SzTSzAzonosito))
{
sztszError.Add(item.SzTSzAzonosito);
}
continue;
}
TavolletModel e = new TavolletModel
{
AlkalmazottId = sapAzonosito.Field<int>("AlkalmazottId"),
ElozoTaneviAlkalmazottId = sapAzonosito.Field<int?>("ElozoTaneviAlkalmazottId"),
TanevId = pco.TanevId,
IntezmenyId = pco.IntezmenyId,
TavolletKezdete = item.Kezdet,
TavolletVege = item.Vege,
TavolletIdotartamNap = item.TavolletIdotartamNap,
TavolletIdotartamOra = item.TavolletIdotartamOra,
TavolletTipusId = tavolletTipusDict.TryGetValue(item.TavolletKod.WithLeadZeros(), out int value)
? value
: tavolletTipusDict[naTavollettipus]
};
if (!tavolletListDict.ContainsKey(item.SzTSzAzonosito))
{
tavolletListDict.Add(item.SzTSzAzonosito, new List<TavolletModel>());
}
tavolletListDict[item.SzTSzAzonosito].Add(e);
}
else
{
// Ha hiba van, akkor egy listában gyűjtjük az üzeneteket.
sapErrorList.Add(item.ErrText);
}
}
if (sapErrorList != null && sapErrorList.Count > 0)
{
throw new BlException(HRModulResource.ASzinkronizacioNemSikerult, new BlException(string.Join(Environment.NewLine, sapErrorList)));
}
var checklistTavolletDict = new Dictionary<string, List<TavolletModel>>();
foreach (DataRow row in sapTavolletDal.GetSAPTavolletDataSet(alkalmazottId, pco).Tables[0].Rows)
{
TavolletModel c = new TavolletModel
{
AlkalmazottId = row.Field<int>("AlkalmazottId"),
IntezmenyId = row.Field<int>("IntezmenyId"),
TavolletKezdete = row.Field<DateTime>("TavolletKezdete"),
TavolletVege = row.Field<DateTime>("TavolletVege"),
TavolletIdotartamNap = row.Field<int?>("TavolletIdotartamNap"),
TavolletIdotartamOra = row.Field<int?>("TavolletIdotartamOra"),
TavolletTipusId = row.Field<int>("TavolletTipusId")
};
if (!checklistTavolletDict.ContainsKey(row.Field<string>("SzTSzKod")))
{
checklistTavolletDict.Add(row.Field<string>("SzTSzKod"), new List<TavolletModel>());
}
checklistTavolletDict[row.Field<string>("SzTSzKod")].Add(c);
}
var syncKeys = new List<string>();
foreach (var key in tavolletListDict.Keys)
{
int th = tavolletListDict[key].AsReadOnly().GetSequenceHashCode();
int ch = checklistTavolletDict.TryGetValue(key, out List<TavolletModel> list) ? list.AsReadOnly().GetSequenceHashCode() : 0;
if (th != ch)
{
syncKeys.Add(key);
}
}
if (syncKeys.Count > 0)
{
sapTavolletDal.SyncSapTavollet(ConvertModelToPco(tavolletListDict.Where(d => syncKeys.Contains(d.Key))), pco);
}
}
}
return missingSzTSz;
}
private Dictionary<string, List<SAPTavolletPco>> ConvertModelToPco(IEnumerable<KeyValuePair<string, List<TavolletModel>>> coList)
{
var result = new Dictionary<string, List<SAPTavolletPco>>();
foreach (var co in coList)
{
result.Add(co.Key, new List<SAPTavolletPco>());
foreach (var item in co.Value)
{
result[co.Key].Add(new SAPTavolletPco
{
AlkalmazottId = item.AlkalmazottId,
ElozoTaneviAlkalmazottId = item.ElozoTaneviAlkalmazottId,
TanevId = item.TanevId,
IntezmenyId = item.IntezmenyId,
TavolletKezdete = item.TavolletKezdete,
TavolletVege = item.TavolletVege,
TavolletIdotartamNap = item.TavolletIdotartamNap,
TavolletIdotartamOra = item.TavolletIdotartamOra,
TavolletTipusId = item.TavolletTipusId
});
}
}
return result;
}
}
}
@@ -0,0 +1,34 @@
using System.Linq;
using Kreta.DataAccessManual;
using Kreta.Enums;
using Kreta.Job.Tasks.Core;
namespace Kreta.Job.Tasks
{
public class SzakkepzesiJuttatasUpdateJob : ISzakkepzesiJuttatasUpdateJob
{
public void UpdateSzakkepzesiJuttatasok()
{
foreach (var azonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
var connectionString = KretaServer.KretaServer.Instance.GetIntezmenyConnectionString(azonosito);
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
var intezmenyId = h.IntezmenyDal().GetIntezmenyIdByAzonosito(azonosito);
if (intezmenyId.HasValue)
{
var intezmeny = h.IntezmenyDal().Get(intezmenyId.Value);
var intezmenyAdatok = intezmeny.IntezmenyAdatok.SingleOrDefault(x => x.Tanev.Aktiv.HasValue && x.Tanev.Aktiv.Value);
var isSzakkepzoJuttatas = intezmenyAdatok?.IsSzakkepzoJuttatas ?? false;
if (isSzakkepzoJuttatas)
{
var dal = h.JuttatasDAL();
dal.UpdateTanulokSzakkepzesiJuttatasok(intezmenyAdatok.TanevId, 0, (int)JuttatasTipusEnum.szakkepzesi_juttatas);
dal.UpdateTanulokSzakkepzesiJuttatasok(intezmenyAdatok.TanevId, 0, (int)JuttatasTipusEnum.apaczaiosztondij);
}
}
});
}
}
}
}
+107
View File
@@ -0,0 +1,107 @@
using System;
using Kreta.Client.FileService;
using Kreta.Client.FileService.Request;
using Kreta.Core.Iktato.Poszeidon.Domain.Model;
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
using Kreta.Core.Iktato.Poszeidon.Infrastructure.Interface;
using Kreta.DataAccessManual;
using Kreta.Framework;
using Kreta.Job.Tasks.Core;
namespace Kreta.Job.Tasks
{
public class TavolletIktatasJob : IktatasJobBase, ITavolletIktatasJob
{
private readonly IFileServiceClientV3 fileServiceClientV3;
private readonly IFileServiceClient fileServiceClient;
public TavolletIktatasJob(IIktatoRepositoryFactory iktatoRepositoryFactory, IWcfServiceContext wcfServiceContext, Kreta.Core.IktatoServiceConfiguration iktatoServiceConfiguration, IFileServiceClientV3 fileServiceClientV3, IFileServiceClient fileServiceClient) : base(iktatoRepositoryFactory, wcfServiceContext, iktatoServiceConfiguration)
{
this.fileServiceClientV3 = fileServiceClientV3;
this.fileServiceClient = fileServiceClient;
}
[Hangfire.AutomaticRetry(Attempts = 1)]
[JobStateWatcher(typeof(TavolletIktatasJob), nameof(WriteFailedJobId))]
public void AddCsatolmanyokDokumentumhoz(int iktatottDokumentumId, int csatolmanyId, string intezmenyAzonosito, int tanevId, Hangfire.Server.PerformContext context)
{
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
var intezmenyDal = h.IntezmenyDal();
var iktatottDokumentumCsatolmanyDal = h.IktatottDokumentumCsatolmanyDal();
int intezmenyId = intezmenyDal.GetIntezmenyId(intezmenyAzonosito);
var intezmeny = intezmenyDal.Get(intezmenyId);
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var iktatottDokumentum = h.IktatottDokumentumDal().Get(iktatottDokumentumId);
var csatolmany = iktatottDokumentumCsatolmanyDal.Get(csatolmanyId);
var privateToken = fileServiceClient.GetPrivateToken();
if (!csatolmany.IsAttached)
{
var fileDownloadRequest = new GetUrlRequest(csatolmany.File.Utvonal, csatolmany.File.FileGuid.Value, csatolmany.File.FileNev);
var response = fileServiceClientV3.GetFile(intezmenyAzonosito, privateToken.AccessToken, fileDownloadRequest);
if (response.TryAgain)
{
response = fileServiceClientV3.GetFile(intezmenyAzonosito, privateToken.AccessToken, fileDownloadRequest);
}
var tanev = h.TanevDal().Get(tanevId);
var kulcsszavak = GetDokumentumKulcsszavak(h, iktatottDokumentumId, intezmenyId, tanevId, tanev.Nev, iktatottDokumentum.IktatoSzemely.NyomtatasiNev);
var csatolmanyIktatasRequest = new CsatolmanyIktatasRequest
{
ElektronikusPeldanyRequest = new ElektronikusPeldanyRequest
{
BirtokloSzervezetKod = intezmeny.IktatoSzervezetAzonosito,
EredetiFajlnev = csatolmany.Fajlnev,
Tartalom = Convert.FromBase64String(response.Tartalom),
},
IktatoSzervezetKod = intezmeny.IktatoSzervezetAzonosito,
IratId = iktatottDokumentum.IratId.ToString(),
Kulcsszavak = kulcsszavak,
};
var iktatoRepositoryConfiguration = GetIktatoRepositoryConfiguration(intezmeny.IktatoSzervezetAzonosito, intezmeny.PoszeidonBejelentkezesiNev);
var csatolmanyElektronikusPeldanyId = IktatoRepositoryFactory.GetIktatoRepository(iktatoRepositoryConfiguration).CsatolmanyHozzarendeleseIktatottDokumentumhoz(csatolmanyIktatasRequest);
csatolmany.ElektronikusPeldanyId = int.Parse(csatolmanyElektronikusPeldanyId);
csatolmany.IsAttached = true;
iktatottDokumentumCsatolmanyDal.Update(csatolmany);
}
var deleteRequest = new FileDeleteRequest(csatolmany.File.Utvonal, csatolmany.File.FileGuid.Value);
var delResponse = fileServiceClientV3.Delete(intezmenyAzonosito, privateToken.AccessToken, deleteRequest);
if (delResponse.TryAgain)
{
delResponse = fileServiceClientV3.Delete(intezmenyAzonosito, privateToken.AccessToken, deleteRequest);
}
if (delResponse.IsSuccess)
{
h.FileDAL().Delete(csatolmany.File.ID, csatolmany.File.FelhasznaloId);
}
csatolmany.FailedJobId = null;
iktatottDokumentumCsatolmanyDal.Update(csatolmany);
});
}
public static void WriteFailedJobId(string jobId)
{
var jobDetails = Hangfire.JobStorage.Current.GetMonitoringApi().JobDetails(jobId);
var csatolmanyId = int.Parse((string)jobDetails.Job.Args[1]);
var intezmenyAzonosito = (string)jobDetails.Job.Args[2];
var tanevId = (int)jobDetails.Job.Args[3];
Dal.OrganizationConnection.Run(intezmenyAzonosito, (h) =>
{
var intezmenyDal = h.IntezmenyDal();
int intezmenyId = intezmenyDal.GetIntezmenyId(intezmenyAzonosito);
UserContext.Instance.SetIntezmenyEsTanev(intezmenyId, tanevId, tanevId);
var iktatottDokumentumCsatolmanyDal = h.IktatottDokumentumCsatolmanyDal();
var iktatottDokumentumCsatolmany = iktatottDokumentumCsatolmanyDal.Get(csatolmanyId);
iktatottDokumentumCsatolmany.FailedJobId = int.Parse(jobId);
iktatottDokumentumCsatolmanyDal.Update(iktatottDokumentumCsatolmany);
});
}
}
}
+201
View File
@@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using Hangfire;
using Kreta.Client.Tavollet;
using Kreta.Core.Configuratiaton;
using Kreta.Core.SAP.CommunicationModels;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.ParameterClasses;
using Kreta.Enums;
using Kreta.Enums.ManualEnums;
using Kreta.Job.Tasks.Core;
using Kreta.Job.Tasks.Core.Models;
using Kreta.Resources;
namespace Kreta.Job.Tasks
{
public class TavolletJob : ITavolletJob
{
private readonly string KozpontiKretaConfig = "KozpontiKretaConfig";
public void SyncTavolletIktatott()
{
var kozpontiKreta = (KozpontiKretaConfiguration)ConfigurationManager.GetSection(KozpontiKretaConfig);
var tavolletClient = new TavolletClient(kozpontiKreta.KgrUrl, kozpontiKreta.ApiKey);
var exceptions = new List<Exception>();
foreach (var azonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
var connectionString = KretaServer.KretaServer.Instance.GetIntezmenyConnectionString(azonosito);
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
try
{
var icDal = h.IntezmenyConfigDAL();
var dal = h.IntezmenyDal();
var intezmenyId = dal.GetIntezmenyIdByAzonosito(azonosito);
if (!bool.Parse(icDal.GetIntezmenyConfig(intezmenyId.Value, IntezmenyConfigModulEnum.HRModul.ToString(), IntezmenyConfigTipusEnum.IsEnabled.ToString())))
return;
var ds = dal.GetIntezmenyIdAktivTanevIdByAzonosito(azonosito);
if (ds.Tables[0].Rows.Count == 0)
{
return;
}
var pco = new TavolletIktatottPCO()
{
TanevId = ds.Tables[0].Rows[0].Field<int>("AktivTanevId"),
IntezmenyId = ds.Tables[0].Rows[0].Field<int>("IntezmenyId")
};
var iDal = h.HRModulDAL();
var queryResult = iDal.GetTavolletSzinkronizalatlanDok(pco);
if (queryResult.Tables[0].Rows.Count == 0)
{
return;
}
TavolletDokumentumSyncRequestModel request = MapDatasetToRequestModel(queryResult);
if (tavolletClient.SyncTavolletIktatott(request).IsSuccess)
{
iDal.UpdateSzinkronizalatlan(pco.IntezmenyId, pco.TanevId, request.DokumentumokList.Select(x => x.TavolletJelentoId).Distinct().ToList());
}
}
catch (Exception ex)
{
exceptions.Add(ex);
}
if (exceptions.Any())
{
var aggregateException = new AggregateException(exceptions);
throw aggregateException.Flatten();
}
});
}
}
public void SendOutTavolletReminderEmails()
{
var kozpontiKreta = (KozpontiKretaConfiguration)ConfigurationManager.GetSection(KozpontiKretaConfig);
var tavolletClient = new TavolletClient(kozpontiKreta.KgrUrl, kozpontiKreta.ApiKey);
var exceptions = new List<Exception>();
DateTime dateTime = DateTime.Now;
foreach (var azonosito in KretaServer.KretaServer.Instance.GetOsszesIntezmeny())
{
var connectionString = KretaServer.KretaServer.Instance.GetIntezmenyConnectionString(azonosito);
TavolletjelentoListaResponseModel fuggoTavolletek = tavolletClient.GetTavolletek(
new TavolletjelentoListaRequestModel
{
IdoszakKezdet = new DateTime(dateTime.Year, dateTime.Month, 1),
TavolletStatuszId = (int)Kreta.Core.SAP.Enums.TavolletStatuszok.Fuggo,
KretaIntezmenyAzonosito = azonosito,
NaptariEv = new int[] { DateTime.Now.Year }
});
if (fuggoTavolletek?.TavolletjelentoResultList != null && fuggoTavolletek.TavolletjelentoResultList.Any())
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
try
{
var icDal = h.IntezmenyConfigDAL();
var dal = h.IntezmenyDal();
var intezmenyId = dal.GetIntezmenyIdByAzonosito(azonosito);
if (!bool.Parse(icDal.GetIntezmenyConfig(intezmenyId.Value, IntezmenyConfigModulEnum.HRModul.ToString(), IntezmenyConfigTipusEnum.IsEnabled.ToString())))
return;
var ds = dal.GetIntezmenyIdAktivTanevIdByAzonosito(azonosito);
if (ds.Tables[0].Rows.Count == 0)
{
return;
}
var tanevId = ds.Tables[0].Rows[0].Field<int>("AktivTanevId");
var alkalmazottDal = h.Alkalmazott();
DataSet tavolletJovahagyok = alkalmazottDal.GetAlkalmazottakNeveEsEmailCimeVzetoOraszamOkAlapjan(tanevId,
(int)EmailTipusEnum.Hivatalos, intezmenyId.Value,
new List<int>
{
(int) VezetoiOraszamokTipusEnum.Intezmenyvezeto,
(int) VezetoiOraszamokTipusEnum.TagintezmenyVezeto,
(int) VezetoiOraszamokTipusEnum.IntezmenyegysegVezeto
});
if (tavolletJovahagyok.Tables[0]?.Rows.Count > 0)
{
var emailsToBeSend = new List<EmailModel>();
// Iterate through users
foreach (DataRow dataRow in tavolletJovahagyok.Tables[0].Rows)
{
var emailCim = dataRow.Field<string>("EmailCim");
var emailModel = new EmailModel();
emailModel.TargetEmail = emailCim;
emailModel.Subject = EmailResource.TavolletJovahagyasEmlekeztetoTargy;
emailModel.Message = EmailResource.TavolletJovahagyasEmlekezteto;
emailsToBeSend.Add(emailModel);
}
if (emailsToBeSend.Any())
{
BackgroundJob.Enqueue<IEmailJob>(email => email.SendMailMessages(emailsToBeSend));
}
}
}
catch (Exception ex)
{
exceptions.Add(ex);
}
if (exceptions.Any())
{
var aggregateException = new AggregateException(exceptions);
throw aggregateException.Flatten();
}
});
}
}
}
private TavolletDokumentumSyncRequestModel MapDatasetToRequestModel(DataSet result)
{
var tavolletJelento = new List<TavolletDokumentumData>();
foreach (DataRow row in result.Tables[0].Rows)
{
var temp = new TavolletDokumentumData
{
TavolletJelentoId = row.Field<int>("C_KOZPONTITAVOLLETID"),
ElektronikusPeldanyId = row.Field<int>("C_ELEKTRONIKUSPELDANYID"),
FajlNev = row.Field<string>("C_FAJLNEV"),
RogzitoNev = row.Field<string>("C_NYOMTATASINEV"),
RogzitoGuid = Guid.Parse(row.Field<string>("C_EGYEDIAZONOSITO")),
RogzitesIdopontja = row.Field<DateTime>("C_IKTATASDATUMA"),
};
tavolletJelento.Add(temp);
}
return new TavolletDokumentumSyncRequestModel { DokumentumokList = tavolletJelento };
}
}
}
+19
View File
@@ -0,0 +1,19 @@
namespace Kreta.Job.Tasks
{
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Core;
public class UpdateCOVIDFlagJob : IUpdateCOVIDFlagJob
{
public void UpdateCOVIDFlag()
{
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
h.Gondviselo().UpdateCOVIDFlag();
});
}
}
}
}
@@ -0,0 +1,19 @@
namespace Kreta.Job.Tasks
{
using Kreta.DataAccessManual;
using Kreta.Job.Tasks.Core;
public class UpdateTanuloDualisSzerzodeseiJob : IUpdateTanuloDualisSzerzodeseiJob
{
public void UpdateTanuloDualisSzerzodesei()
{
foreach (string connectionString in KretaServer.KretaServer.Instance.ConnectionManager.GetSystemConnectionStrings())
{
Dal.ServiceSystemConnection.Run(connectionString, h =>
{
h.DualisSzerzodesFileDal().UpdateTanuloDualisSzerzodesei();
});
}
}
}
}
+51
View File
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.1.0" newVersion="5.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.1.0" newVersion="2.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CacheManager.Core" publicKeyToken="5b450b4fb65c4cdb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.6.0" newVersion="5.2.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Aspose.Cells" version="21.3.0" targetFramework="net48" />
<package id="Aspose.PDF" version="21.3.0" targetFramework="net48" />
<package id="Aspose.Words" version="21.3.0" targetFramework="net48" />
<package id="Hangfire.Core" version="1.7.27" targetFramework="net48" />
<package id="Kreta.Core.Iktato.Poszeidon" version="2.0.29" targetFramework="net48" />
<package id="Kreta.Core.MessageBroker" version="3.0.8" targetFramework="net48" />
<package id="Kreta.Core.MessageBroker.Contract" version="3.0.8" targetFramework="net48" />
<package id="Kreta.Core.SAP" version="2.0.40" targetFramework="net48" />
<package id="log4net" version="2.0.8" targetFramework="net48" />
<package id="Meziantou.Analyzer" version="1.0.688" targetFramework="net48" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
<package id="Owin" version="1.0" targetFramework="net48" />
<package id="Serilog" version="2.8.0" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>