public string GetHotelName() { dezerialize des = new dezerialize(); List <HotelsList> hotels = des.dezerializeHotels(); foreach (HotelsList H in hotels) { if (H.id == this.hotelID) { return(H.name); } } return(null); }
private void listBox1_Click(object sender, EventArgs e) { listBox2.Items.Clear(); String hotelId = hotelID(); dezerialize a = new dezerialize(); List <HotelsList> hotels = a.dezerializeHotels(); foreach (HotelsList r in hotels) { if (r.id == hotelId) { for (int i = 0; i < r.RoomTypes.Count; i++) { listBox2.Items.Add(r.RoomTypes[i].id + " | Price per night: " + r.RoomTypes[i].rate); } } } }
private void button1_Click(object sender, EventArgs e) { bool foundR = false; String reservationid = reservationBox.Text.Trim(); dezerialize d = new dezerialize(); reservations = d.dezerializeReservation(); if (reservations == null) { found.Text = "Reservation \n not Found"; Hotellbl.Text = ""; costlbl.Text = ""; numNightslbl.Text = ""; startDatelbl.Text = "";; } else { foreach (ReservationType reserv in reservations) { if (reserv.reservationId.Equals(reservationid)) { String year = reserv.startDate.Substring(0, 4); String month = reserv.startDate.Substring(4, 2); String day = reserv.startDate.Substring(6, 2); Hotellbl.Text = HotelFactory.GetHotelName(reserv.hotelId); costlbl.Text = "$" + reserv.cost.ToString() + ".00"; numNightslbl.Text = reserv.numDays.ToString(); startDatelbl.Text = month + "/" + day + "/" + year; found.Text = "Reservation Found"; foundR = true; break; } } } if (!foundR) { found.Text = "Reservation \n not Found"; Hotellbl.Text = ""; costlbl.Text = ""; numNightslbl.Text = ""; startDatelbl.Text = ""; } }
private string hotelRoom() { dezerialize a = new dezerialize(); List <RoomTypes> rooms = a.dezerializeRoomTypes(); string roomType = listBox2.GetItemText(listBox2.SelectedItem); roomType = roomType.Substring(0, 12); Console.Write(roomType); foreach (RoomTypes r in rooms) { String mean = r.name.Substring(0, 12); if (mean == roomType) { return(r.id); } } return(null); }