Example #1
0
        private void gridControl1_Click(object sender, EventArgs e)
        {
            bookingInformation1.Visible = true;
            newBooking1.Visible         = false;
            if (gridView1.GetFocusedRowCellValue("bookingID") != null)
            {
                string      id     = gridView1.GetFocusedRowCellValue("bookingID").ToString();
                string      typeid = gridView1.GetFocusedRowCellValue("bookingTypeID").ToString();
                BookingBUS  bBus   = new BookingBUS();
                GuestBUS    gBUS   = new GuestBUS();
                RoomBUS     rBUS   = new RoomBUS();
                DTO.Booking b      = bBus.getBookingByID(id, typeid);
                Guest       g      = gBUS.getGuestByID(b.GuestID);
                Room        r      = rBUS.getRoomByID(b.RoomID);
                RoomType    rt     = rBUS.getRoomTypeByID(r.RoomType);

                int      bookID    = b.BookingID;
                string   guestID   = b.GuestID;
                string   typeID    = r.RoomType;
                String   guestName = g.FullName.Trim();
                String   roomID    = b.RoomID;
                int      status    = r.Status;
                string   bookType  = b.BookingTypeID.Trim();
                DateTime checkIn   = b.CheckIn;
                DateTime checkOut  = b.CheckOut;
                int      price     = rt.Price;
                string   roomType  = r.RoomType;


                editGuestInfo edit = new editGuestInfo();
                edit = editGuestInfo1;
                edit.guestNameTextBox.Text = guestName;
                edit.guestIdTextBox.Text   = guestID;
                edit.dateOfBirth.Text      = g.DOB.ToString();
                edit.nationTextBox.Text    = g.Nationality;

                BookingInformation bookInfo = new BookingInformation();

                bookInfo = bookingInformation1;
                bookInfo.daysLabel.Text        = bookInfo.getDays(checkIn, checkOut);
                bookInfo.bookID.Text           = bookID.ToString();
                bookInfo.nationTB.Text         = g.Nationality;
                bookInfo.roomTypeComboBox.Text = typeID;


                bookInfo.guestNameLabel.Text = guestName;
                bookInfo.roomIdLabel.Text    = "Room" + roomID;

                if (bookType.Equals("001"))
                {
                    bookInfo.bookingTypeCombobox.Text = "AGODA";
                }
                else if (bookType.Equals("002"))
                {
                    bookInfo.bookingTypeCombobox.Text = "BOOKING";
                }
                else
                {
                    bookInfo.bookingTypeCombobox.Text = "FREE";
                }
                //bookInfo.bookingTypeCombobox.Text

                switch (status)
                {
                case 1:
                    bookInfo.statusComboBox.Text = "Reserved";
                    break;

                case 2:
                    bookInfo.statusComboBox.Text = "Occupied";
                    break;

                case 3:
                    bookInfo.statusComboBox.Text = "Checked-out";
                    break;

                default:
                    bookInfo.statusComboBox.Text = "Available";
                    break;
                }

                bookInfo.fromDateLabel.Text = checkIn.ToString("dd.MM.yyyy");
                bookInfo.toDayLabel.Text    = checkOut.ToString("dd.MM.yyyy");
                PayBUS pBUS = new PayBUS();
                bookInfo.priceLabel.Text = pBUS.getTotalPrice(b).ToString();
            }
        }