Beispiel #1
0
        private void ChangeBooking_Load(object sender, EventArgs e)
        {
            var Data     = new GetData();
            var Customer = new SearchCustomer();
            var Name     = Customer.FindACustomer(Customer_ID);

            ExtraBedBox.Checked = false;
            NameLabel.Text      = Name.FullName.ToString();


            var BookingInfo = Data.GetBooking(_ID);
            var RoomInfo    = Data.GetRoom(int.Parse(BookingInfo.RoomID.ToString()));

            RoomNumber.Text += int.Parse(RoomInfo.RoomID.ToString());

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

            List <BookRoom.Beds> BedList = new List <BookRoom.Beds>();

            if (RoomInfo.RoomType == "2" && BookingInfo.Guests > 2)
            {
                BedList             = Data.GetBeds(RoomInfo.Beds + 1);
                ExtraBedBox.Checked = true;
            }
            else
            {
                BedList = Data.GetBeds(RoomInfo.Beds);
            }


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

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


            GuestsBox.DisplayMember = "Number";
            GuestsBox.ValueMember   = "Number";
            GuestsBox.DataSource    = BedList;
            GuestsBox.SelectedValue = BookingInfo.Guests;

            dateTimePicker1.Value = BookingInfo.DateStart;
            dateTimePicker2.Value = BookingInfo.DateEnd;
        }
Beispiel #2
0
        public void CreateInvoice(Booking B)
        {
            var     Get   = new GetData();
            Room    R     = Get.GetRoom(int.Parse(B.RoomID.ToString()));
            decimal Price = decimal.Parse(((B.DateEnd - B.DateStart).TotalDays * R.Price).ToString());
            var     I     = new Invoice();

            I.BookingID  = B.BookingID;
            I.Complete   = 0;
            I.BookedDate = DateTime.Now;
            I.TotalPrice = Price;

            using (var db = new HotelCaliforniaEntities())
            {
                db.Invoices.Add(I);
                db.SaveChanges();
            }
        }
Beispiel #3
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.";
            }
        }
Beispiel #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;
        }