private void btnDelete_Click(object sender, EventArgs e)
 {
     Debug.WriteLine(gridTransactions.SelectedRows[0].Cells[0].Value);
     Transaction t = new Transaction(int.Parse(gridTransactions.SelectedRows[0].Cells[0].Value.ToString()));
     DialogResult result = MessageBox.Show("Are you sure you want to permanently delete this transaction?",
         "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
     if (result.Equals(DialogResult.Yes))
     {
         t.Delete();
         btnRefresh.PerformClick();
     }
     btnDelete.Enabled = false;
 }
 public ClubMember(string strUsername)
 {
     Transaction t = new Transaction();
     this.username = strUsername;
     loadMemberDetails();
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     Transaction trans;
     if (checkRequiredInput())
     {
         if (lblActualID.Text == "")
         {
             // new transaction
             trans = new Transaction();
             trans.username = cbUsernames.Text;
             string type = cbType.SelectedItem.ToString();
             //string fAmt = txtAmt.Text.Substring(1);
             trans.amount = App.MyDecParse(txtAmt.Text);
             if (type.Equals("Payment") || type.Equals("Refund") || type.Equals("Credit"))
             {
                 trans.amount = trans.amount * -1;
             }
             trans.transDate = dtpDate.Value.Date;
             trans.type = type;
             trans.semester = cbSemester.Text;
             trans.description = rtbDescr.Text;
             trans.depositNumber = txtDepID.Text;
             trans.checkNumber = txtCheckNo.Text;
             ClubMember cm = new ClubMember(trans);
             lblResult.Text = cm.addTransaction();
             btnRefresh.PerformClick();
             System.Threading.Thread.Sleep(1000);
             lblResult.Text = "";
         }
         else
         {
             trans = new Transaction(Int32.Parse(lblActualID.Text));
             trans.username = cbUsernames.Text;
             string type = cbType.SelectedItem.ToString();
             trans.amount = App.MyDecParse(txtAmt.Text);
             if (type.Equals("Payment") || type.Equals("Refund") || type.Equals("Credit"))
             {
                 trans.amount = trans.amount * -1;
             }
             // incase a payment, refund or credit is changed to a charge
             else if (type.Equals("Charge"))
             {
                 trans.amount = Math.Abs(trans.amount);
             }
             trans.transDate = dtpDate.Value.Date;
             trans.type = cbType.Text;
             trans.semester = cbSemester.Text;
             trans.description = rtbDescr.Text;
             trans.depositNumber = txtDepID.Text;
             trans.checkNumber = txtCheckNo.Text;
             lblResult.Text = trans.Save();
             btnRefresh.PerformClick();
             System.Threading.Thread.Sleep(1000);
             lblResult.Text = "";
         }
         if (lblResult.Text.Equals("Success!"))
         {
             alterAdvanced(false);
             lblActualID.Text = trans.getTransNo().ToString();
         }
     }
 }
 public ClubMember(Transaction _t)
 {
     this.t = _t;
     loadMemberDetails();
     this.username = t.username;
 }