Exemplo n.º 1
0
        protected override bool ValidateRule(IRuleValidationObject validationObject)
        {
            var valObject = (ShiftAssignRuleValidationObject)validationObject;

            return(!(valObject.Shift.ShiftType == ShiftType.Afternoon && valObject.Engineer.AssignedShifts.Any(x =>
                                                                                                               x.ShiftType == ShiftType.Afternoon && x.Schedule.DayNo == (valObject.Shift.Schedule.DayNo - 1))));
        }
 public bool Validate(IRuleValidationObject validationObject)
 {
     if (!_validators.Any())
     {
         // No validators to validate , so return true
         return(true);
     }
     return(_validators.First().Validate(validationObject));
 }
Exemplo n.º 3
0
 public bool Validate(IRuleValidationObject validationObject)
 {
     if (ValidateRule(validationObject))
     {
         // If the current validator validates ok then pass
         // control to next validator in the chain to validate
         if (NextRuleValidator != null)
         {
             return(NextRuleValidator.Validate(validationObject));
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        protected override bool ValidateRule(IRuleValidationObject validationObject)
        {
            var valObject         = (ShiftAssignRuleValidationObject)validationObject;
            var currentShiftDayNo = valObject.Shift.Schedule.DayNo;

            if (valObject.Engineer.AssignedShifts.Count < 2)
            {
                return(true);
            }
            // Get all day no of current engineer's all assigned shifts
            var allDayNos = valObject.Engineer.AssignedShifts.Select(x => x.DayNo).OrderByDescending(x => x).ToList();

            // check if the current schedule will respect the two days exemption rule
            return(!(new[] { currentShiftDayNo - 1, currentShiftDayNo - 2 }.Contains(allDayNos[0]) ||
                     new[] { currentShiftDayNo - 2, currentShiftDayNo - 3 }.Contains(allDayNos[1])));
        }
        protected override bool ValidateRule(IRuleValidationObject validationObject)
        {
            var valObject = (ShiftAssignRuleValidationObject)validationObject;

            return(valObject.Engineer.AssignedShifts.All(x => x.Schedule.DayNo != valObject.Shift.Schedule.DayNo));
        }
Exemplo n.º 6
0
        protected override bool ValidateRule(IRuleValidationObject validationObject)
        {
            var valObject = (AggregatedScheduleValidationObject)validationObject;

            return(!valObject.Engineers.Any(x => x.FullDayShiftCount < 1));
        }
Exemplo n.º 7
0
 protected abstract bool ValidateRule(IRuleValidationObject validationObject);