private void button2_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure you would like to complete this repair? This process is irreversable", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (txtDesc.Text != "") { if (dialogResult == DialogResult.Yes) { //retrieves the row index of the selected cell int rowindex = grdListRepairs.CurrentCell.RowIndex; //retrive the repair id froma the cell of the selected rowindex int RepairId = Convert.ToInt32(grdListRepairs.Rows[rowindex].Cells[0].Value.ToString()); //Update the repair to the specified status MessageBox.Show("Repair Completed" + "\n\n Customer has been emailed", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); Repair.updateRepairStatus(RepairId, "Completed"); Repair.sendInvoice(lblCustEmail.Text, "Completed", "0"); Repair.setCompletionDate(RepairId); DataSet ds = new DataSet(); ds = Repair.filterRepairs(ds, "Processing"); grdListRepairs.DataSource = ds.Tables["repairlist"]; grdListRepairs.ClearSelection(); txtDesc.Text = ""; } } }
private void frmCompleteRepair_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds = Repair.filterRepairs(ds, "Processing"); grdListRepairs.DataSource = ds.Tables["repairlist"]; grdListRepairs.ClearSelection(); }
private void btnCompleted_Click(object sender, EventArgs e) { grdListRepairs.DataSource = null; isPressed(btnCompleted, btnPendingFilter, btnProcessing, btnEstimated); DataSet ds = new DataSet(); ds = Repair.filterRepairs(ds, buttonSelected); grdListRepairs.DataSource = ds.Tables["repairlist"]; }
private void rdoEstimated_Click(object sender, EventArgs e) { 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 button2_Click(object sender, EventArgs e) { if (radNo.Checked) { MessageBox.Show("Error! Please confirm that the customer has agreed to pay the full amount of the repair cost ", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); radNo.Focus(); } if (radYes.Checked) { DialogResult dialogResult = MessageBox.Show(" Please confirm that the user has agreed to pay the repair cost in full", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialogResult == DialogResult.Yes) { int rowindex = grdListRepairs.CurrentCell.RowIndex; int repid = Convert.ToInt32(grdListRepairs.Rows[rowindex].Cells[0].Value.ToString()); double amountPaid = 00.00; if (Payment.isExistingPayment(repid)) { double paid = Payment.retrieverepCost(repid); amountPaid = Convert.ToDouble(grdListRepairs.Rows[rowindex].Cells[1].Value) - paid; pnlExistingPayment.Visible = true; } else { amountPaid = Convert.ToDouble(grdListRepairs.Rows[rowindex].Cells[1].Value.ToString()); } Repair.sendInvoice(lblCustEmail.Text, "Processing", "0"); MessageBox.Show("Repair status changed to Processing \n\nCustomer has been emailed", "Processing", MessageBoxButtons.OK, MessageBoxIcon.Information); Repair.updateRepairStatus(repid, "Processing"); Payment newPayment = new Payment(Payment.nextPaymentID(), repid, amountPaid); newPayment.addPayments(); DataSet ds = new DataSet(); ds = Repair.filterRepairs(ds, "Estimated"); grdRepairParts.DataSource = null; grdListRepairs.DataSource = ds.Tables["repairlist"]; radNo.Checked = true; txtDesc.Text = ""; lblCustEmail.Text = ""; lblExistingPayment.Visible = false; } } }
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 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 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(); }