Esempio n. 1
0
 private void DGVXCheckOut_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int             rowIndex = e.RowIndex;
         DataGridViewRow row      = DGVXCheckOut.Rows[rowIndex];
         myCustomer.custCheckOutSelectedIdFromDGV = Convert.ToString(row.Cells[0].Value);
         bookingIDFK            = Convert.ToString(row.Cells[1].Value);
         lblItemCheckOutID.Text = "ID " + Convert.ToString(row.Cells[0].Value);
         // Pass data from datagridview to invoice class
         Invoices.custIDFK          = Convert.ToString(row.Cells[0].Value);
         Invoices.bookingReference  = Convert.ToString(row.Cells[1].Value);
         Invoices.firstDateOccupied = Invoices.GetCheckedInDate(Convert.ToString(row.Cells[0].Value));
         Invoices.lastDateOccupied  = DateTime.Today;
         Invoices.name              = Convert.ToString(row.Cells[2].Value);
         Invoices.roomBooked_Type   = myRoom.GetCheckedOutRoomType(Convert.ToString(row.Cells[1].Value));
         Invoices.roomBooked_ID     = Convert.ToString(row.Cells[3].Value);
         Invoices.balance_beforeTax = Invoices.GetCheckedOutBalance(Convert.ToString(row.Cells[0].Value));
         Invoices.totalDays         = AllBookings.Num_BookingDays();
     }
     catch (Exception)
     {
         MessageBox.Show("Please select customer to check out !");
     }
 }
        private void LoadAllBookingCustomersNotYetCheckedIn()
        {
            AllBookings.dgvBookingCustomersNotYetCheckIn = DGVAllbookedCustomers;

            DGVAllbookedCustomers.BackgroundColor = Color.Goldenrod;
            AllBookings.BookingCustomersNotYetCheckIn();
        }
        private void btnFindRoom_Click(object sender, EventArgs e)
        {
            string            message = "Booking to-date must be greater than booking from-date !";
            string            caption = "Error";
            MessageBoxButtons button  = MessageBoxButtons.OK;

            AllBookings.bookedFrom = dateTPBookFrom.Value;
            AllBookings.bookedTo   = dateTPBookTo.Value;

            // Testing to find days diff
            this.Text = Convert.ToString(AllBookings.Num_BookingDays());

            if (dateTPBookTo.Value.ToShortDateString() == dateTPBookFrom.Value.ToShortDateString())
            {
                MessageBox.Show(message, caption, button);
            }
            else
            {
                int differentDays = dateTPBookTo.Value.Day - dateTPBookFrom.Value.Day;
                AllAvailabeRooms();
                // Set isbtnCreateCustomerClicked to false
                AllBookings.isbtnCreateCustomerClicked = false;
                txtNumOfFreeRooms.Text = Convert.ToString(AllBookings.TotalNumberFreeRooms());
            }
        }
        private void FrmNewReservation_Load(object sender, EventArgs e)
        {
            //Disable some buttons
            btnCreateNewCustomer.Enabled = false;
            btnCreateReservation.Enabled = false;
            // Get all room types from the table
            HashSet <string> room_types = new HashSet <string>();

            room_types = AllBookings.GetRoomTypes();
            // Add room types into the combobox
            foreach (var type in room_types)
            {
                cmbRoomTypes.Items.Add(type);
            }
        }
Esempio n. 5
0
        private void btnXCancelReservatino_Click(object sender, EventArgs e)
        {
            string            message = "Do you want to cancel the reservation?";
            string            caption = "Confirmation!";
            MessageBoxButtons button  = MessageBoxButtons.OKCancel;
            DialogResult      result;

            if (strCustID == "")
            {
                MessageBox.Show("No check in customer !");
            }
            else
            {
                if (strcheckIn == "")
                {
                    result = MessageBox.Show(message, caption, button);
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        myCustomer.DeleteCustomer(bookingSelectedID);
                        AllBookings.DeleteBooking(bookingSelectedID);
                        MessageBox.Show("Booking has been canceled !");
                        LoadBookedCustomers();
                    }
                }
                else
                {
                    MessageBox.Show("Cannot cancel the reservation.The customer is currently staying in the hotel.");
                }
            }
            // Only cancel the booking if customer hasnt yet checked in
            //if (strcheckIn == "")
            //{
            //    result = MessageBox.Show(message, caption, button);
            //    if (result == System.Windows.Forms.DialogResult.OK)
            //    {
            //        myCustomer.DeleteCustomer(bookingSelectedID);
            //        AllBookings.DeleteBooking(bookingSelectedID);
            //        LoadBookedCustomers();
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("Cannot cancel the reservation.The customer is currently staying in the hotel.");
            //}
        }
Esempio n. 6
0
        private void btnXCheckOut_Click(object sender, EventArgs e)
        {
            string            message = "Do you want to check out ?";
            string            caption = "Confirmation!";
            MessageBoxButtons button  = MessageBoxButtons.OKCancel;
            DialogResult      result;

            result = MessageBox.Show(message, caption, button);
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                myCustomer.UpdateAfterCheckedOut();
                AllBookings.DeleteBooking(bookingIDFK);
                LoadCustomersToCheckOut();
                // Open Invoice
                FrmInvoice frmInvoice = new FrmInvoice();
                frmInvoice.ShowDialog(this);
            }
        }
Esempio n. 7
0
 private void btnCreateCustomer1_Click(object sender, EventArgs e)
 {
     isClicked                 = true;
     myCustomer.customerID     = txtGuestID.Text;
     myCustomer.bookedIDFK     = txtBookingIDFK.Text;
     myCustomer.firstName      = txtFname.Text;
     myCustomer.lastName       = txtLname.Text;
     myCustomer.address        = txtAddress.Text;
     myCustomer.phone          = txtPhone.Text;
     myCustomer.licence        = txtDriverLicense.Text;
     myCustomer.gender         = txtGender.Text;
     myCustomer.city           = txtCity.Text;
     myCustomer.country        = txtCountry.Text;
     myCustomer.bookedFromDate = AllBookings.bookedFrom;
     myCustomer.bookedToDate   = AllBookings.bookedTo;
     myCustomer.balance        = AllBookings.BookingCost(AllBookings.roomType);
     myCustomer.InsertCustomer();
     MessageBox.Show("CustomerID " + txtGuestID.Text + " is added.");
 }
Esempio n. 8
0
        //-------------------------------------------------------------------------------------------------------
        private void LoadRoomStatus()
        {
            int           i = 0;
            var           RoomDictionary  = new Dictionary <string, int>();
            List <string> All_Rooms       = new List <string>();
            List <string> Available_Rooms = new List <string>();

            Available_Rooms = AllBookings.GetTodayFreeRoomIDs();
            //Available_Rooms = AllBookings.GetFreeRoomIDs();
            All_Rooms = AllBookings.AllRoomIDs;

            // Add all available rooms into a dictionary
            foreach (var room in Available_Rooms)
            {
                RoomDictionary.Add(room.ToString(), 1);
            }
            //foreach (var item in RoomDictionary.Keys)
            //{
            // MessageBox.Show("Room are" + item);
            // }
            // Iterate through all Rooms and set backcolor to greed if free for today
            // And set backcolor to red if it is being occupied.
            foreach (var id in All_Rooms)
            {
                if (RoomDictionary.ContainsKey(id))
                {
                    // MessageBox.Show("id is " + id);
                    array_buttons[i].BackColor = Color.Green;
                    array_buttons[i].Text      = id;
                }
                else
                {
                    array_buttons[i].BackColor = Color.Red;
                    array_buttons[i].Text      = id;
                }
                i++;
            }
        }
        private void btnCreateReservation_Click(object sender, EventArgs e)
        {
            Boolean           insertedSuccess;
            string            message = "Please create new customer first!";
            string            caption = "Reservation Failed";
            MessageBoxButtons button  = MessageBoxButtons.OK;

            if (AllBookings.isbtnCreateCustomerClicked == true)
            {
                //AllBookings.roomType = Convert.ToString(cmbRoomTypes.SelectedItem);
                AllBookings.bookedFrom = dateTPBookFrom.Value;
                AllBookings.bookedTo   = dateTPBookTo.Value;
                AllBookings.roomCost   = AllBookings.BookingCost(room_Type);
                insertedSuccess        = AllBookings.InsertBooking();
                if (insertedSuccess == true)
                {
                    AllBookings.isbtnCreateCustomerClicked = false; // Reset button create customer to false
                    txtBookingReference.Text  = "";
                    txtNumOfGuest.Text        = "";
                    txtNumOfFreeRooms.Text    = "";
                    cmbRoomTypes.SelectedItem = "";
                    MessageBox.Show("Booking Reference " + txtBookingReference.Text + " is added.");
                }
                else
                {
                    AllBookings.isbtnCreateCustomerClicked = false; // Reset button create customer to false
                    txtBookingReference.Text  = "";
                    txtNumOfGuest.Text        = "";
                    txtNumOfFreeRooms.Text    = "";
                    cmbRoomTypes.SelectedItem = "";
                    MessageBox.Show("Insert booking failed");
                }
            }
            else
            {
                MessageBox.Show(message, caption, button);
            }
        }
        private void btnXDeleteReservation_Click(object sender, EventArgs e)
        {
            string            message = "Do you want to cancel the booking?";
            string            caption = "Confirmation!";
            MessageBoxButtons button  = MessageBoxButtons.OKCancel;
            DialogResult      result;

            if (strCustID == "")
            {
                MessageBox.Show("No booking customer has been selected !");
            }
            else
            {
                result = MessageBox.Show(message, caption, button);
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    myCustomer.DeleteCustomer(bookingSelectedID);
                    AllBookings.DeleteBooking(bookingSelectedID);
                    MessageBox.Show("Booking has been canceled !");
                    LoadAllBookingCustomersNotYetCheckedIn();
                }
            }
        }
Esempio n. 11
0
        //-------------------------------------------------------------------------------------------------------
        private void Form1_Load(object sender, EventArgs e)
        {
            // Check all customer in the system who didnt appear to check in , then remove from the system
            string BookingID = myCustomer.GetBookingIDOfCustomerNotAppearToCheckIN();

            myCustomer.DeleteCustomer(BookingID);
            AllBookings.DeleteBooking(BookingID);

            // Get admin name display on form
            this.Text = "Wifi-Hotel Management System " + " Admin by : " + UserLogin.username;

            // Load today checkin customers
            //LoadTodayCheckInCustomers();
            //LoadTodayCheckOutCustomers();
            //NumOfTodayCheckIn();
            //NumOfTodayCheckOut();

            // Setting
            timer1.Enabled = true;
            //LoadRoomStatus();
            //Load everythings
            RefreshRooms();
        }
Esempio n. 12
0
 private void txtGuestID_Click(object sender, EventArgs e)
 {
     // Receive a random generated string from the class AllBookings
     txtGuestID.Text = AllBookings.GenerateRandomIDs();
 }
Esempio n. 13
0
 public void AllAvailabeRooms()
 {
     AllBookings.dgvAvailableRooms = DGVAvailablesRooms;
     AllBookings.AvailableRooms();
 }