private void grdRepairs_CellClick(object sender, DataGridViewCellEventArgs e) { //Gets selected repair details Repair rep = new Repair(); rep.getRepairInvoice(Convert.ToInt32(grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[0].Value)); lblRepairIDFill.Text = rep.getRepairID().ToString(); lblDescriptionFill.Text = rep.getDescription(); lblCostFill.Text = rep.getCost().ToString(); grpRepairInfo.Visible = true; //Sets a string value to the value in the grid at position 3 string repairStatus = grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[3].Value.ToString(); if (repairStatus == "COMPLETED") { //Fill labels with repair details lblTotalCostFill.Text = Repair.getRepairCost(Convert.ToInt32(grdAllCustomer.Rows[grdAllCustomer.CurrentCell.RowIndex].Cells[0].Value)).ToString(); lblTotalCost.Visible = true; lblTotalCostFill.Visible = true; btnIssueInvoice.Visible = true; } else { MessageBox.Show("Please select a COMPLETED Repair to finish the Invoice \n----------------------------------------------------------\nPlease Wait For Repair to Complete", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { //find repair details Repair rep = new Repair(); rep.getRepairDetails(Convert.ToInt32(grdgetRepairDetails.Rows[grdgetRepairDetails.CurrentCell.RowIndex].Cells[0].Value)); //If no repair, display appropriate message if (rep.getRepairID().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Get string status value string status = grdgetRepairDetails.Rows[grdgetRepairDetails.CurrentCell.RowIndex].Cells[2].Value.ToString(); //if status d, do not procede with repair if (status == "D") { grpRepairDetails.Visible = false; lblCustomerName.Text = "Select a Customer..."; txtCustomerID.Text = ""; MessageBox.Show("Member NOT ACTIVE \n-----------------------\nPlease activate " + grdgetRepairDetails.Rows[grdgetRepairDetails.CurrentCell.RowIndex].Cells[1].Value + " to Log a Repair...", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //display Repair details txtCustomerID.Text = rep.getCustomerID().ToString(); lblCustomerName.Text = rep.getCustomerName(); grpRepairDetails.Visible = true; btnSubmit.Visible = true; }
private void grdRepairs_CellClick(object sender, DataGridViewCellEventArgs e) { //Gets selected repair details Repair rep = new Repair(); rep.getRepairInvoice(Convert.ToInt32(grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[0].Value)); lblRepairIDFill.Text = rep.getRepairID().ToString(); lblDescriptionFill.Text = rep.getDescription(); lblCostFill.Text = rep.getCost().ToString(); grpRepairInfo.Visible = true; //Sets a string value to the value in the grid at position 3 string repairStatus = grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[3].Value.ToString(); if (repairStatus == "ISSUE INVOICE") { //Fill labels with repair details lblTotalCostFill.Text = Repair.getRepairPayment(Convert.ToInt32(grdAllCustomer.Rows[grdAllCustomer.CurrentCell.RowIndex].Cells[0].Value), Convert.ToInt32(grdRepairs.Rows[grdRepairs.CurrentCell.RowIndex].Cells[0].Value)).ToString(); lblTotalCost.Visible = true; lblTotalCostFill.Visible = true; btnIssueInvoice.Visible = true; } }