public string Reserver(string idAgence, string mdpAgence, int numOffre, string nom, DateTime dA, DateTime dD, int nbPers, string prenom, string numCarte)
        {
            Agence a = listeAgences[idAgence];


            if (a != null && a.motDePasse == mdpAgence)
            {
                Dictionary <int, Chambre> d = new Dictionary <int, Chambre>();

                int numero = 0;
                foreach (Hotel h in listHotel)
                {
                    foreach (Chambre c in h.getChambresDispo(nbPers, dA, dD))
                    {
                        numero++;
                        d.Add(numero, c);
                    }
                }
                listeAgences[idAgence].offres = d;



                Chambre ch = listeAgences[idAgence].offres[numOffre];

                if (ch.getDisponibilite(dA, dD))
                {
                    string idReserv = numOffre + ch.hotel.nomHotel + ch.num + dA.Day + dA.Month;
                    ch.reservations.Add(idReserv, new Reservation(new Client(nom, prenom, numCarte), dA, dD));
                    return(idReserv);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return("Compte Agence Incorrecte");
            }
        }
Beispiel #2
0
 public void AddChambre(Chambre c)
 {
     this.chambres.Add(c);
     c.hotel = this;
 }