Exemplo n.º 1
0
        public DriverDuty(string driverDutyCode, List<WorkBlock> listWorkBlocks)
        {
            if (StringValidator.isStringEmptyOrNull(driverDutyCode))
            {
                throw new BusinessRuleValidationException(driverDutyCode + " invalid: The driver duty code can't be null or empty");
            }


            if (listWorkBlocks.Count == 0)
            {
                throw new BusinessRuleValidationException(listWorkBlocks + " invalid: The workblocks list can't be null or empty");
            }

            // list of workblocks are greather than 4 hours
            if (!checkIfWorkBlockIsGreatherThan8Hours(listWorkBlocks))
            {
                throw new BusinessRuleValidationException(listWorkBlocks + " invalid: The workblocks list doesn't respect all the rules ");
            }


            this.Id = new DriverDutyId(Guid.NewGuid());
            this.driverDutyCode = new DriverDutyCode(driverDutyCode);
            this.listWorkBlocks = listWorkBlocks;

        }
Exemplo n.º 2
0
 public override bool Equals(object obj)
 {
     if ((obj == null) || !this.GetType().Equals(obj.GetType()))
     {
         return(false);
     }
     else
     {
         DriverDutyCode driverDutyCode = (DriverDutyCode)obj;
         return(this.driverDutyCode.Equals(driverDutyCode.driverDutyCode));
     }
 }