Exemple #1
0
 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);
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 private void txtEnrolId_Leave(object sender, EventArgs e)
 {
     try
     {
         /*get student information*/
         manageStudent myS = new manageStudent();
         myS.getStudentId(Convert.ToInt32(this.txtEnrolId.Text));
         if (myS.dacFound == true)
         {
             this.txtFname.Text      = myS.firstName;
             this.btnProcess.Enabled = true;
             this.txtLastName.Text   = myS.lastName;
             manageClassrooms myClass = new manageClassrooms();
             myClass.getClass(myS.classId);
             this.txtClass.Text = myClass.className;
             /*get balance information*/
             managefeesBalance myB = new managefeesBalance();
             myB.getBalance(this.txtEnrolId.Text, sessions.currTerm);
             this.txtCurBalance.Text = myB.ClosingBal.ToString();
             this.txtOpenBal.Text    = myB.OpenBal.ToString();
             this.txtPaid.Text       = myB.PaymentIn.ToString();
             /*populate transactions*/
             this.fillTrans(Convert.ToInt32(this.txtEnrolId.Text));
             /*gather invoice information*/
             manageUserDetails myU = new manageUserDetails();
             myU.getUserDetails(sessions.userId);
             //this.dictInvoice.Add("receiptTeller", myU.firstName + " " + myU.lastName);
             //this.dictInvoice.Add("studentName", myS.firstName + " " + myS.lastName);
         }
         else
         {
             MessageBox.Show("Enrolment id not registered in system", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in txtEnrolId_Leave() " + ex, "system error");
     }
 }
Exemple #4
0
 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);
     }
 }
Exemple #5
0
 private void btnProcess_Click(object sender, EventArgs e)
 {
     try
     {
         var    enId = this.txtEnrolId.Text;
         Double amount;
         var    tranId    = this.txtRefNumber.Text;
         var    tranDate  = this.txtTranDate.Value.ToShortDateString();
         var    details   = this.txtTranDetails.Text;
         var    payMethod = this.cmbPayTyp.Text;
         if (enId == "" || this.txtFname.Text == "")
         {
             MessageBox.Show("enrollment id invalid", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             this.txtEnrolId.Focus();
         }
         else if (Double.TryParse(this.txtAmount.Text, out amount) == false)
         {
             MessageBox.Show("enrollment transaction amount", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             this.txtAmount.Focus();
         }
         else if (payMethod == "")
         {
             MessageBox.Show("select payment method", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             this.txtAmount.Focus();
         }
         else
         {
             bzlTransactions myTran = new bzlTransactions();
             myTran.accountId   = enId;
             myTran.transAmount = amount;
             myTran.tranId      = tranId;
             myTran.tranDate    = tranDate;
             myTran.tranDetails = details;
             myTran.tranType    = "F";
             myTran.payMethod   = payMethod;
             myTran.adminId     = sessions.userId;
             myTran.term        = sessions.currTerm;
             myTran.period      = sessions.curPeriod;
             myTran.payFees();
             if (myTran.dacCrud == true)
             {
                 manageControl     myC  = new manageControl();
                 managefeesBalance myFb = new managefeesBalance();
                 myFb.getBalance(enId, 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(enId));
                 // invoiceParams.Add(this.txtFname.Text + " "+this.txtLastName.Text);
                 MessageBox.Show("transaction processing complete", "system notfication", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.printInvoice();
             }
             else
             {
                 MessageBox.Show("failed to process transaction", "system notfication", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnProcess_Click() " + ex, "system error");
     }
 }