protected override Task <IRuleResult> OnValidateAsync(IEmployeeEntity item)
        {
            IRuleResult returnValue = new RuleResultTemplate();

            if (!item.RecentWarnings)
            {
                returnValue.Passed       = true;
                returnValue.ErrorMessage = null;
            }
            else
            {
                returnValue.Passed       = false;
                returnValue.ErrorMessage = "The employee has recent warnings.";
            }

            return(Task.FromResult(returnValue));
        }
Пример #2
0
        protected override Task <IRuleResult> OnValidateAsync(IEmployeeEntity item)
        {
            IRuleResult returnValue = new RuleResultTemplate();

            if (DateTime.Now.Subtract(item.StartDate).TotalDays >= 30)
            {
                returnValue.Passed       = true;
                returnValue.ErrorMessage = null;
            }
            else
            {
                returnValue.Passed       = false;
                returnValue.ErrorMessage = "The employee has been with the company less than 30 days.";
            }

            return(Task.FromResult(returnValue));
        }
        protected override Task <IRuleResult> OnValidateAsync(IEmployeeEntity item)
        {
            IRuleResult returnValue = new RuleResultTemplate();

            if (!item.LastPromtion.HasValue || (item.LastPromtion.HasValue && DateTime.Now.Subtract(item.LastPromtion.Value).TotalDays > 60))
            {
                returnValue.Passed       = true;
                returnValue.ErrorMessage = null;
            }
            else
            {
                returnValue.Passed       = false;
                returnValue.ErrorMessage = "The employee has been promoted within the last year.";
            }

            return(Task.FromResult(returnValue));
        }