Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();

        if (Request.QueryString["id"] == null)
        {
        }
        else
        {
            string EncID = Request.QueryString["id"];
            int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.AccountID = DecID;
            MySessionManager.ClientID  = Convert.ToInt32(loanAcc.GetClientIDFromAcc(Convert.ToInt32(MySessionManager.AccountID)));
        }

        if (Request.QueryString["action"] != null)
        {
            //  MySessionManager.CurrentTab=null;
            string action = Request.QueryString["action"];
            MySessionManager.CurrentTab = action;
            setPanel(action);
            Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "action"));
        }
        else
        {
            setPanel("");
        }

        showAccountInfomartion();
        setUrls();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();

        if (Request.QueryString["id"] == null)
        {
        }
        else
        {
            string EncID = Request.QueryString["id"];
            int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.AccountID = DecID;
            MySessionManager.ClientID = Convert.ToInt32(loanAcc.GetClientIDFromAcc(Convert.ToInt32(MySessionManager.AccountID)));
        }

        if (Request.QueryString["action"] != null)
        {
            //  MySessionManager.CurrentTab=null;
            string action = Request.QueryString["action"];
            MySessionManager.CurrentTab = action;
            setPanel(action);
            Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "action"));
        }
        else { setPanel(""); }

        showAccountInfomartion();
        setUrls();
    }
    public void saveDisburse(int accid, decimal cash, decimal bank)
    {
        Decimal totalAmt = cash + bank;

        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAcc = loanAcc.GetLoanAccount(accid);
        if (tblLoanAcc.Rows.Count > 0)
        {
            LoanDSTableAdapters.GetDisburseLoanTableAdapter disburse = new LoanDSTableAdapters.GetDisburseLoanTableAdapter();
            disburse.InsertDisburseLoan(accid,
                                        tblLoanAcc[0].datAccountNumber.ToString(),
                                        tblLoanAcc[0].datClientFullName.ToString(),
                                        DateTime.Now,
                                        tblLoanAcc[0].datEndDate,
                                        tblLoanAcc[0].datInterestRate,
                                        cash,
                                        bank,
                                        totalAmt,
                                        tblLoanAcc[0].datFees,
                                        tblLoanAcc[0].datLoanType,
                                        tblLoanAcc[0].datPurpose,
                                        tblLoanAcc[0].datTeamID,
                                        tblLoanAcc[0].datCreditTeamID,
                                        MySessionManager.CurrentUser.UserID);
        }
    }
    public void createAccount()
    {
        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        mainDSTableAdapters.ClientTableAdapter           client  = new mainDSTableAdapters.ClientTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        mainDS.ClientDataTable           tblClient  = client.GetClientProfile(MySessionManager.ClientID);

        decimal interestrate = Convert.ToDecimal(tblLoanApp[0].datInterestRate.ToString());

        decimal IntAmt = (Convert.ToDecimal(lbltotalamt.InnerText) * (interestrate / 100));

        interestamt = IntAmt;
        decimal  AmtOut = Convert.ToDecimal(lbltotalamt.InnerText);
        decimal  FinRptBalance_monthly = IntAmt + AmtOut;
        DateTime enddate = addMonth(DateTime.Now, Convert.ToInt32(tblLoanApp[0].datDuration.ToString()));

        if ((tblClient.Rows.Count > 0) || (tblLoanApp.Rows.Count > 0))
        {
            int refreshedID = 0;
            if (tblLoanApp[0].IsdatRefreshedIDNull() == false)
            {
                refreshedID = tblLoanApp[0].datRefreshedID;
            }
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter account = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            account.InsertLoanAccount(createAccountNumber(MySessionManager.ClientID),
                                      Convert.ToDecimal(tblLoanApp[0].datFees.ToString()),
                                      MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      Convert.ToInt32(tblLoanApp[0].datTeamID.ToString()),
                                      DateTime.Now,
                                      enddate,
                                      Convert.ToInt32(tblLoanApp[0].datInterestRate),
                                      Convert.ToInt32(tblLoanApp[0].datDuration.ToString()),
                                      0,
                                      IntAmt,
                                      AmtOut,
                                      FinRptBalance_monthly,
                                      MySessionManager.CurrentUser.UserID,
                                      FinRptBalance_monthly,
                                      DateTime.Now,
                                      DateTime.Now,
                                      Convert.ToInt32(tblLoanApp[0].datPurpose.ToString()),
                                      IntAmt,
                                      refreshedID,
                                      Convert.ToInt32(tblLoanApp[0].datCreditTeamID.ToString()),
                                      tblClient[0].datClientName.ToString(),
                                      Convert.ToInt32(tblLoanApp[0].datLoanType.ToString()));
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAc = loanAc.GetLoanAccount1(MySessionManager.AppID, MySessionManager.ClientID);

        if (tblLoanAc.Rows.Count > 0)
        {
            MySessionManager.AccountID   = tblLoanAc[0].datID;
            MySessionManager.AppBranchID = tblLoanApp[0].datTeamID;
        }
    }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
         lblBranch.InnerText     = util.displayValue("tbl_teams", tblLoanAccRow.datTeamID.ToString());
         lblCreditTeam.InnerText = util.displayValue("sys_credit_teams", tblLoanAccRow.datCreditTeamID.ToString());
     }
     catch (Exception ex) { }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
            lblBranch.InnerText = util.displayValue("tbl_teams", tblLoanAccRow.datTeamID.ToString());
            lblCreditTeam.InnerText = util.displayValue("sys_credit_teams", tblLoanAccRow.datCreditTeamID.ToString());

        }
        catch (Exception ex) { }
    }
Esempio n. 7
0
 protected void btnAccountTransfer_Click(object sender, EventArgs e)
 {
     try
     {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         loanAcc.AccountTransfer(Convert.ToInt32(ddlNewBranch.Text),
                                 Convert.ToInt32(ddlNewCT.Text),
                                 Convert.ToInt32(MySessionManager.AccountID));
         ShowMessageBox("Account has been transfered successfully");
         MySessionManager.CurrentTab = "";
     }
     catch (Exception ex) { }
 }
 protected void btnAccountTransfer_Click(object sender, EventArgs e)
 {
     try
     {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         loanAcc.AccountTransfer(Convert.ToInt32(ddlNewBranch.Text),
                                 Convert.ToInt32(ddlNewCT.Text),
                                 Convert.ToInt32(MySessionManager.AccountID));
         ShowMessageBox("Account has been transfered successfully");
         MySessionManager.CurrentTab = "";
     }
     catch (Exception ex) { }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
            txtIntRate.Text = tblLoanAcc.datInterestRate.ToString();
            txtLoanAmount.Text = tblLoanAcc.datOutstandingAmount.ToString();
            if (tblLoanAcc.datLoanType > 0){ddlLoanType.SelectedValue = tblLoanAcc.datLoanType.ToString();}
            if (tblLoanAcc.datInterestRateType > 0) { ddlInterestRateType.SelectedValue = tblLoanAcc.datInterestRateType.ToString(); }
            
        }
        catch (Exception ex) { }


    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try {
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

            lblClientFullname.InnerText  = tblLoanAccRow.datClientFullName.ToString();
            loanAmtOutstanding.InnerText = tblLoanAccRow.datOutstandingAmount.ToString("c").Replace("$", "");
            lblDuration.InnerText        = tblLoanAccRow.datDuration.ToString() + " month(s)";
            lblExpiryDate.InnerText      = tblLoanAccRow.datEndDate.ToString("D");
            lblInterestRate.InnerText    = tblLoanAccRow.datInterestRate.ToString("c").Replace("$", "") + "%";
            lblLoanAmount.InnerText      = tblLoanAccRow.datInitialAmount.ToString("c").Replace("$", "");
            lblLoanDate.InnerText        = tblLoanAccRow.datStartDate.ToString("D");
            lblCategory.InnerText        = util.displayValue("opt_categories", tblLoanAccRow.datCategory.ToString());
        }
        catch (Exception ex) { }
    }
Esempio n. 11
0
 public void showAccountInfomartion()
 {
     try {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         LoanAccountDS.GetLoanAccountRow        tblLoanAcc             = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
         mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
         lblAccNo.InnerText          = " " + tblLoanAcc.datAccountNumber.ToString();
         lblClienttName.InnerText    = " " + tblLoanAcc.datClientFullName.ToString();
         lblEmail.InnerText          = " " + tblLoanAcc.datIssueDate.ToString("d MMMM  yyyy");
         lblloantype.InnerText       = " " + util.displayValue("opt_loan_types", tblLoanAcc.datLoanType.ToString());
         lblAmtOutstanding.InnerText = " " + tblLoanAcc.datOutstandingAmount.ToString("c").Replace("$", "");
         lblloanAmount.InnerText     = " " + tblLoanAcc.datInitialAmount.ToString("c").Replace("$", "");
         lblClientNo.InnerText       = " " + client.GetClientNo(tblLoanAcc.datClientID);
         lblDuration.InnerText       = " " + tblLoanAcc.datDuration.ToString() + " month(s)";
         lblIntRate.InnerText        = " " + tblLoanAcc.datInterestRate.ToString("c").Replace("$", "") + "%";
     }
     catch (Exception ex) { }
 }
 public void showAccountInfomartion()
 {
     try { 
          LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
          LoanAccountDS.GetLoanAccountRow tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
          mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
          lblAccNo.InnerText = " " + tblLoanAcc.datAccountNumber.ToString();
          lblClienttName.InnerText = " " + tblLoanAcc.datClientFullName.ToString();
          lblEmail.InnerText = " " + tblLoanAcc.datIssueDate.ToString("d MMMM  yyyy");
          lblloantype.InnerText = " " + util.displayValue("opt_loan_types", tblLoanAcc.datLoanType.ToString());
          lblAmtOutstanding.InnerText = " " + tblLoanAcc.datOutstandingAmount.ToString("c").Replace("$", "");
          lblloanAmount.InnerText = " " + tblLoanAcc.datInitialAmount.ToString("c").Replace("$", "");
          lblClientNo.InnerText = " " + client.GetClientNo(tblLoanAcc.datClientID);
          lblDuration.InnerText = " " + tblLoanAcc.datDuration.ToString()+" month(s)";
          lblIntRate.InnerText = " " + tblLoanAcc.datInterestRate.ToString("c").Replace("$", "") + "%";
     }
     catch (Exception ex) { }
 }
Esempio n. 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
         txtIntRate.Text    = tblLoanAcc.datInterestRate.ToString();
         txtLoanAmount.Text = tblLoanAcc.datOutstandingAmount.ToString();
         if (tblLoanAcc.datLoanType > 0)
         {
             ddlLoanType.SelectedValue = tblLoanAcc.datLoanType.ToString();
         }
         if (tblLoanAcc.datInterestRateType > 0)
         {
             ddlInterestRateType.SelectedValue = tblLoanAcc.datInterestRateType.ToString();
         }
     }
     catch (Exception ex) { }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try {
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

            lblClientFullname.InnerText = tblLoanAccRow.datClientFullName.ToString();
            loanAmtOutstanding.InnerText = tblLoanAccRow.datOutstandingAmount.ToString("c").Replace("$", "");
            lblDuration.InnerText = tblLoanAccRow.datDuration.ToString()+" month(s)";
            lblExpiryDate.InnerText = tblLoanAccRow.datEndDate.ToString("D");
            lblInterestRate.InnerText = tblLoanAccRow.datInterestRate.ToString("c").Replace("$", "") + "%";
            lblLoanAmount.InnerText = tblLoanAccRow.datInitialAmount.ToString("c").Replace("$", "");
            lblLoanDate.InnerText = tblLoanAccRow.datStartDate.ToString("D");
            lblCategory.InnerText = util.displayValue("opt_categories", tblLoanAccRow.datCategory.ToString());

        
        }
        catch (Exception ex) { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        #region QueryStringBlock
        if (Request.QueryString["id"] != null)
        {
            string EncID = Request.QueryString["id"];
            int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.AccountID = DecID;
            //  ShowMessageBox(" " + DecID + " ");
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountDataTable tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
            if (tblLoanAcc.Rows.Count > 0)
            {
                lblClient.InnerText = tblLoanAcc[0].datClientFullName.ToString();
                lblbranch.InnerText = util.displayValue("tbl_teams", tblLoanAcc[0].datTeamID.ToString());
                lbldate.InnerText = tblLoanAcc[0].datStartDate.ToLongDateString();
                lbltotalamt.InnerText = tblLoanAcc[0].datOutstandingAmount.ToString("C").Replace("$", "");
            }
        }
        if (!(Request.QueryString["trdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["trdelete"];
                tempHolder.DeleteTransactionDetails1( Convert.ToInt32(MySessionManager.AccountID),Convert.ToInt32(id));

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "trdelete"));
            }
            catch
            { }
        }
        #endregion
        try
        { lblTotal.Text = tempHolder.GetTransTotalAmount(MySessionManager.AppID).ToString(); }
        catch (Exception ex)
        {
            lblTotal.Text = "0.00";
        }
    
    }
    protected void btnOpenAccount_Click(object sender, EventArgs e)
    {
        if (ListofCreditAccounts.Items.Count > 0) {
            int accid = Convert.ToInt32(ListofCreditAccounts.SelectedValue);
            FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vchTypes = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter();
            FinancialDS.tbl_VoucherTypesDataTable vtypes = vchTypes.GetVoucherTypeByName(MySessionManager.VchTypeName);
            if (vtypes.Count > 0)
            {
                if (Convert.ToInt32(vtypes[0].datDebitAccountTypes) == 1)
                {
                    InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter invAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
                    InvestmentAccountDS.GetInvAccountDataTable invAccData = invAcc.GetInvAccount(accid);
                    if (invAccData.Count > 0)
                    {
                        lblInvestmentName.InnerText = invAccData[0].datInvestmentName;
                        lblapplicantName.InnerText = ListofCreditAccounts.SelectedItem.Text;
                        lblInvestmentAmount.InnerText = Convert.ToString(invAccData[0].datInvestmentAmount);

                    }

                }
                else if (Convert.ToInt32(vtypes[0].datDebitAccountTypes) == 2)
                {
                    LoanAccountDSTableAdapters.GetLoanAccountTableAdapter lacc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
                    LoanAccountDS.GetLoanAccountDataTable ltbl = lacc.GetLoanAccount(accid);
                    if (ltbl.Count > 0) {
                        lblInvestmentName.InnerText = ltbl[0].datClientFullName ;
                        lblapplicantName.InnerText = ListofCreditAccounts.SelectedItem.Text;
                        lblInvestmentAmount.InnerText = Convert.ToString(ltbl[0].datInitialAmount);
                    }
                }
            }

            transactionsPanel.Visible = true;
            VchPanel.Visible = true;
            VchTypeSelPanel.Visible = false;
            MySessionManager.TempTranKey = System.Guid.NewGuid().ToString();
            lblTotal.Text = "";
        }
        
    }
Esempio n. 17
0
    protected void btnOpenAccount_Click(object sender, EventArgs e)
    {
        if (ListofCreditAccounts.Items.Count > 0)
        {
            int accid = Convert.ToInt32(ListofCreditAccounts.SelectedValue);
            FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vchTypes = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter();
            FinancialDS.tbl_VoucherTypesDataTable vtypes = vchTypes.GetVoucherTypeByName(MySessionManager.VchTypeName);
            if (vtypes.Count > 0)
            {
                if (Convert.ToInt32(vtypes[0].datCreditAccountTypes) == 1)
                {
                    InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter invAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
                    InvestmentAccountDS.GetInvAccountDataTable invAccData             = invAcc.GetInvAccount(accid);
                    if (invAccData.Count > 0)
                    {
                        lblInvestmentName.InnerText   = invAccData[0].datInvestmentName;
                        lblapplicantName.InnerText    = ListofCreditAccounts.SelectedItem.Text;
                        lblInvestmentAmount.InnerText = Convert.ToString(invAccData[0].datInvestmentAmount);
                    }
                }
                else if (Convert.ToInt32(vtypes[0].datCreditAccountTypes) == 2)
                {
                    LoanAccountDSTableAdapters.GetLoanAccountTableAdapter lacc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
                    LoanAccountDS.GetLoanAccountDataTable ltbl = lacc.GetLoanAccount(accid);
                    if (ltbl.Count > 0)
                    {
                        lblInvestmentName.InnerText   = ltbl[0].datClientFullName;
                        lblapplicantName.InnerText    = ListofCreditAccounts.SelectedItem.Text;
                        lblInvestmentAmount.InnerText = Convert.ToString(ltbl[0].datInitialAmount);
                    }
                }
            }

            transactionsPanel.Visible    = true;
            VchPanel.Visible             = true;
            VchTypeSelPanel.Visible      = false;
            MySessionManager.TempTranKey = System.Guid.NewGuid().ToString();
            lblTotal.Text = "";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        #region QueryStringBlock
        if (Request.QueryString["id"] != null)
        {
            string EncID = Request.QueryString["id"];
            int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.AccountID = DecID;
            //  ShowMessageBox(" " + DecID + " ");
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountDataTable tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
            if (tblLoanAcc.Rows.Count > 0)
            {
                lblClient.InnerText   = tblLoanAcc[0].datClientFullName.ToString();
                lblbranch.InnerText   = util.displayValue("tbl_teams", tblLoanAcc[0].datTeamID.ToString());
                lbldate.InnerText     = tblLoanAcc[0].datStartDate.ToLongDateString();
                lbltotalamt.InnerText = tblLoanAcc[0].datOutstandingAmount.ToString("C").Replace("$", "");
            }
        }
        if (!(Request.QueryString["trdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["trdelete"];
                tempHolder.DeleteTransactionDetails1(Convert.ToInt32(MySessionManager.AccountID), Convert.ToInt32(id));

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "trdelete"));
            }
            catch
            { }
        }
        #endregion
        try
        { lblTotal.Text = tempHolder.GetTransTotalAmount(MySessionManager.AppID).ToString(); }
        catch (Exception ex)
        {
            lblTotal.Text = "0.00";
        }
    }
Esempio n. 19
0
    public void completeRefreshment()
    {
        int OldAppID = 0;

        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));

        LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAccRefRecord = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
        LoanAccountDS.GetAccountRefreshmentRecordDataTable tblLoanAccRefRecord = loanAccRefRecord.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));
        OldAccount = tblLoanAccRefRecord[0].datOldAppID;

        if (tblLoanAcc.Rows.Count > 0)
        {
            createAccount(tblLoanAcc[0].datOutstandingAmount);
        }

        LoanDSTableAdapters.FinancialTransactionsTableAdapter FinTrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
        FinTrans.InsertFinancialTransaction(OldAppID,
                                            MySessionManager.ClientID,
                                            1,
                                            tblLoanAcc[0].datID,
                                            "Account Refreshed",
                                            "closed",
                                            0,
                                            tblLoanAcc[0].datTeamID,
                                            tblLoanAcc[0].datOutstandingAmount,
                                            0,
                                            0,
                                            0,
                                            0,
                                            MySessionManager.CurrentUser.UserID
                                            );

        LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
        loanAcRef.UpdateSetAccountClosed(Convert.ToInt32(MySessionManager.AccountID));


        loanAccRefRecord.UpdateNewAccountID(Convert.ToInt32(MySessionManager.AccountID), tblLoanAcc[0].datID);
    }
    protected void btnFreezeAccount_Click(object sender, EventArgs e)
    {
        try { 
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
            LoanAccountDSTableAdapters.FrozenAccountsTableAdapter loanFreeze = new LoanAccountDSTableAdapters.FrozenAccountsTableAdapter();
            loanFreeze.InsertFrozenAccount(Convert.ToInt32(MySessionManager.AccountID),
                                           tblLoanAccRow.datAccountNumber,
                                           tblLoanAccRow.datTeamID,
                                           tblLoanAccRow.datPurpose,
                                           tblLoanAccRow.datOutstandingAmount,
                                           tblLoanAccRow.datCategory,
                                           DateTime.Now,
                                           tblLoanAccRow.datCreditTeamID,
                                           tblLoanAccRow.datClientFullName,
                                           tblLoanAccRow.datAgingDate,
                                           tblLoanAccRow.datLoanType);

            loanAcc.UpdateSetFrozenAccount(Convert.ToInt32(MySessionManager.AccountID));
            ShowMessageBox("Account No.:" + tblLoanAccRow.datAccountNumber + "- " + tblLoanAccRow.datClientFullName + " has been frozen");
        }
        catch (Exception ex) { }
    }
Esempio n. 21
0
    protected void btnFreezeAccount_Click(object sender, EventArgs e)
    {
        try {
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            LoanAccountDS.GetLoanAccountRow tblLoanAccRow = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
            LoanAccountDSTableAdapters.FrozenAccountsTableAdapter loanFreeze = new LoanAccountDSTableAdapters.FrozenAccountsTableAdapter();
            loanFreeze.InsertFrozenAccount(Convert.ToInt32(MySessionManager.AccountID),
                                           tblLoanAccRow.datAccountNumber,
                                           tblLoanAccRow.datTeamID,
                                           tblLoanAccRow.datPurpose,
                                           tblLoanAccRow.datOutstandingAmount,
                                           tblLoanAccRow.datCategory,
                                           DateTime.Now,
                                           tblLoanAccRow.datCreditTeamID,
                                           tblLoanAccRow.datClientFullName,
                                           tblLoanAccRow.datAgingDate,
                                           tblLoanAccRow.datLoanType);

            loanAcc.UpdateSetFrozenAccount(Convert.ToInt32(MySessionManager.AccountID));
            ShowMessageBox("Account No.:" + tblLoanAccRow.datAccountNumber + "- " + tblLoanAccRow.datClientFullName + " has been frozen");
        }
        catch (Exception ex) { }
    }
    public void saveDisburse(int accid, decimal cash, decimal bank)
    {
        Decimal totalAmt = cash+bank;
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable  tblLoanAcc = loanAcc.GetLoanAccount(accid);
        if(tblLoanAcc.Rows.Count>0)
        {
            
        LoanDSTableAdapters.GetDisburseLoanTableAdapter disburse = new LoanDSTableAdapters.GetDisburseLoanTableAdapter();
        disburse.InsertDisburseLoan(accid,
                                    tblLoanAcc[0].datAccountNumber.ToString(),
                                    tblLoanAcc[0].datClientFullName.ToString(),
                                    DateTime.Now,
                                    tblLoanAcc[0].datEndDate,
                                    tblLoanAcc[0].datInterestRate,
                                    cash,
                                    bank,
                                    totalAmt,
                                    tblLoanAcc[0].datFees,
                                    tblLoanAcc[0].datLoanType,
                                    tblLoanAcc[0].datPurpose,
                                    tblLoanAcc[0].datTeamID,
                                    tblLoanAcc[0].datCreditTeamID,
                                    MySessionManager .CurrentUser.UserID);

             }
    }
    public void completeRefreshment()
    {
        int OldAppID=0;

        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));

        LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAccRefRecord = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
        LoanAccountDS.GetAccountRefreshmentRecordDataTable tblLoanAccRefRecord = loanAccRefRecord.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));
        OldAccount = tblLoanAccRefRecord[0].datOldAppID;

        if(tblLoanAcc.Rows.Count>0)
        {
         createAccount(tblLoanAcc[0].datOutstandingAmount);
        }

        LoanDSTableAdapters.FinancialTransactionsTableAdapter FinTrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
        FinTrans.InsertFinancialTransaction(OldAppID,
                                            MySessionManager.ClientID,
                                            1,
                                            tblLoanAcc[0].datID,
                                            "Account Refreshed",
                                            "closed",
                                            0,
                                            tblLoanAcc[0].datTeamID,
                                            tblLoanAcc[0].datOutstandingAmount,
                                            0,
                                            0,
                                            0,
                                            0,
                                            MySessionManager.CurrentUser.UserID
                                            );

        LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
        loanAcRef.UpdateSetAccountClosed(Convert.ToInt32(MySessionManager.AccountID));


        loanAccRefRecord.UpdateNewAccountID(Convert.ToInt32(MySessionManager.AccountID), tblLoanAcc[0].datID);

    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (MySessionManager.AppID > 0)
        {
            this.itemLoanApp.Visible     = true;
            this.ItemLoanAccount.Visible = false;
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            MySessionManager.ClientID = Convert.ToInt32(loanApp.getClientID(MySessionManager.AppID));

            try
            {
                mainDSTableAdapters.GetApplicationInfoTableAdapter appinfo = new mainDSTableAdapters.GetApplicationInfoTableAdapter();
                mainDS.GetApplicationInfoDataTable tblAppInfo = appinfo.GetApplicationInfo(MySessionManager.AppID);
                if (tblAppInfo.Rows.Count > 0)
                {
                    this.btnEditApp.HRef        = setUrls(MySessionManager.AppID);
                    this.btnViewAppTracker.HRef = "~/pages/applicationtracker.aspx?id=" + MyEncryption.Encrypt(MySessionManager.AppID.ToString(), "12345678910");
                    if (tblAppInfo[0].IsdatLoanAmountNull() == false)
                    {
                        this.lnAmt.InnerText = tblAppInfo[0].datLoanAmount.ToString("c").Replace("$", "");
                    }
                    if (tblAppInfo[0].IsdatLoanTypeNull() == false)
                    {
                        this.lnType.InnerText = tblAppInfo[0].datLoanType.ToString();
                    }
                    if (tblAppInfo[0].IsdatApplicationStatusNull() == false)
                    {
                        this.lnAppStatus.InnerText = tblAppInfo[0].datApplicationStatus.ToString();
                    }
                    if (tblAppInfo[0].IsdatDurationNull() == false)
                    {
                        this.lnDuration.InnerText = tblAppInfo[0].datDuration.ToString() + " month(s)";
                    }
                    if (tblAppInfo[0].IsdatBranchNull() == false)
                    {
                        this.lnAppBranch.InnerText = tblAppInfo[0].datBranch.ToString();
                    }
                    if (tblAppInfo[0].IsdatApplicationDateNull() == false)
                    {
                        this.lnAppDate.InnerText = tblAppInfo[0].datApplicationDate.ToLongDateString();
                    }
                }
            }
            catch (Exception ex) { }
        }
        else if (MySessionManager.AccountID > 0)
        {
            this.ItemLoanAccount.Visible = true;
            this.itemLoanApp.Visible     = false;
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            MySessionManager.ClientID = Convert.ToInt32(loanAcc.GetClientIDFromAcc(Convert.ToInt32(MySessionManager.AccountID)));

            try
            {
                mainDSTableAdapters.GetLoanAccountInfoTableAdapter accinfo = new mainDSTableAdapters.GetLoanAccountInfoTableAdapter();
                mainDS.GetLoanAccountInfoDataTable tblAccInfo = accinfo.GetLoanAccountInfo(Convert.ToInt32(MySessionManager.AccountID));
                if (tblAccInfo.Rows.Count > 0)
                {
                    if (tblAccInfo[0].IsdatOutstandingAmountNull() == false)
                    {
                        this.lnOutstanding.InnerText = tblAccInfo[0].datOutstandingAmount.ToString("c").Replace("$", "");
                    }
                    if (tblAccInfo[0].IsdatStartDateNull() == false)
                    {
                        this.lnStartDate.InnerText = tblAccInfo[0].datStartDate.ToLongDateString();
                    }
                    if (tblAccInfo[0].IsdatEndDateNull() == false)
                    {
                        this.lnEndDate.InnerText = tblAccInfo[0].datEndDate.ToLongDateString();
                    }
                    if (tblAccInfo[0].IsdatBranchNull() == false)
                    {
                        this.lnAccBranch.InnerText = tblAccInfo[0].datBranch.ToString();
                    }
                    this.btnTransactions.HRef   = "~/pages/transactions.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=entry";
                    this.btnViewStatement.HRef  = "~/pages/loanaccount/loanaccountdetails.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=2";
                    this.btnMonitorAccount.HRef = "~/pages/loanaccount/loanaccountdetails.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=1";
                }
            }
            catch (Exception ex) { }
        }

        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter clientInfo = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClientInfo = clientInfo.GetClientInfo(MySessionManager.ClientID);
            if (tblClientInfo.Rows.Count > 0)
            {
                if (tblClientInfo[0].IsdatClientNameNull() == false)
                {
                    clientname.InnerText = tblClientInfo[0].datClientName.ToString();
                }
                if (tblClientInfo[0].IsdatClientNumberNull() == false)
                {
                    clientNo.InnerText = tblClientInfo[0].datClientNumber.ToString();
                }
                if (tblClientInfo[0].IsdatMobileNumber1Null() == false)
                {
                    clMobile.InnerText = tblClientInfo[0].datMobileNumber1.ToString();
                }
            }
        }
        catch (Exception ex) { }
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        MySessionManager.cash = 0;
        MySessionManager.bank = 0;
        decimal amtDeductable = 0;
        decimal fees          = 0;
        decimal amt           = 0;
        int     ops           = 0;

        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        mTemp.GetTransactionDetailsDataTable tblTempHolder             = tempHolder.GetAccTransactions(Convert.ToInt32(MySessionManager.AccountID));
        LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
        int rows = tblTempHolder.Rows.Count;

        for (int i = 0; i < rows; i++)
        {
            int?datDebitAc  = null;
            int?datCreditAc = null;
            if (tblTempHolder[i].datDebit > 0)
            {
                datDebitAc    = tblTempHolder[i].datAccountID;
                amt           = tblTempHolder[i].datDebit;
                amtDeductable = amtDeductable + tblTempHolder[i].datDebit;
                ops           = 1;
            }
            else if (tblTempHolder[i].datCredit > 0)
            {
                datCreditAc   = tblTempHolder[i].datAccountID;
                amt           = tblTempHolder[i].datCredit;
                amtDeductable = amtDeductable - tblTempHolder[i].datCredit;
                ops           = 2;
            }
            //
            if (tblTempHolder[i].datPaymentMethod == 1)
            {
                getAmtForPaymentMode(amt, "cash", ops);
            }
            else if (tblTempHolder[i].datPaymentMethod == 2)
            {
                getAmtForPaymentMode(amt, "bank", ops);
            }

            fintrans.InsertFinancialTransaction(MySessionManager.AppID,
                                                MySessionManager.ClientID,
                                                tblTempHolder[i].datAccountID,
                                                Convert.ToInt32(MySessionManager.AccountID),
                                                tblTempHolder[i].datDescription,
                                                batch(),
                                                tblTempHolder[i].datPaymentMethod,
                                                MySessionManager.CurrentUser.BranchID,
                                                tblTempHolder[i].datCredit,
                                                tblTempHolder[i].datDebit,
                                                datCreditAc,
                                                datDebitAc,
                                                0,
                                                MySessionManager.CurrentUser.UserID);
        }

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc         = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoaonAcc                     = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
        LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter repayment = new LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter();

        if (tblLoaonAcc.Rows.Count > 0)
        {
            repayment.InsertLoanRepayment(receiptNo(),
                                          DateTime.Now,
                                          tblLoaonAcc[0].datID,
                                          tblLoaonAcc[0].datAccountNumber.ToString(),
                                          client.GetClientNo(Convert.ToInt32(MySessionManager.AccountID)),
                                          tblLoaonAcc[0].datIssueDate,
                                          tblLoaonAcc[0].datInterestRate,
                                          MySessionManager.cash,
                                          MySessionManager.bank,
                                          (MySessionManager.cash + MySessionManager.bank),
                                          fees,
                                          tblLoaonAcc[0].datLoanType,
                                          tblLoaonAcc[0].datPurpose,
                                          tblLoaonAcc[0].datTeamID,
                                          MySessionManager.CurrentUser.UserID);
        }

        loanAcc.UpdateNewAmtOutstanding(amtDeductable, Convert.ToInt32(MySessionManager.AccountID));

        decimal outstanding = Convert.ToDecimal(loanAcc.GetAmtOutstanding(Convert.ToInt32(MySessionManager.AccountID)));

        if (outstanding <= 0)
        {
            loanAcc.UpdateCloseAccount(Convert.ToInt32(MySessionManager.AccountID));
        }
        tempHolder.DeleteTempTransByAccID(Convert.ToInt32(MySessionManager.AccountID));
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        MySessionManager.cash = 0;
        MySessionManager.bank = 0;
        decimal amtDeductable= 0;
        decimal fees = 0;
        decimal amt =0;
        int ops =0;
        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        mTemp.GetTransactionDetailsDataTable tblTempHolder = tempHolder.GetAccTransactions(Convert.ToInt32( MySessionManager.AccountID));
        LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
        int rows = tblTempHolder.Rows.Count;

        for (int i = 0; i < rows; i++)
        {
            int? datDebitAc = null;
            int? datCreditAc = null;
            if (tblTempHolder[i].datDebit > 0)
            {
                datDebitAc = tblTempHolder[i].datAccountID;
                amt=tblTempHolder[i].datDebit;
                amtDeductable = amtDeductable + tblTempHolder[i].datDebit;
                ops = 1;
            }
            else if (tblTempHolder[i].datCredit > 0)
            {
                datCreditAc = tblTempHolder[i].datAccountID;
                amt = tblTempHolder[i].datCredit;
                amtDeductable = amtDeductable - tblTempHolder[i].datCredit;
                ops = 2;
            }
            //
            if (tblTempHolder[i].datPaymentMethod == 1)
            {
                getAmtForPaymentMode(amt,"cash",ops);
            }
            else if (tblTempHolder[i].datPaymentMethod == 2)
            {
                getAmtForPaymentMode(amt, "bank", ops); 
            }

            fintrans.InsertFinancialTransaction(MySessionManager.AppID,
                                                MySessionManager.ClientID,
                                                tblTempHolder[i].datAccountID,
                                                Convert.ToInt32(MySessionManager.AccountID),
                                                tblTempHolder[i].datDescription,
                                                batch(),
                                                tblTempHolder[i].datPaymentMethod,
                                                MySessionManager.CurrentUser.BranchID,
                                                tblTempHolder[i].datCredit,
                                                tblTempHolder[i].datDebit,
                                                datCreditAc,
                                                datDebitAc,
                                                0,
                                                MySessionManager.CurrentUser.UserID);
        }

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoaonAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
        LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter repayment = new LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter();

        if(tblLoaonAcc.Rows.Count>0)
        {
            repayment.InsertLoanRepayment(receiptNo(),
                                          DateTime.Now,
                                          tblLoaonAcc[0].datID,
                                          tblLoaonAcc[0].datAccountNumber.ToString(),
                                          client.GetClientNo(Convert.ToInt32(MySessionManager.AccountID)),
                                          tblLoaonAcc[0].datIssueDate,
                                          tblLoaonAcc[0].datInterestRate,
                                          MySessionManager.cash,
                                          MySessionManager.bank,
                                          (MySessionManager.cash + MySessionManager.bank),
                                          fees,
                                          tblLoaonAcc[0].datLoanType,
                                          tblLoaonAcc[0].datPurpose,
                                          tblLoaonAcc[0].datTeamID,
                                          MySessionManager.CurrentUser.UserID);
        }

        loanAcc.UpdateNewAmtOutstanding(amtDeductable,Convert.ToInt32(MySessionManager.AccountID));

        decimal outstanding=Convert.ToDecimal(loanAcc.GetAmtOutstanding(Convert.ToInt32(MySessionManager.AccountID)));
        if (outstanding <= 0)
        {
            loanAcc.UpdateCloseAccount(Convert.ToInt32(MySessionManager.AccountID));
        }
        tempHolder.DeleteTempTransByAccID(Convert.ToInt32(MySessionManager.AccountID));
    }
Esempio n. 27
0
    public void createNewApp()
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        string AppID;
        string AppNewID = "";

        try
        {
            LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter RefreshAccount = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
            LoanAccountDS.GetAccountRefreshmentRecordDataTable tblRefreshAccount = RefreshAccount.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));

            if (tblRefreshAccount.Rows.Count > 0)
            {
                MySessionManager.AppID = tblRefreshAccount[0].datNewAppID;
            }
            else
            {
                int?getAppID = null;

                AppID = tblLoanAcc.datApplicationID.ToString();
                LoanDSTableAdapters.LoanApplicationsTableAdapter          loanApp            = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter LoanAccRefreshment = new LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter();

                string appNo = loanApp.GetLoanApplicationNo(Convert.ToInt32(AppID)).ToString() + "-00";
                LoanAccRefreshment.InsertNewRefreshApp(MySessionManager.ClientID,
                                                       tblLoanAcc.datClientFullName.ToString(),
                                                       Convert.ToInt32(ddlLoanType.SelectedValue),
                                                       appNo,
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToInt32(txtDuration.Text),
                                                       1,
                                                       Convert.ToDecimal(txtIntRate.Text),
                                                       DateTime.Now,
                                                       Convert.ToDateTime(txtFirstPaymentDate.Text),
                                                       0,
                                                       Convert.ToInt32(ddlInterestRateType.SelectedValue),
                                                       Convert.ToInt32(AppID),
                                                       Convert.ToInt32(ddlCT.SelectedValue),
                                                       Convert.ToInt32(tblLoanAcc.datTeamID),
                                                       ref getAppID);

                AppNewID = getAppID.ToString();

                LoanAccRefreshment.InsertCopyAssets(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyAuditors(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyBankers(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyChecklist(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCollaterals(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyComments(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCorporateInfo(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCreditInformation(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyEnterprises(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFinancials(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyGuarantor(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIncomeExpense(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIntiator(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyLegalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNextOfKin(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNoOfEmployees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyOwnership(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPaymentPlan(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPDC(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPreApprovalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReligion(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyRiskReport(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySpouse(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySupportingDocuments(AppID, AppNewID);

                LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
                loanAcRef.InsertAccountRefreshment(Convert.ToInt32(MySessionManager.AccountID),
                                                   Convert.ToInt32(AppID));
                loanAcRef.UpdateNewAppID(Convert.ToInt32(AppNewID),
                                         Convert.ToInt32(MySessionManager.AccountID));
                MySessionManager.AppID = Convert.ToInt32(AppNewID);
            }
        }
        catch (Exception ex) { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (MySessionManager.CurrentUser == null)
        {
            Response.Redirect("~/login.aspx");
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        MySessionManager.AppID    = tblLoanAcc.datApplicationID;
        MySessionManager.ClientID = tblLoanAcc.datClientID;
        int LoanType = tblLoanAcc.datLoanType;

        setLoanTypeTabs(tblLoanAcc.datLoanType);
        setUrls();
        showLoanAppInfo();

        if (!(Request.QueryString["ops"] == null))
        {
            if (!(Request.QueryString["tab"] == null))
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                {
                    currentTab = Convert.ToInt32(MySessionManager.CurrentTab);
                }
                ops = Request.QueryString["ops"].ToString();
                setTab(currentTab);
                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";

                string urlpath = util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                urlpath = util.RemoveQueryStringByKey(urlpath, "ops");
                Response.Redirect(urlpath);
            }
            else
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                if (LoanType == 2 || LoanType == 3)
                {
                    currentTab = 2;
                }
                else
                {
                    currentTab = 0;
                }

                ops = "load";
                setTab(currentTab);

                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "ops");
            }
        }
        else
        {
            ops = MySessionManager.OpsTab.ToString();

            //For handling the tabs
            if (!(MySessionManager.CurrentTab == ""))
            {
                currentTab = int.Parse(MySessionManager.CurrentTab);
            }
            else
            if (LoanType == 2 || LoanType == 3)
            {
                currentTab = 2;
            }
            else
            {
                currentTab = 0;
            }
            setTab(currentTab);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (MySessionManager.AppID > 0)
        {
            this.itemLoanApp.Visible = true;
            this.ItemLoanAccount.Visible = false;
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            MySessionManager.ClientID = Convert.ToInt32(loanApp.getClientID(MySessionManager.AppID));

            try
            {
                mainDSTableAdapters.GetApplicationInfoTableAdapter appinfo = new mainDSTableAdapters.GetApplicationInfoTableAdapter();
                mainDS.GetApplicationInfoDataTable tblAppInfo = appinfo.GetApplicationInfo(MySessionManager.AppID);
                if (tblAppInfo.Rows.Count > 0)
                {
                    this.btnEditApp.HRef = setUrls(MySessionManager.AppID);
                    this.btnViewAppTracker.HRef = "~/pages/applicationtracker.aspx?id=" + MyEncryption.Encrypt(MySessionManager.AppID.ToString(), "12345678910");
                    if(tblAppInfo[0].IsdatLoanAmountNull()==false){this.lnAmt.InnerText = tblAppInfo[0].datLoanAmount.ToString("c").Replace("$", "");}
                    if (tblAppInfo[0].IsdatLoanTypeNull() == false) { this.lnType.InnerText = tblAppInfo[0].datLoanType.ToString(); }
                    if (tblAppInfo[0].IsdatApplicationStatusNull() == false) { this.lnAppStatus.InnerText = tblAppInfo[0].datApplicationStatus.ToString(); }
                    if (tblAppInfo[0].IsdatDurationNull() == false) { this.lnDuration.InnerText = tblAppInfo[0].datDuration.ToString() + " month(s)"; }
                    if (tblAppInfo[0].IsdatBranchNull() == false) { this.lnAppBranch.InnerText = tblAppInfo[0].datBranch.ToString(); }
                    if (tblAppInfo[0].IsdatApplicationDateNull() == false) { this.lnAppDate.InnerText = tblAppInfo[0].datApplicationDate.ToLongDateString(); }
                   
                }

            }
            catch (Exception ex) { }
        }
        else if(MySessionManager.AccountID > 0)
        {
            this.ItemLoanAccount.Visible = true;
            this.itemLoanApp.Visible = false;
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            MySessionManager.ClientID = Convert.ToInt32(loanAcc.GetClientIDFromAcc(Convert.ToInt32(MySessionManager.AccountID)));

            try
            {
                mainDSTableAdapters.GetLoanAccountInfoTableAdapter accinfo = new mainDSTableAdapters.GetLoanAccountInfoTableAdapter();
                mainDS.GetLoanAccountInfoDataTable tblAccInfo = accinfo.GetLoanAccountInfo(Convert.ToInt32(MySessionManager.AccountID));
                if (tblAccInfo.Rows.Count > 0)
                {
                    if (tblAccInfo[0].IsdatOutstandingAmountNull() == false) { this.lnOutstanding.InnerText = tblAccInfo[0].datOutstandingAmount.ToString("c").Replace("$", ""); }
                    if (tblAccInfo[0].IsdatStartDateNull() == false) { this.lnStartDate.InnerText = tblAccInfo[0].datStartDate.ToLongDateString(); }
                    if (tblAccInfo[0].IsdatEndDateNull() == false) { this.lnEndDate.InnerText = tblAccInfo[0].datEndDate.ToLongDateString(); }
                    if (tblAccInfo[0].IsdatBranchNull() == false) { this.lnAccBranch.InnerText = tblAccInfo[0].datBranch.ToString(); }
                    this.btnTransactions.HRef = "~/pages/transactions.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=entry";
                    this.btnViewStatement.HRef = "~/pages/loanaccount/loanaccountdetails.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=2";
                    this.btnMonitorAccount.HRef = "~/pages/loanaccount/loanaccountdetails.aspx?id" + MyEncryption.Encrypt(MySessionManager.AccountID.ToString(), "12345678910") + "&action=1";

                    
                }

            }
            catch (Exception ex) { }


        }

        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter clientInfo = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClientInfo = clientInfo.GetClientInfo(MySessionManager.ClientID);
            if (tblClientInfo.Rows.Count > 0)
            {
                if (tblClientInfo[0].IsdatClientNameNull() == false) { clientname.InnerText = tblClientInfo[0].datClientName.ToString(); }
                if (tblClientInfo[0].IsdatClientNumberNull() == false) {clientNo.InnerText = tblClientInfo[0].datClientNumber.ToString();}
                if (tblClientInfo[0].IsdatMobileNumber1Null() == false) { clMobile.InnerText = tblClientInfo[0].datMobileNumber1.ToString(); }
            }
        }
        catch (Exception ex) { }   
    }
    public void createAccount(decimal AmtOut1)
    {

       //LoanAccountDS. 

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        mainDS.ClientDataTable tblClient = client.GetClientProfile(MySessionManager.ClientID);

        decimal interestrate = Convert.ToDecimal(tblLoanApp[0].datInterestRate.ToString());

        decimal IntAmt = (Convert.ToDecimal(AmtOut1) * (interestrate / 100));
        interestamt = IntAmt;
        decimal AmtOut = Convert.ToDecimal(AmtOut1);
        decimal FinRptBalance_monthly = IntAmt + AmtOut;
        DateTime enddate = addMonth(DateTime.Now, Convert.ToInt32(tblLoanApp[0].datDuration.ToString()));

        if ((tblClient.Rows.Count > 0) || (tblLoanApp.Rows.Count > 0))
        {

            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter account = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            account.InsertLoanAccount(createAccountNumber(MySessionManager.ClientID),
                                      Convert.ToDecimal(tblLoanApp[0].datFees.ToString()),
                                      MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      Convert.ToInt32(tblLoanApp[0].datTeamID.ToString()),
                                      DateTime.Now,
                                      enddate,
                                      Convert.ToInt32(tblLoanApp[0].datInterestRate),
                                      Convert.ToInt32(tblLoanApp[0].datDuration.ToString()),
                                      0,
                                      IntAmt,
                                      AmtOut,
                                      FinRptBalance_monthly,
                                      MySessionManager.CurrentUser.UserID,
                                      FinRptBalance_monthly,
                                      DateTime.Now,
                                      DateTime.Now,
                                      Convert.ToInt32(tblLoanApp[0].datPurpose.ToString()),
                                      IntAmt,
                                      Convert.ToInt32(tblLoanApp[0].datRefreshedID.ToString()),
                                      Convert.ToInt32(tblLoanApp[0].datCreditTeamID.ToString()),
                                      tblClient[0].datClientName.ToString(),
                                      Convert.ToInt32(tblLoanApp[0].datLoanType.ToString()));
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAc = loanAc.GetLoanAccount1(MySessionManager.AppID, MySessionManager.ClientID);

        if (tblLoanAc.Rows.Count > 0)
        {
            MySessionManager.AccountID = tblLoanAc[0].datID;
            MySessionManager.AppBranchID = tblLoanApp[0].datTeamID;
        }

    }
    public void createNewApp()
    {
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        string AppID;
        string AppNewID = "";
        try
        {
            LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter RefreshAccount = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
            LoanAccountDS.GetAccountRefreshmentRecordDataTable tblRefreshAccount = RefreshAccount.GetAccountRefreshmentRecord(Convert.ToInt32(MySessionManager.AccountID));

            if (tblRefreshAccount.Rows.Count>0)
            {
                MySessionManager.AppID = tblRefreshAccount[0].datNewAppID;
            }
            else
            {
                int? getAppID = null;

                AppID = tblLoanAcc.datApplicationID.ToString();
                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter LoanAccRefreshment = new LoanAccountDSTableAdapters.AccountRefreshmentTableAdapter();

                string appNo = loanApp.GetLoanApplicationNo(Convert.ToInt32(AppID)).ToString() + "-00";
                LoanAccRefreshment.InsertNewRefreshApp(MySessionManager.ClientID,
                                                       tblLoanAcc.datClientFullName.ToString(),
                                                       Convert.ToInt32(ddlLoanType.SelectedValue),
                                                       appNo,
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToDecimal(txtLoanAmount.Text),
                                                       Convert.ToInt32(txtDuration.Text),
                                                       1,
                                                       Convert.ToDecimal(txtIntRate.Text),
                                                       DateTime.Now,
                                                       Convert.ToDateTime(txtFirstPaymentDate.Text),
                                                       0,
                                                       Convert.ToInt32(ddlInterestRateType.SelectedValue),
                                                       Convert.ToInt32(AppID),
                                                       Convert.ToInt32(ddlCT.SelectedValue),
                                                       Convert.ToInt32(tblLoanAcc.datTeamID),
                                                       ref getAppID);

                AppNewID = getAppID.ToString();

                LoanAccRefreshment.InsertCopyAssets(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyAuditors(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyBankers(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyChecklist(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCollaterals(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyComments(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCorporateInfo(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyCreditInformation(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyEnterprises(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyFinancials(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyGuarantor(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIncomeExpense(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyIntiator(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyLegalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNextOfKin(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyNoOfEmployees(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyOwnership(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPaymentPlan(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPDC(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyPreApprovalReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReligion(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyReports(AppID, AppNewID);
                LoanAccRefreshment.InsertCopyRiskReport(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySpouse(AppID, AppNewID);
                LoanAccRefreshment.InsertCopySupportingDocuments(AppID, AppNewID);

                LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter loanAcRef = new LoanAccountDSTableAdapters.GetAccountRefreshmentRecordTableAdapter();
                loanAcRef.InsertAccountRefreshment(Convert.ToInt32(MySessionManager.AccountID),
                                                   Convert.ToInt32(AppID));
                loanAcRef.UpdateNewAppID(Convert.ToInt32(AppNewID),
                                         Convert.ToInt32(MySessionManager.AccountID));
                MySessionManager.AppID = Convert.ToInt32(AppNewID);
            }
        }
        catch (Exception ex) { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (MySessionManager.CurrentUser == null)
        {
            Response.Redirect("~/login.aspx");
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter LoanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountRow tblLoanAcc = LoanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];

        MySessionManager.AppID = tblLoanAcc.datApplicationID;
        MySessionManager.ClientID = tblLoanAcc.datClientID;
        int LoanType = tblLoanAcc.datLoanType;
        setLoanTypeTabs(tblLoanAcc.datLoanType);
        setUrls();
        showLoanAppInfo();

        if (!(Request.QueryString["ops"] == null))
        {
            if (!(Request.QueryString["tab"] == null))
            {
                if (!(Request.QueryString["tab"] == ""))
                    currentTab = int.Parse(Request.QueryString["tab"]);
                else
                    currentTab = Convert.ToInt32(MySessionManager.CurrentTab);
                ops = Request.QueryString["ops"].ToString();
                setTab(currentTab);
                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab = "load";

                string urlpath = util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                urlpath = util.RemoveQueryStringByKey(urlpath, "ops");
                Response.Redirect(urlpath);
            }
            else
            {
                if (!(Request.QueryString["tab"] == ""))
                    currentTab = int.Parse(Request.QueryString["tab"]);
                else
                    if (LoanType == 2 || LoanType == 3)
                        currentTab = 2;
                    else
                        currentTab = 0;

                ops = "load";
                setTab(currentTab);

                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab = "load";
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "ops");
            }
        }
        else
        {
            ops = MySessionManager.OpsTab.ToString();

            //For handling the tabs
            if (!(MySessionManager.CurrentTab == ""))

                currentTab = int.Parse(MySessionManager.CurrentTab);
            else
                if (LoanType == 2 || LoanType == 3)
                    currentTab = 2;
                else
                    currentTab = 0;
            setTab(currentTab);
        } 
    }