Пример #1
0
        private void ExtraBedBox_CheckedChanged(object sender, EventArgs e)
        {
            if (ExtraBedBox.Checked == true)
            {
                var         GetBeds = new GetData();
                List <Beds> BedList = GetBeds.GetBeds(BedsCount + 1);

                GuestsBox.DisplayMember = "Number";
                GuestsBox.ValueMember   = "Number";
                GuestsBox.DataSource    = BedList;
            }
            else
            {
                var         GetBeds = new GetData();
                List <Beds> BedList = GetBeds.GetBeds(BedsCount);

                GuestsBox.DisplayMember = "Number";
                GuestsBox.ValueMember   = "Number";
                GuestsBox.DataSource    = BedList;
            }
        }
Пример #2
0
        private void SaveChangesButton_Click(object sender, EventArgs e)
        {
            var Get = new GetData();
            var Add = new AdjustData();

            Booking B = Get.GetBooking(_ID);
            Room    R = Get.GetRoom(int.Parse(B.RoomID.ToString()));

            if (Get.CheckRoomAvailable(Customer_ID, R, dateTimePicker1.Value, dateTimePicker2.Value))
            {
                B.DateStart = dateTimePicker1.Value;
                B.DateEnd   = dateTimePicker2.Value;
                B.Guests    = int.Parse(GuestsBox.SelectedValue.ToString());

                Add.UpdateBooking(B);
                this.Close();
            }
            else
            {
                NoRoomLabel.Text = "Room not available.";
            }
        }
Пример #3
0
        private void DeleteCustomerButton_Click(object sender, EventArgs e)
        {
            if (CustomerBox.SelectedValue == null)
            {
                return;
            }
            var      Delete = new AdjustData();
            var      Get    = new GetData();
            var      Search = new SearchCustomer();
            Customer C      = Search.FindACustomer(int.Parse(CustomerBox.SelectedValue.ToString()));
            var      List   = Get.GetBookings(C);

            if (List.Count > 0)
            {
                MessageBox.Show("Cannot Delete: Active Booking");
            }
            else
            {
                CustomerBox.ClearSelected();
                CustomerBox.DataSource = null;
                Delete.DeleteCustomer(C);
            }
        }
Пример #4
0
        private void RoomBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var Data = new GetData();

            ExtraBedBox.Checked = false;

            var RoomInfo = Data.GetRoom(int.Parse(RoomBox.SelectedValue.ToString()));

            if (RoomInfo.RoomType == "1")
            {
                RoomType.Text = RoomTypeOG + "Single";
            }
            else if (RoomInfo.RoomType == "2")
            {
                RoomType.Text = RoomTypeOG + "Double";
            }

            RoomPrice.Text = RoomPriceOG + RoomInfo.Price;
            RoomSize.Text  = RoomSizeOG + RoomInfo.Size;

            if (RoomInfo.Size < 35)
            {
                ExtraBedBox.Enabled = false;
            }
            else
            {
                ExtraBedBox.Enabled = true;
            }
            BedsCount = RoomInfo.Beds;
            List <Beds> BedList = new List <Beds>();

            BedList = Data.GetBeds(RoomInfo.Beds);

            GuestsBox.DisplayMember = "Number";
            GuestsBox.ValueMember   = "Number";
            GuestsBox.DataSource    = BedList;
        }