Exemplo n.º 1
0
        private void btnSelectRes_Click(object sender, EventArgs e)
        {
            //Validating Data
            if (!Validation.checkEmptyCombo(cboSelectRes))
            {
                return;
            }

            //Display Yes/No dialog to confirm Reservation
            DialogResult dResult = MessageBox.Show("Are you sure this reservation is correct.", "Processing Check-Out", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dResult == DialogResult.Yes)
            {
                //Display Confirmation Message
                MessageBox.Show("The selected reservation has been checked-out", "Check Out Processed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Changes Reservation Status to "CO" for Check-Out and Room Status to "U" for Unoccupied
                Reservation.changeResStatus(Convert.ToInt16(cboSelectRes.Text.Substring(0, 4)), "CO");
                Room.changeRoomStatus(Reservation.findRoom(Convert.ToInt16(cboSelectRes.Text.Substring(0, 4))), "U");

                //Resetting UI
                cboSelectRes.SelectedIndex = -1;
            }
            else if (dResult == DialogResult.No)
            {
                //Resetting UI
                cboSelectRes.SelectedIndex = -1;
            }
        }
Exemplo n.º 2
0
        private void btnSelectRoom_Click(object sender, EventArgs e)
        {
            //Validate Data
            if (!Validation.checkEmptyCombo(cboRoomNo))
                return;

            //Sets the RoomNo and Cost for the Reservation
            newRes.setRoomNO(Convert.ToUInt16(cboRoomNo.Text.Substring(0, 3)));
            newRes.setCost((Convert.ToDateTime(dtpDeptDate.Text) - Convert.ToDateTime(dtpArrDate.Text)).TotalDays * Reservation.findRate(newRes.getRoomNo()));

            cboRoomNo.Enabled = false;
            btnSelectRoom.Enabled = false;
            //Show Next Step
            Size = new Size(600, 500);
            grpCustomer.Show();
        }
Exemplo n.º 3
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (!Validation.checkEmptyCombo(cboRoomType))
            {
                return;
            }

            Size = new Size(700, 700);
            chtType.Show();
            //define chart
            defineChart(dtpYearSelect.Value.Year.ToString().Substring(2, 2));

            //Define the chart series
            defineSeries();

            //fills chart with number of bookings divided by room type
            fillChart(dtpYearSelect.Value.Year.ToString().Substring(2, 2), cboRoomType.Text.Substring(0, 2));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Validation.checkEmptyCombo(cboReservation))
            {
                return;
            }

            if (Convert.ToDateTime(cboReservation.Text.Substring(5, 10)).DayOfYear > (DateTime.Now.DayOfYear + 1))
            {
                //Display Yes/No dialog confirming selection
                DialogResult dResult = MessageBox.Show("Are you sure this is the correct reservation?", "Cancel Reservation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (dResult == DialogResult.Yes)
                {
                    //Display confirmation message
                    MessageBox.Show("You have cancelled a Reservation.", "Reservation Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    Reservation.changeResStatus(Convert.ToInt16(cboReservation.Text.Substring(0, 4)), "CL");

                    //Resetting UI
                    txtFname.Text = "";
                    txtSname.Text = "";
                    cboReservation.SelectedIndex = -1;

                    grpSelectRes.Hide();
                    grpSelectCust.Show();
                }

                else if (dResult == DialogResult.No)
                {
                    MessageBox.Show("You did not cancel any Reservations.", "No Changes Made", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //Resetting UI
                    txtFname.Text = "";
                    txtSname.Text = "";
                    cboReservation.SelectedIndex = -1;

                    grpSelectRes.Hide();
                    Size = new Size(333, 250);
                    grpSelectCust.Show();
                }
            }
        }
Exemplo n.º 5
0
        private void btnSelectRes_Click(object sender, EventArgs e)
        {
            //Validating Data
            if (!Validation.checkEmptyCombo(cboSelectRes))
            {
                return;
            }


            //Display Yes/No dialog to confirm Reservation
            DialogResult dResult = MessageBox.Show("Are you sure this reservation is correct.", "Processing Check-In", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dResult == DialogResult.Yes)
            {
                //Sets the Payment Details
                Payment newPayment = new Payment();

                newPayment.setPayID(Payment.nextPayID());
                newPayment.setPayDate(DateTime.Now.ToString("yyyy-MM-dd"));
                newPayment.setResNo(Convert.ToInt16(cboSelectRes.Text.Substring(0, 4)));

                //Saves the Payment Details to the Payments File
                newPayment.addPayment();

                //Display Confirmation Message
                MessageBox.Show("The selected reservation has been checked-in and the customer has been charged.", "Check In Processed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Changes Reservation Status to "CI" for Check-In and Room Status to "O" for Occupied
                Reservation.changeResStatus(Convert.ToInt16(cboSelectRes.Text.Substring(0, 4)), "CI");
                Room.changeRoomStatus(Reservation.findRoom(Convert.ToInt16(cboSelectRes.Text.Substring(0, 4))), "O");

                //Resetting UI
                cboSelectRes.SelectedIndex = -1;
            }

            else if (dResult == DialogResult.No)
            {
                //Resetting UI
                cboSelectRes.SelectedIndex = -1;
            }
        }
Exemplo n.º 6
0
        private void btnSelectRes_Click(object sender, EventArgs e)
        {
            //Validate Data
            if (!Validation.checkEmptyCombo(cboType))
                return;

            //Checks for availible rooms during selected dates and of the selected type
            DataSet ds = new DataSet();
            cboRoomNo.Items.Clear();
            ds = Reservation.getUnoccupiedRooms(ds, dtpArrDate.Value.ToString("yyyy-MM-dd"), dtpDeptDate.Value.ToString("yyyy-MM-dd"), cboType.Text.Substring(0, 2));

            //Checks if there are no rooms of the selected type availible during the selected dates and asks user to change their selection.
            if (ds.Tables["ss"].Rows.Count == 0)
            {
                MessageBox.Show("There is no availible rooms of this type during the period selected. Please select another Date/Type", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cboType.Focus();
            }
            else
            {
                //Loads the availible Rooms from the Rooms File
                for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
                {
                    cboRoomNo.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
                }
                   
                //Sets the Arrival and Departure Date for the Reservation
                newRes.setArrivalDate(dtpArrDate.Value.ToString("yyyy-MM-dd"));
                newRes.setDeptDate(dtpDeptDate.Value.ToString("yyyy-MM-dd"));

                //Disabling the user from changing information after selecting the button
                dtpArrDate.Enabled = false;
                dtpDeptDate.Enabled = false;
                cboType.Enabled = false;
                btnSelectRes.Enabled = false;
                
                //Showing Next Step
                Size = new Size(350, 500);
                grpSelectRoom.Show();
            }
        }
Exemplo n.º 7
0
        private void btnAddRooms_Click(object sender, EventArgs e)
        {
            // validate data
            if (!Validation.checkEmptyCombo(cboRoomType))
            {
                return;
            }

            if (!Validation.checkNonNumeric(txtDescription))
            {
                return;
            }

            if (!Validation.checkEmptyText(txtDescription))
            {
                return;
            }

            //Sets the Room Details from the form
            Room nextRoom = new Room();

            nextRoom.setRoomNo(Convert.ToInt16(txtRoomNo.Text));
            nextRoom.setType(cboRoomType.Text.Substring(0, 2));
            nextRoom.setDescription(txtDescription.Text);

            //Save data in Rooms File
            nextRoom.addRoom();

            //Display confirmation message
            MessageBox.Show("You successfully added Room " + txtRoomNo.Text, "Room Added", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //Reset UI
            cboRoomType.SelectedIndex = -1;
            txtDescription.Text       = "";
            txtRoomNo.Text            = Room.nextRoomNo().ToString();
            cboRoomType.Focus();
        }
Exemplo n.º 8
0
        private void btnCloseRoom_Click(object sender, EventArgs e)
        {
            // validate data
            if (!Validation.checkEmptyCombo(cboCloseRoom))
            {
                return;
            }

            //Display confirmation message
            DialogResult dResult = MessageBox.Show("Are you sure you would like to close this room?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dResult == DialogResult.Yes)
            {
                //Checks if the Room has Reservations
                if (Room.checkFreeRooms(cboCloseRoom.Text))
                {
                    Room.changeRoomStatus(Convert.ToInt16(cboCloseRoom.Text), "C");

                    MessageBox.Show("Room " + cboCloseRoom.Text + " has been closed.", "Room Closed.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //Reset UI
                    cboCloseRoom.SelectedIndex = -1;
                }
                else
                {
                    MessageBox.Show("Room " + cboCloseRoom.Text + " has reservations booked. Unable to close.", "Unable To Close.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //Reset UI
                    cboCloseRoom.SelectedIndex = -1;
                }
            }
            else if (dResult == DialogResult.No)
            {
                MessageBox.Show("No changes have been made.", "No changes.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //Reset UI
            cboCloseRoom.SelectedIndex = -1;
        }