private void rdoEstimated_CheckedChanged(object sender, EventArgs e)
        {
            grdListRepair.DataSource = null;

            DataSet ds = new DataSet();

            ds = Repair.filterRepairs(ds, "Processing");
            grdListRepair.DataSource = ds.Tables["repairlist"];

            grdListRepair.ClearSelection();

            if (grdListRepair.RowCount <= 0)
            {
                grdListRepair.Dispose();
            }
        }
        private void rdoProcessing_Click(object sender, EventArgs e)
        {
            grdListRepair.DataSource = null;

            DataSet ds = new DataSet();

            ds = Repair.filterRepairs(ds, "Processing");
            grdListRepair.DataSource = ds.Tables["repairlist"];

            grdListRepair.ClearSelection();

            if (grdListRepair.RowCount <= 0)
            {
                grdListRepair.Visible = false;
            }
        }
        private void grdListRepair_SelectionChanged_1(object sender, EventArgs e)
        {
            if (grdListRepair.CurrentCell != null && txtRepID.Text != "")
            {
                int rowindex = grdListRepair.CurrentCell.RowIndex;
                int id       = Convert.ToInt32(grdListRepair.Rows[rowindex].Cells[0].Value.ToString());

                txtRepairDesc.Visible = true;
                txtRepairDesc.Text    = Repair.getDescription(id);
            }

            else
            {
                txtRepairDesc.Text = "";
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int Repid = Convert.ToInt32(txtRepId.Text);

            if (Repid > 0 && txtRepairDesc.Text != "")
            {
                Repair.updateRepairDesc(Repid, ValidateText(txtRepairDesc.Text));
                MessageBox.Show("Repair Description for Repair Id: " + txtRepId.Text + " Updated", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }

            else
            {
                MessageBox.Show("Error Description not updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void rdoProcessing_CheckedChanged(object sender, EventArgs e)
        {
            grdListRepair.DataSource = null;
            grdListRepair.Visible    = true;

            DataSet ds = new DataSet();

            ds = Repair.filterRepairs(ds, "Estimated");
            grdListRepair.DataSource = ds.Tables["repairlist"];

            grdListRepair.ClearSelection();

            if (grdListRepair.RowCount < 0)
            {
                grdListRepair.Visible = false;
            }
        }
        private void btnEstimateCost_Click(object sender, EventArgs e)
        {
            if (grdAddedParts.RowCount > 0)
            {
                DataGridViewRow selectedPart = grdAddedParts.Rows[grdAddedParts.CurrentCell.RowIndex];
                //instantiate part Object
                RepairParts myRepairParts = new RepairParts();

                myRepairParts.setRepID(Convert.ToInt32(txtRepID.Text));

                myRepairParts.deleteRepairParts();

                foreach (DataRow row in ds.Tables["Repair_Parts"].Rows)
                {
                    int pId      = Convert.ToInt32(row[0]);
                    int quantity = Convert.ToInt32(row[2]);

                    myRepairParts.setPartID(pId);
                    myRepairParts.setQuantity(quantity);
                    myRepairParts.addToRepairParts();
                    grdListRepair.ClearSelection();
                }

                Repair.updateRepairCost(myRepairParts.getRepairID(), Convert.ToDouble(lblCostNum.Text));
                Repair.updateRepairStatus(myRepairParts.getRepairID(), "Estimated");

                MessageBox.Show("Parts added to Repair: " + txtRepID.Text + "\n Customer has been notified by email", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);

                lblEstimateTitle.Visible   = false;
                pnlRepDesc.Visible         = false;
                grdAddedParts.DataSource   = null;
                grdShowParts.DataSource    = null;
                grdListRepair.DataSource   = null;
                pnlQuantity.Visible        = false;
                grpSelectParts.Visible     = false;
                grpSelectRepair.Visible    = true;
                btnSelectRepair.Visible    = false;
                cboListParts.SelectedIndex = -1;
                grdShowParts.DataSource    = null;
                lblCostNum.Text            = "";
                txtRepID.Text         = "";
                lblEstimateTitle.Text = titletext;
                pnlAddedParts.Visible = false;
            }
        }
        private void grdListRepair_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && grdListRepair.CurrentCell != null)
            {
                //gets a collection that contains all the rows
                DataGridViewRow row = grdListRepair.Rows[e.RowIndex];
                //populate the textbox from specific value of the coordinates of column and row.
                txtRepID.Text = row.Cells[0].Value.ToString();

                int rowindex = grdListRepair.CurrentCell.RowIndex;
                int id       = Convert.ToInt32(grdListRepair.Rows[rowindex].Cells[0].Value.ToString());
                txtRepairDesc.Text = Repair.getDescription(id);
                lblCustEmail.Text  = Repair.getEmail(id);

                pnlRepDesc.Visible      = true;
                btnSelectRepair.Visible = true;
            }
        }
        private void btnReturn_Click(object sender, EventArgs e)
        {
            grdAddedParts.DataSource = null;
            grpSelectRepair.Visible  = true;

            DataSet dsReloadRepair = new DataSet();

            dsReloadRepair           = Repair.filterRepairs(dsReloadRepair, "Estimated");
            grdListRepair.DataSource = dsReloadRepair.Tables["repairlist"];

            pnlQuantity.Visible        = false;
            lblCostNum.Text            = "0";
            lblEstimateTitle.Text      = titletext;
            grpSelectRepair.Enabled    = true;
            grpSelectParts.Enabled     = false;
            cboListParts.SelectedIndex = -1;
            ds.Clear();
            cboListParts.Items.Clear();
        }
Example #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            lblCostNum.Text         = "0";
            lblEstimateTitle.Text   = titletext;
            grpSelectRepair.Enabled = true;
            grpSelectParts.Enabled  = false;
            cboListParts.Items.Clear();
            cboListParts.SelectedIndex = -1;
            grdShowParts.DataSource    = null;
            grdAddedParts.DataSource   = null;
            cboListParts.SelectedIndex = -1;
            grdListRepair.Enabled      = true;


            DataSet ds = new DataSet();

            ds = Repair.getRepairStatus(ds, "Pending");
            grdListRepair.DataSource = ds.Tables["status_List"];
        }
Example #10
0
        private void Clear_Click(object sender, EventArgs e)
        {
            btnPendingFilter.Enabled  = true;
            btnProcessing.Enabled     = true;
            btnEstimated.Enabled      = true;
            btnCompleted.Enabled      = true;
            pnlRepDetails.Visible     = false;
            lblCustEmail.Visible      = false;
            lblEmailtitle.Visible     = false;
            txtRepairDesc.Visible     = false;
            lblRepDesc.Visible        = false;
            grdListRepairs.DataSource = null;
            txtRepairDesc.Text        = "";

            DataSet ds = new DataSet();

            ds = Repair.listRepairs(ds);
            grdListRepairs.DataSource = ds.Tables["repairlist"];
        }
Example #11
0
        private void grdListRepairs_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                int rowindex = grdListRepairs.CurrentCell.RowIndex;
                int id       = Convert.ToInt32(grdListRepairs.Rows[rowindex].Cells[0].Value.ToString());



                txtDesc.Text      = Repair.getDescription(id);
                lblCustEmail.Text = Repair.getEmail(id);

                lblCustEmail.Visible    = true;
                lblEmailTitle.Visible   = true;
                pnlConfirmation.Visible = true;
                radNo.Checked           = true;

                DataSet ds = new DataSet();
                ds = RepairParts.getRepairParts(ds, id);
                grdRepairParts.DataSource = ds.Tables["repair_parts"];
            }
        }
Example #12
0
        private void btnLogRepair_Click(object sender, EventArgs e)
        {
            if (isValidEntry(txtEmail.Text, txtPhone_No.Text))
            {
                //instantiate part Object
                Repair myRepair = new Repair(ValidateText(txtForename.Text), ValidateText(txtSurname.Text), txtPhone_No.Text, ValidateText(txtRepDescription.Text), Int32.Parse(txtRepairID.Text), txtEmail.Text.ToLower());

                //INSERT part record into part table
                myRepair.logRepair();

                //Display Confirmation Message
                MessageBox.Show("Repair " + txtRepairID.Text + "  logged \n\n The repair staus has been set to Pending\n\n" + "Customer Name: " + txtForename.Text + " " + txtSurname.Text + "\n\nCustomer has been notified by email. ", "Log Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Repair.sendInvoice(txtEmail.Text, "Logged", "0");

                //reset UI
                txtForename.Clear();
                txtEmail.Clear();
                txtPhone_No.Clear();
                txtRepDescription.Clear();
                txtSurname.Clear();
                txtRepairID.Text = Repair.nextRepairID().ToString();
            }
        }
Example #13
0
 private void frmLogRepair_Load(object sender, EventArgs e)
 {
     txtRepairID.Text = Repair.nextRepairID().ToString("000");
 }