コード例 #1
0
        public bool Valideer(int leeftijd, IInrichtingProvider inrichting, IEnumerable <Dienst> diensten, IATWLog log)
        {
            log.StartATWRegel(NAME);

            int?maximaleArbeidstijd = inrichting.GetWaarde <int>("MaximaleArbeidstijd", leeftijd);

            if (!maximaleArbeidstijd.HasValue)
            {
                throw new InvalidOperationException("Geen waarde ingericht voor instelling 'MaximaleArbeidsTijd");
            }

            bool result         = true;
            var  dienstenPerDag = diensten.GroupBy(dienst => dienst.DagVanDeWeek);

            foreach (var dag in dienstenPerDag)
            {
                var duur = TimeSpan.FromSeconds(dag.Sum(dienst => dienst.Duur.TotalSeconds));
                if (duur.TotalHours > maximaleArbeidstijd)
                {
                    result = false;
                    break;
                }
            }

            log.EndATWRegel(NAME);
            return(result);
        }
コード例 #2
0
        public bool ValideerATW(int leeftijd, IInrichtingProvider inrichting, IEnumerable <Dienst> diensten, IATWLog log)
        {
            bool result = true;

            IATWRegel maximaleArbeidstijdRegel = new MaximaleArbeidstijdRegel();

            result = maximaleArbeidstijdRegel.Valideer(leeftijd, inrichting, diensten, log);

            IATWRegel verplichteRustperiodeRegel = new VerplichteRustperiodeRegel();

            result = result && verplichteRustperiodeRegel.Valideer(leeftijd, inrichting, diensten, log);

            return(result);
        }
コード例 #3
0
        public bool Valideer(int leeftijd, IInrichtingProvider inrichting, IEnumerable <Dienst> diensten, IATWLog log)
        {
            log.StartATWRegel(NAME);
            bool valid = false;
            var  verplichteRustperiode = inrichting.GetWaarde <(TimeSpan begintTijd, TimeSpan eindTijd)>("NietWerkbareTijden", leeftijd);

            if (verplichteRustperiode.HasValue)
            {
                valid = !diensten.Any(dienst => dienst.Eindtijd >= verplichteRustperiode.Value.begintTijd || dienst.StartTijd >= verplichteRustperiode.Value.eindTijd);
            }
            else
            {
                valid = true;
            }
            log.EndATWRegel(NAME);
            return(valid);
        }
コード例 #4
0
 public InrichtingSteps(InrichtingProvider inrichtingProvider)
 {
     this.inrichtingProvider = inrichtingProvider;
 }