private void btnFinished_Click(object sender, EventArgs e) { RepairParts soldParts = new RepairParts(); Repairs costOf = new Repairs(); int i = 0; RepairParts.nextRepairId(); lstCart.SelectedIndex = 0; while (lstCart.SelectedIndex <= lstCart.Items.Count) { soldParts.setPart_Id(Convert.ToInt32(lstCart.Text.Substring(0, 5))); soldParts.setRepair_Id(RepairParts.nextRepairId()); soldParts.setQty(Convert.ToInt32(lstCart.Text.Substring(22, 3))); soldParts.setunitCost(Convert.ToDecimal(lstCart.Text.Substring(26, 5))); soldParts.addRepair(); if (lstCart.SelectedIndex < lstCart.Items.Count - 1) { lstCart.SelectedIndex++; } else { break; } } MessageBox.Show("The Repair has been Logged!"); frmLogRepair lr = new frmLogRepair(); lr.Show(); }
private void Finishbtn_Click(object sender, EventArgs e) { Repairs upR = new Repairs(); upR.updateRepair('F', Convert.ToInt32(RepairIdtxt.Text)); MessageBox.Show("Repair has been updated"); frmFinish fin = new frmFinish(); fin.Close(); }
private void repairsdgv_CellClick(object sender, DataGridViewCellEventArgs e) { Repairs selectRepair = new Repairs(); selectRepair.getRepair(Convert.ToInt32(repairsdgv.Rows[repairsdgv.CurrentCell.RowIndex].Cells[0].Value)); RepairIdtxt.Text = selectRepair.getRepair_Id().ToString(); Surnametxt.Text = selectRepair.getSurname().ToString(); Statustxt.Text = selectRepair.getStatus().ToString(); }
private void frmSalesAnalysis_Load(object sender, EventArgs e) { cboyear.Items.Add(DateTime.Today.Year); //2017 cboyear.Items.Add(DateTime.Today.Year - 1); cboyear.Items.Add(DateTime.Today.Year - 2); setDefaultGrid(); //Get data from repair table DataSet aDS = Repairs.getAnalysisValues(cboyear.Text); }
private void Logbtn_Click(object sender, EventArgs e) { ArrayList parts = new ArrayList(); if (forenametxt.Text == "" || surnametxt.Text == "" || mobileNo.Text == "" || mobileNo.TextLength < 10 || mobileNo.TextLength > 10 || emailtxt.Text == "" || descriptiontxt.Text == "" || Repairdtp.Text == "") { MessageBox.Show("Sorry please enter all fields! ", "Name Error!"); } else if (validEmail(emailtxt.Text) == false) { MessageBox.Show("This is not a valid email"); } else { Repairs LogRepair = new Repairs(); LogRepair.setRepair_Id(Convert.ToInt32(LogIdtxt.Text)); LogRepair.setForename(forenametxt.Text); LogRepair.setSurname(surnametxt.Text); LogRepair.setMobile(Convert.ToInt32(mobileNo.Text)); LogRepair.setEmail(emailtxt.Text); LogRepair.setDescription(descriptiontxt.Text); LogRepair.setregDate(DateTime.Now.ToString("dd-MMM-yy")); LogRepair.saveRepairDetails(); MessageBox.Show("Repair " + LogIdtxt.Text + " Logged", "Repair Logged", MessageBoxButtons.OK, MessageBoxIcon.Information); forenametxt.Text = ""; surnametxt.Text = ""; mobileNo.Text = ""; emailtxt.Text = ""; descriptiontxt.Text = ""; Repairdtp.Text = ""; LogIdtxt.Text = Part.nextPartId().ToString("00000"); forenametxt.Focus(); this.Hide(); frmselectParts nextForm = new frmselectParts(); nextForm.Show(); } }
private void Searchbtn_Click(object sender, EventArgs e) { string text = Surtxt.Text.ToUpper(); if (text == "") { repairsdgv.Visible = false; MessageBox.Show("Sorry please enter a part name into the field", "Error!"); } else { repairsdgv.Visible = true; } DataSet DS = new DataSet(); repairsdgv.DataSource = Repairs.getRepairs(DS, text).Tables["Re"]; }
private void LogRepair_Load(object sender, EventArgs e) { LogIdtxt.Text = Repairs.nextLogId().ToString("00000"); }