private void btnEstimateCost_Click_1(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");



                Repair.sendInvoice(lblCustEmail.Text, "Revised", lblCostNum.Text);

                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.Enabled   = false;
                grpSelectRepair.Enabled  = true;
                btnSelectRepair.Visible  = false;
                grpSelectRepair.Visible  = true;
                lblCostNum.Text          = "";
                ds = null;
                lblEstimateTitle.Text   = titletext;
                rdoEstimated.Checked    = false;
                rdoProcessing.Checked   = false;
                btnReviseRepair.Visible = false;
            }

            DialogResult dialogResult = MessageBox.Show(" Would you like to change the description of the selected repair?", "Repair Description", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dialogResult == DialogResult.Yes)
            {
                updaeRepDesc(this, txtRepairDesc.Text);
            }

            txtRepID.Text = "";
        }
Exemplo n.º 2
0
        private void btnEstimateCost_Click(object sender, EventArgs e)
        {
            if (grdAddedParts.RowCount > 0)
            {
                DataGridViewRow selectedPart  = grdAddedParts.Rows[grdAddedParts.CurrentCell.RowIndex];
                RepairParts     myRepairParts = new RepairParts();

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

                foreach (DataRow row in repairParts.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");
                Repair.sendInvoice(lblCustEmail.Text, "Estimated", "0");

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


                pnlRepDesc.Visible         = false;
                grdAddedParts.DataSource   = null;
                grdShowParts.DataSource    = null;
                pnlQuantity.Visible        = false;
                grpSelectParts.Enabled     = false;
                grpSelectRepair.Enabled    = true;
                cboListParts.SelectedIndex = -1;
                grdShowParts.DataSource    = null;
                lblCostNum.Text            = "";
                txtRepID.Text            = "";
                lblEstimateTitle.Text    = titletext;
                pnlAddedParts.Visible    = false;
                grdListRepair.DataSource = null;
                lblCustEmail.Text        = "";
                grdListRepair.Visible    = true;
                btnSelectRepair.Visible  = false;


                DataSet dsReload = new DataSet();
                dsReload = Repair.getRepairStatus(dsReload, "Pending");
                grdListRepair.DataSource = dsReload.Tables["status_List"];

                if (grdListRepair.RowCount <= 0)
                {
                    grdListRepair.Dispose();
                }
            }
        }
        private void btnSelectRepair_Click_1(object sender, EventArgs e)
        {
            if (grdListRepair.SelectedRows.Count > 0)
            {
                lblEstimateTitle.Visible = true;
                grpSelectParts.Enabled   = true;
                grpSelectRepair.Enabled  = false;
                lblEstimateTitle.Text   += txtRepID.Text;
                grdListRepair.DataSource = null;

                loadCombo();
                grdAddedParts.DataSource = null;

                ds = RepairParts.getRepairParts(ds, Convert.ToInt32(txtRepID.Text));
                grdAddedParts.DataSource = ds.Tables["Repair_Parts"];
                lblCostNum.Text          = RepairTableData.calculateRepairCost(ds.Tables["Repair_Parts"]);


                grpSelectParts.Visible = true;
            }
        }
Exemplo n.º 4
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"];
            }
        }