29 lines
808 B
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|