private void btnUpdate_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtIncome.Text)) { throw new Exception("Income Field cannot be Empty'"); } if (string.IsNullOrEmpty(txtExpense.Text)) { throw new Exception("Expense Field cannot be Empty'"); } if (string.IsNullOrEmpty(txtcash.Text)) { throw new Exception("Cash Field Empty'"); } if (txtcash.TextLength >= 20) { throw new Exception("Enter At Hand or Bank in the Cash Field'"); } rp.dailyReportUpdate(lblID, txtIncome, txtExpense, txtcash, dateTimeDate); Reports.displayReport(dataGridExpense); Clear(); dateTimeDate.Value = dataAccess.Sdate; checkTotal.Checked = false; } catch (Exception Ex) { MessageBox.Show(Ex.Message + "\nCould not Save", "Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void txtSearch_TextChanged(object sender, EventArgs e) { try { Clear(); dateTimeDate.Value = dataAccess.Sdate; Reports.ReportSearch(dataGridExpense, txtSearch); if (string.IsNullOrEmpty(txtSearch.Text)) { Reports.displayReport(dataGridExpense); } } catch (Exception Ex) { MessageBox.Show(Ex.Message + "\nCould not Find", "Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (lblID.Text == "ID") { throw new Exception("Select record to delete"); } rp.deleteReport(lblID); Reports.displayReport(dataGridExpense); Clear(); dateTimeDate.Value = dataAccess.Sdate; txtIncome.Focus(); checkTotal.Checked = false; } catch (Exception Ex) { MessageBox.Show(Ex.Message + "\nCould not Delete", "Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void TotalDailyIncome_Load(object sender, EventArgs e) { Reports.displayReport(dataGridExpense); }