kreta/Kreta.BusinessLogic/Classes/Validations/BasicValidations.cs
2024-03-13 00:33:46 +01:00

29 lines
808 B
C#

using Kreta.Core.Exceptions;
using Kreta.Resources;
namespace Kreta.BusinessLogic.Classes.Validations
{
public static class BasicValidations
{
public static void ValidateNonZeroFields(params int?[] fields)
{
foreach (var field in fields)
{
if (!field.HasValue || field <= 0)
{
throw new BlException(ErrorResource.PropertyCantBeZeroOrNULL);
}
}
}
public static void ValidateMustBeNullFields(params object[] fields)
{
foreach (var field in fields)
{
if (field != null)
{
throw new BlException(ErrorResource.PropertyMustBeNULL);
}
}
}
}
}