Beispiel #1
0
        private void btnRepairComplete_Click(object sender, EventArgs e)
        {
            //Validation

            if (txtRepairID.Text.Equals(""))
            {
                MessageBox.Show("Field Must Not Be Blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRepairID.Focus();
                return;
            }

            if (cmbStatus.Text.Equals(""))
            {
                MessageBox.Show("Combo Box Must Not Be Blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRepairID.Focus();
                return;
            }

            //Sets the repair to its new details
            Repair rep = new Repair();

            rep.setRepairID(Convert.ToInt32(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[0].Value));
            rep.setRepairStatus(cmbStatus.Text);

            //sets the status to the combo box value
            rep.updateRepairCancel();

            if (cmbStatus.Text == "IN PROGRESS")
            {
                rep.setRepairStatus("IN PROGRESS");
            }
            else
            {
                rep.setRepairStatus("COMPLETED");
            }

            //Display Confirmation Message
            MessageBox.Show(grdAllRepairs.Rows[grdAllRepairs.CurrentCell.RowIndex].Cells[4].Value + "\n --------------------------------------------------------\n" + cmbStatus.Text, "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //string status value is COMPLETED
            string status = "COMPLETED";


            //reset UI
            txtRepairID.Text = "";
            cmbStatus.Text   = "";
            DataSet ds = new DataSet();

            grdAllRepairs.DataSource = Repair.getAllRepairs(ds, status).Tables["ss"];
        }