public void DeleteTransacation() { try { //intiate objects managefeesBalance myB = new managefeesBalance(); manageTransaction myT = new manageTransaction(); //get transaction myT.getTransacation(this.tranId); //update balance myB.getBalance(myT.transAccount, myT.transTerm); curBalance = myB.CurrentBal + myT.transAmount; accumatedPayement = myB.PaymentIn - myT.transAmount; myB.CurrentBal = this.curBalance; myB.ClosingBal = this.curBalance; myB.PaymentIn = accumatedPayement; if (myB.updateBalances(myT.transAccount, myT.transTerm) == true) { //finally delete transaction if (myT.DeleteTrans(this.tranId) == true) { this.dacCrud = true; } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("system error " + ex); } }
public void payFees() { try { /*enter the transacation*/ manageTransaction myT = new manageTransaction(); if (myT.setTrans(this.tranId, this.accountId, this.tranType, this.transAmount, this.tranDate, this.adminId, this.term, this.period, this.payMethod, this.tranDetails) == true) { /*proccess ballance*/ managefeesBalance myFb = new managefeesBalance(); myFb.getBalance(accountId, term); if (myFb.dacFound == true) { this.accumatedPayement = myFb.PaymentIn + transAmount; this.curBalance = myFb.CurrentBal - transAmount; myFb.CurrentBal = this.curBalance; myFb.ClosingBal = this.curBalance; myFb.PaymentIn = myFb.PaymentIn + transAmount; if (myFb.updateBalances(accountId, term) == true) { this.dacCrud = true; } } else { if (myFb.setBalance(accountId, term, sessions.fees) == true) { System.Windows.Forms.MessageBox.Show("balance entered"); myFb.getBalance(accountId, term); this.curBalance = myFb.CurrentBal - transAmount; this.accumatedPayement = myFb.PaymentIn + transAmount; myFb.CurrentBal = this.curBalance; myFb.ClosingBal = this.curBalance; myFb.PaymentIn = accumatedPayement; if (myFb.updateBalances(accountId, term) == true) { System.Windows.Forms.MessageBox.Show("balance updated"); this.dacCrud = true; } } } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("system error " + ex); } }
private void dgvTranscations_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { manageTransaction myT = new manageTransaction(); string tran = Convert.ToString(dgvTranscations.SelectedRows[0].Cells[0].Value); myT.getTransacation(tran.ToString()); this.txtAmount.Text = myT.transAccount.ToString(); this.txtTranDetails.Text = myT.transDetails; this.cmbPayTyp.Text = myT.payMethod; this.txtRefNumber.Text = tran.ToString(); this.txtTranDate.Value = Convert.ToDateTime(myT.transDate); this.btnProcess.Enabled = false; this.btnDelete.Enabled = true; //this.btnUpdate.Enabled = true; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to fillTrans() " + ex); } }