Exemplo n.º 1
0
        private void btnConfirmUpdate_Click(object sender, EventArgs e)
        {
            //Validate Data
            if (!Validation.checkEmptyText(txtUpdatedAmount))
            {
                return;
            }

            if (!Validation.checkNumeric(txtUpdatedAmount))
            {
                return;
            }

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

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

            //Sets the Rate Details
            Rates myRate = new Rates();

            myRate.setRoom_Type(txtSelectedRateType.Text);
            myRate.setDescription(txtUpdatedDescription.Text);
            myRate.setRate(Convert.ToDecimal(txtUpdatedAmount.Text));

            //Updates the Rate in the Rates File
            myRate.updRate();

            //Display confirmation message
            MessageBox.Show("You have updated a rate.", "Rate Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //Reset UI

            cboSelectRate.SelectedIndex = -1;
            grpUpdateRate.Hide();
            Size = new Size(400, 225);
            grpSelectRate.Show();

            //Loads the Rates again from the Rates File(shows updates)
            DataSet ds = new DataSet();

            cboSelectRate.Items.Clear();
            ds = Rates.getAllRates(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboSelectRate.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
            }
        }
Exemplo n.º 2
0
        private void UpdateRate_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            cboSelectRate.Items.Clear();
            ds = Rates.getAllRates(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboSelectRate.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
            }
        }
Exemplo n.º 3
0
        private void frmTypeAnalysis_Load(object sender, EventArgs e)
        {
            //Loads all types from Rates File
            DataSet ds = new DataSet();

            cboRoomType.Items.Clear();
            ds = Rates.getAllRates(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboRoomType.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
            }
        }
Exemplo n.º 4
0
        private void frmMakeReservation_Load(object sender, EventArgs e)
        {
            dtpArrDate.MinDate = DateTime.Today;
            //Loads All the Types from the Rates File
            DataSet ds = new DataSet();
            cboType.Items.Clear();
            ds = Rates.getAllRates(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboType.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
            }
        }
Exemplo n.º 5
0
        private void cboSelectRoom_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboSelectRoom.SelectedIndex == -1)
            {
                return;
            }

            //Loads the Rooms Details in the Text Boxes and displays them
            Room updRoom = new Room();

            updRoom.loadRoom(cboSelectRoom.Text);

            if (updRoom.getRoomNo().Equals(""))
            {
                MessageBox.Show("No Details Found for this Room. Please select another.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboSelectRoom.Focus();
                return;
            }

            txtSelectedRoomNo.Text = updRoom.getRoomNo().ToString();
            txtDescription.Text    = updRoom.getDescription();

            DataSet ds = new DataSet();

            cboSelectType.Items.Clear();
            ds = Rates.getAllRates(ds);

            for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++)
            {
                cboSelectType.Items.Add(ds.Tables[0].Rows[i][0].ToString() + " " + ds.Tables[0].Rows[i][1].ToString());
            }

            setType(updRoom.getType());

            Size = new Size(400, 450);
            grpUpdateRoom.Visible = true;
        }
Exemplo n.º 6
0
        private void btnAddRate_Click(object sender, EventArgs e)
        {
            // validate data
            if (!Validation.checkEmptyText(txtRateType))
            {
                return;
            }

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

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

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

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

            if (!Validation.checkNumeric(txtRateAmount))
            {
                return;
            }

            if (!Rates.rateExists(txtRateType.Text))
            {
                MessageBox.Show("This rate has already been entered in the database. Please enter a new rate.", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtRateType.Focus();
                txtRateType.Text   = "";
                txtRateDesc.Text   = "";
                txtRateAmount.Text = "";
                return;
            }

            //Sets the details of new rate from form
            Rates newRate = new Rates();

            newRate.setRoom_Type(txtRateType.Text);
            newRate.setDescription(txtRateDesc.Text);
            newRate.setRate(Convert.ToDecimal(txtRateAmount.Text));

            //Saves details in the Rates File
            newRate.addRate();

            //Display confirmation message
            MessageBox.Show("You have added a new rate for '" + txtRateDesc.Text + "'.", "Rate Added", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //Reset UI
            txtRateType.Text   = "";
            txtRateDesc.Text   = "";
            txtRateAmount.Text = "";
            txtRateType.Focus();
        }