private void UpdateListBoxHostelRoom() { hotel_room_listBox.BeginUpdate(); int mxidhr = HotelRoomController.Maxid(); if (mxidhr == 0) { return; } else { for (int i = 1; i < mxidhr + 1; i++) { HotelRoom room = HotelRoomController.GetHotelRoom(i); if (room.date_reservation == null) { hotel_room_listBox.Items.Add("Номер комнаты:" + i.ToString() + " | Цена:" + room.room_price.ToString() + " | Тип:" + room.name_room.ToString() + " | СВОБОДНО"); } else { hotel_room_listBox.Items.Add("Номер комнаты:" + i.ToString() + " | Цена:" + room.room_price.ToString() + " | Тип:" + room.name_room.ToString() + " | Забронировано c: " + room.date_reservation + " | До: " + room.date_end_reservation); } } hotel_room_listBox.EndUpdate(); } }
public void Bookupdate() { HotelRoom room = HotelRoomController.GetHotelRoom(hotel_room_listBox.SelectedIndex + 1); if (room == null) { return; } Price_day_label.Text = "Цена за день:" + Convert.ToString(room.room_price); Price_week_label.Text = "Цена за неделю:" + Convert.ToString(room.room_price * 6); }
private void day_textBox_TextChanged(object sender, EventArgs e) { HotelRoom room = HotelRoomController.GetHotelRoom(hotel_room_listBox.SelectedIndex + 1); if (room == null) { return; } if (day_textBox.Text == "") { Price_label.Text = ""; } else { Price_label.Text = "Итоговая цена:" + ((int.Parse(day_textBox.Text) / 7 * room.room_price * 6 + int.Parse(day_textBox.Text) % 7 * room.room_price).ToString()); } }