Пример #1
0
        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();
            }
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     HotelRoomController.AddHotelroom(textBox5.Text, null, null, null, Int32.Parse(textBox6.Text));
     UpdateAdmiListHotelALL();
     hotel_room_listBox.Items.Clear();
     UpdateListBoxHostelRoom();
 }
Пример #3
0
        private void book_button_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(dateTimePicker1.Text) || String.IsNullOrWhiteSpace(day_textBox.Text))
            {
                MessageBox.Show("Данные введены не коректно.");
                return;
            }
            if (hotel_room_listBox.SelectedItems.Count == 0)
            {
                MessageBox.Show("Выберете номер.");
                return;
            }

            if (HotelRoomController.GetHotelRoom(hotel_room_listBox.SelectedIndex + 1).date_reservation != null)
            {
                MessageBox.Show("Номер уже забронирован.");
                return;
            }

            if (HotelRoomController.PresenceOfTheUser() == false)
            {
                MessageBox.Show("Вы можете забронировать лишь 1 номер.");
                return;
            }
            else
            {
                MessageBox.Show("Чек на оплату номера, выслан вам на почту.");
                Book();
                hotel_room_listBox.Items.Clear();
                UpdateListBoxHostelRoom();
            }
            UpdateUserProfileRoom();
        }
Пример #4
0
        private void Book()
        {
            DateTime date = dateTimePicker1.Value.Date;

            HotelRoomController.SelectRoom.id_user_book     = UserController.AuthorizationUser.ID;
            HotelRoomController.SelectRoom.date_reservation = date.ToString("dd/M/yyyy");

            HotelRoomController.SelectRoom.date_end_reservation = (date.AddDays(Convert.ToDouble(day_textBox.Text))).ToString("dd/M/yyyy");
            HotelRoomController.Update(Convert.ToInt32(hotel_room_listBox.SelectedIndex) + 1, HotelRoomController.SelectRoom);
        }
Пример #5
0
        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);
        }
Пример #6
0
        private void UpdateUserProfileRoom()
        {
            var room = HotelRoomController.GetHotelRoomFromIDUser(UserController.AuthorizationUser.ID);

            if (room == null || room.date_reservation == null)
            {
                return;
            }

            label13.Text = "Ваша бронь: Номер комнаты:" +
                           room.ID.ToString() + " | Цена:" +
                           room.room_price.ToString() + " | Тип:" +
                           room.name_room.ToString() + " | Забронировано c: " +
                           room.date_reservation + " | До: " + room.date_end_reservation;
        }
Пример #7
0
        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());
            }
        }