private void cHotelMenuItem_Click(object sender, RoutedEventArgs e) { cHotel ch = new cHotel(); ch.Show(); }
public static List<cHotel> GetHotelDataSource(List<HotelOrderItem> HotelOrderItems) { List<cHotelNameCheckIn> hotelNameCheckIns = new List<cHotelNameCheckIn>(); for (int j = 0; j < HotelOrderItems.Count; j++) { cHotelNameCheckIn hc = new cHotelNameCheckIn(); hc.CheckIn = HotelOrderItems[j].Profile.CheckInDate; hc.HotelName = HotelOrderItems[j].Room.Hotel.Name; hc.Hotel = HotelOrderItems[j].Room.Hotel; if (!hotelNameCheckIns.Contains(hc)) hotelNameCheckIns.Add(hc); } List<cHotel> hotelDataSources = new List<cHotel>(); for (int hotelIndex = 0; hotelIndex < hotelNameCheckIns.Count; hotelIndex++) { cHotel hotelDataSource = new cHotel(); cHotelNameCheckIn hc = hotelNameCheckIns[hotelIndex]; hotelDataSource.Hotel = hc.Hotel; hotelDataSource.RoomTypes = FilteHotelOrderItemsByHotelName(HotelOrderItems, hc.HotelName); hotelDataSource.RoomTypes = FilteHotelOrderItemsByCheckIn(HotelOrderItems, hc.CheckIn); hotelDataSource.CheckIn = hotelDataSource.RoomTypes[0].Profile.CheckInDate; hotelDataSource.CheckOut = hotelDataSource.RoomTypes[0].Profile.CheckOutDate; foreach (HotelOrderItem roomType in hotelDataSource.RoomTypes) hotelDataSource.TotalPrice += roomType.TotalPrice; hotelDataSources.Add(hotelDataSource); } return hotelDataSources; }