150 lines
6.5 KiB
C#
150 lines
6.5 KiB
C#
using System.Collections.Generic;
|
|
using Kreta.Core.FeatureToggle.Configuration;
|
|
|
|
namespace Kreta.Core.FeatureToggle
|
|
{
|
|
public class SimpleFeature : IFeature
|
|
{
|
|
public string Name { get; set; }
|
|
|
|
public bool IsEnabled { get; set; }
|
|
|
|
public IEnumerable<string> InstituteIds { get; set; }
|
|
|
|
public IEnumerable<string> Environments { get; set; }
|
|
}
|
|
|
|
public class FeatureBase : SimpleFeature
|
|
{
|
|
protected FeatureBase(FeatureConfigurationSection config, string name)
|
|
{
|
|
foreach (SimpleFeatureConfiguration featureConfiguration in config.SimpleFeatures)
|
|
{
|
|
if (featureConfiguration.Name == name)
|
|
{
|
|
Name = featureConfiguration.Name;
|
|
IsEnabled = featureConfiguration.IsEnabled;
|
|
InstituteIds = featureConfiguration.InstituteIds;
|
|
Environments = featureConfiguration.Environments;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class DeleteInvalidLinksFeature : FeatureBase
|
|
{
|
|
public DeleteInvalidLinksFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.DeleteInvalidLinks) { }
|
|
}
|
|
|
|
public class UpdateCOVIDFlagFeature : FeatureBase
|
|
{
|
|
public UpdateCOVIDFlagFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.UpdateCOVIDFlag) { }
|
|
}
|
|
public class UpdateTanuloDualisSzerzodesei : FeatureBase
|
|
{
|
|
public UpdateTanuloDualisSzerzodesei(FeatureConfigurationSection config) : base(config, Constants.FeatureName.UpdateTanuloDualisSzerzodesei) { }
|
|
}
|
|
|
|
public class UseGlobalApiConnectionStringFeature : FeatureBase
|
|
{
|
|
public UseGlobalApiConnectionStringFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.UseGlobalApiConnectionString) { }
|
|
}
|
|
|
|
public class IntervalFeatureBase : FeatureBase
|
|
{
|
|
public string CustomCronExpression { get; }
|
|
public int SendItervalInMinute { get; } = 59;
|
|
public int? RunningIntervalStartHour { get; }
|
|
public int? RunningIntervalEndHour { get; }
|
|
|
|
public IntervalFeatureBase(FeatureConfigurationSection config, string name, ExtendedSendMobileNotification extendedSendMobileNotification) : base(config, name)
|
|
{
|
|
CustomCronExpression = extendedSendMobileNotification.CustomCronExpression;
|
|
|
|
if (int.TryParse(extendedSendMobileNotification.SendItervalInMinute, out int sendItervalInMinute))
|
|
{
|
|
if (sendItervalInMinute > 0)
|
|
{
|
|
SendItervalInMinute = sendItervalInMinute;
|
|
}
|
|
}
|
|
|
|
if (int.TryParse(extendedSendMobileNotification.RunningIntervalStartHour, out int runningIntervalStartHour))
|
|
{
|
|
if (runningIntervalStartHour > -1 && runningIntervalStartHour < 24)
|
|
{
|
|
RunningIntervalStartHour = runningIntervalStartHour;
|
|
|
|
if (int.TryParse(extendedSendMobileNotification.RunningIntervalEndHour, out int runningIntervalEndHour))
|
|
{
|
|
if (runningIntervalEndHour >= runningIntervalStartHour && runningIntervalEndHour < 24)
|
|
{
|
|
RunningIntervalEndHour = runningIntervalEndHour;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class SendErtekelesNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendErtekelesNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendErtekelesNotification, config.SendErtekelesNotification) { }
|
|
}
|
|
|
|
public class SendHazifeladatNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendHazifeladatNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendHazifeladatNotification, config.SendHazifeladatNotification) { }
|
|
}
|
|
|
|
public class SendRendszerUzenetNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendRendszerUzenetNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendRendszerUzenetNotification, config.SendRendszerUzenetNotification) { }
|
|
}
|
|
|
|
public class SendMulasztasNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendMulasztasNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendMulasztasNotification, config.SendMulasztasNotification) { }
|
|
}
|
|
|
|
public class SendBejelentettSzamonkeresNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendBejelentettSzamonkeresNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendBejelentettSzamonkeresNotification, config.SendBejelentettSzamonkeresNotification) { }
|
|
}
|
|
|
|
public class SendFeljegyzesNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendFeljegyzesNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendFeljegyzesNotification, config.SendFeljegyzesNotification) { }
|
|
}
|
|
|
|
public class SendNemNaplozottTanorakMailFeature : IntervalFeatureBase
|
|
{
|
|
public SendNemNaplozottTanorakMailFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendNemNaplozottTanorakMail, config.SendNemNaplozottTanorakMail) { }
|
|
}
|
|
|
|
public class SendKozelgoFogadooraMailFeature : FeatureBase
|
|
{
|
|
public SendKozelgoFogadooraMailFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendKozelgoFogadooraMail) { }
|
|
}
|
|
|
|
public class SendOrarendValtozasNotificationFeature : IntervalFeatureBase
|
|
{
|
|
public SendOrarendValtozasNotificationFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SendOrarendValtozasNotification, config.SendOrarendValtozasNotification) { }
|
|
}
|
|
|
|
public class MkbBankszamlaIgenylesFeature : FeatureBase
|
|
{
|
|
public MkbBankszamlaIgenylesFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.MkbBankszamlaIgenyles) { }
|
|
}
|
|
|
|
public class OtpBankszamlaIgenylesFeature : FeatureBase
|
|
{
|
|
public OtpBankszamlaIgenylesFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.OtpBankszamlaIgenyles) { }
|
|
}
|
|
|
|
public class sapSyncFeature : FeatureBase
|
|
{
|
|
public sapSyncFeature(FeatureConfigurationSection config) : base(config, Constants.FeatureName.SAPSync) { }
|
|
}
|
|
}
|