Exemplo n.º 1
0
        internal Comparateur Comparer()
        {
            foreach (OffreAgence offre in Offres)
            {
                Console.WriteLine(offre.HotelId + " " + offre.ChambreId);
                OffreComparee offreComparee = trouverOffreComparee(offre.HotelId, offre.ChambreId);

                if (offreComparee != null)
                {
                    offreComparee.ComparatifPrix[offre.NomAgence] = offre.Prix;
                }
                else
                {
                    offreComparee = new OffreComparee
                    {
                        NomHotel      = offre.NomHotel,
                        VilleHotel    = offre.VilleHotel,
                        AdresseHotel  = offre.AdresseHotel,
                        NombreEtoiles = offre.NombreEtoiles,
                        NombreDeLits  = offre.NombreDeLits,
                        HotelId       = offre.HotelId,
                        ChambreId     = offre.ChambreId
                    };

                    offreComparee.ComparatifPrix[offre.NomAgence] = offre.Prix;

                    Resultat.Add(offreComparee);
                }
            }

            return(this);
        }
Exemplo n.º 2
0
        private void AfficherResultat(OffreComparee offreComparee)
        {
            Console.WriteLine("Nom : " + offreComparee.NomHotel);
            Console.WriteLine("Ville : " + offreComparee.VilleHotel);
            Console.WriteLine("Adresse : " + offreComparee.AdresseHotel);
            Console.WriteLine("Nombre d'étoiles : " + offreComparee.NombreEtoiles);
            Console.WriteLine("Nombre de lits : " + offreComparee.NombreDeLits);
            Console.WriteLine("Prix : ");
            foreach (KeyValuePair <string, double> entry in offreComparee.ComparatifPrix)
            {
                Console.WriteLine("... " + entry.Key + " : " + entry.Value);
            }

            Console.WriteLine();
        }