Exemple #1
0
 public Booking(Customer Customer, Hotel Hotel, String At, int Duration, int RoomNr, int NumAdults, int NumChilds)
 {
     this.Customer = Customer;
     this.Hotel = Hotel;
     this.At = At;
     this.Duration = Duration;
     this.RoomNr = RoomNr;
     this.NumAdults = NumAdults;
     this.NumChilds = NumChilds;
 }
        public Hotel HotelInfo(int hid)
        {
            Hotel h = null;
            SqlCommand command = new SqlCommand("SELECT hid, name, adr FROM hotel WHERE hid = @hid", con);
            command.Parameters.AddWithValue("@hid", hid);
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                h = new Hotel(
                        (int)reader[0],
                        (String)reader[1],
                        (String)reader[2]
                      );
            }

            reader.Close();
            return h;
        }