Exemple #1
0
 protected abstract Reservatie MaakReservatieObject(Gebruiker gebruiker, Materiaal mat, string startdatum, int aantal, string[] dagen = null);
Exemple #2
0
        public int GeefAantalBeschikbaar(DateTime startDatum, DateTime eindDatum, IList <DateTime> dagen, Gebruiker gebruiker)
        {
            int aantal = AantalInCatalogus;

            if (gebruiker is Lector && dagen != null)
            {
                foreach (var dag in dagen)
                {
                    IEnumerable <Reservatie> overschijvendeReservaties = Reservaties.Where(r => r.GeblokkeerdeDagen.Select(d => d.Datum).Contains(dag)).ToList();
                    int aantalGereserveerd = overschijvendeReservaties.Sum(r => r.AantalGereserveerd);
                    aantal = Math.Min(aantal, AantalInCatalogus - aantalGereserveerd);
                }
            }
            else if (gebruiker is Student)
            {
                aantal = AantalInCatalogus -
                         Reservaties.Where(r => r.KanOverschrijvenMetReservatie(startDatum, eindDatum) &&
                                           (r.ReservatieState is Geblokkeerd || r.ReservatieState is Gereserveerd))
                         .Sum(r => r.AantalGereserveerd);
            }
            return(aantal <= 0 ? 0 : aantal);
        }
Exemple #3
0
        protected override Reservatie MaakReservatieObject(Gebruiker gebruiker, Materiaal mat, string startdatum, int aantal, string[] dagen = null)
        {
            Reservatie reservatie = new BlokkeringLector(gebruiker, mat, startdatum, aantal, dagen);

            return(reservatie);
        }