private void btnClose_Click(object sender, EventArgs e) { try { frmAuthenticate mysfrm = new frmAuthenticate(); mysfrm.ShowDialog(); this.Hide(); } catch (Exception ex) { MessageBox.Show("application error " + ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { //checking that logged in user is no an admin if (sessions.userType != "A") { frmAuthenticate myA = new frmAuthenticate(); DialogResult access = myA.ShowDialog(); if (access == DialogResult.OK) { manageUsers myU = new manageUsers(); if (myU.adminAuth(myA.userName, myA.password) == true) { bzlTransactions myTrans = new bzlTransactions(); myTrans.tranId = this.txtRefNumber.Text; myTrans.accountId = this.txtEnrolId.Text; myTrans.DeleteTransacation(); if (myTrans.dacCrud == true) { this.txtTranDetails.Text = ""; this.txtAmount.Text = ""; manageControl myC = new manageControl(); managefeesBalance myFb = new managefeesBalance(); myFb.getBalance(this.txtEnrolId.Text, sessions.currTerm); this.refNumber = myC.useTranHeader(this.refNumber); this.txtRefNumber.Text = "ref" + this.refNumber.ToString(); this.txtCurBalance.Text = myFb.CurrentBal.ToString(); this.txtOpenBal.Text = myFb.OpenBal.ToString(); this.txtPaid.Text = myFb.PaymentIn.ToString(); this.fillTrans(Convert.ToInt32(this.txtEnrolId.Text)); MessageBox.Show("transaction deleted success", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Failed to delete transaction", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Invalid Adimin Credentials", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } else { DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this transaction", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.OK) { bzlTransactions myTrans = new bzlTransactions(); myTrans.tranId = this.txtRefNumber.Text; myTrans.DeleteTransacation(); myTrans.accountId = this.txtEnrolId.Text; if (myTrans.dacCrud == true) { MessageBox.Show("transaction deleted success", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Failed to delete transaction", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to fillTrans() " + ex); } }