Ejemplo n.º 1
0
        public void DoValidateRelationWithContract(EmployeeRelation entity)
        {
            ListEmployeeContracts contracts = new ListEmployeeContracts(ServerEnvironment.EmployeeContractService, entity.EmployeeID);
            UnbreakContract       validator = contracts.GetUnbreakContracts();

            if (!validator.CheckRelation(entity))
            {
                throw new ValidationException("ErrorRelationOutsideContractTime", null);
            }
        }
Ejemplo n.º 2
0
        private void DoValidate(EmployeeRelation newEmployeeRelation)
        {
            // Validation: EmployeeRelation should be withing Employee's contract time.

            ListEmployeeContracts contracts = new ListEmployeeContracts(_contractservice, _employee.ID);
            UnbreakContract       validator = contracts.GetUnbreakContracts();

            if (!validator.CheckRelation(newEmployeeRelation))
            {
                throw new ValidationException("ErrorRelationOutsideContractTime", null);
            }

            //if (newEmployeeRelation.BeginTime < _employee.ContractBegin || newEmployeeRelation.EndTime > _employee.ContractEnd)
            //{
            //    throw new ValidationException("ErrorRelationOutsideContractTime", null);
            //}
            // Validation: Is Time planning is already defined within time range of new relation, ValidationExceptin is thrown
            if (_employeeDao.HasWorkingOrAbsenceTime(_employee.ID, newEmployeeRelation.BeginTime, newEmployeeRelation.EndTime))
            {
                throw new ValidationException("ErrorTimePlanningAlreadyDefined", null);
            }
        }