/// <summary>
    /// Loads  the record of the selected application  
    /// </summary>
    public void loadInvSummary()
    {
        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter client = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClient = client.GetClientInfo(MySessionManager.ClientID);
            if(tblClient.Rows.Count>0)
            {
                if(tblClient[0].IsdatClientNameNull()==false ){lblClientName.InnerText = tblClient[0].datClientName.ToString();}
                if(tblClient[0].IsdatClientNumberNull()==false ){lblClientNo.InnerText = tblClient[0].datClientNumber.ToString();}
                if(tblClient[0].IsdatMobileNumber1Null()==false ){lblMobile1.InnerText = tblClient[0].datMobileNumber1.ToString();}

            
            
            }

            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0) 
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false) { this.lblRatePerAnnum.InnerText = tblInvApp[0].datInterestRatePerAnnum.ToString("c").Replace("$",""); }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false) { this.lblType.InnerText =util.displayValue("opt_investment_types" ,tblInvApp[0].datInvestmentType.ToString()); }
                if (tblInvApp[0].IsdatTermsNull() == false) { this.lblTerms.InnerText =util.displayValue("opt_terms" , tblInvApp[0].datTerms.ToString())+" days"; }
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false) { this.lblModeOfInv.InnerText = util.displayValue("opt_payment_modes", tblInvApp[0].datModeOfRepayment.ToString()); }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false) { this.lblFreqPayment.InnerText = util.displayValue("opt_frequencies_investments", tblInvApp[0].datFrequencyOfInterestPayment.ToString()); }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false) { this.lblAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$",""); }
                if (tblInvApp[0].IsdatValueDateNull() == false) { this.txtValue.Text = tblInvApp[0].datValueDate.ToString("dd-MM-yyyy"); }  
            }
        }
        catch (Exception ex) { }







    }
    /// <summary>
    /// Loads  the record of the selected application
    /// </summary>
    public void loadInvSummary()
    {
        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter client = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClient = client.GetClientInfo(MySessionManager.ClientID);
            if (tblClient.Rows.Count > 0)
            {
                if (tblClient[0].IsdatClientNameNull() == false)
                {
                    lblClientName.InnerText = tblClient[0].datClientName.ToString();
                }
                if (tblClient[0].IsdatClientNumberNull() == false)
                {
                    lblClientNo.InnerText = tblClient[0].datClientNumber.ToString();
                }
                if (tblClient[0].IsdatMobileNumber1Null() == false)
                {
                    lblMobile1.InnerText = tblClient[0].datMobileNumber1.ToString();
                }
            }

            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false)
                {
                    this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString();
                }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false)
                {
                    this.lblRatePerAnnum.InnerText = tblInvApp[0].datInterestRatePerAnnum.ToString("c").Replace("$", "");
                }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false)
                {
                    this.lblType.InnerText = util.displayValue("opt_investment_types", tblInvApp[0].datInvestmentType.ToString());
                }
                if (tblInvApp[0].IsdatTermsNull() == false)
                {
                    this.lblTerms.InnerText = util.displayValue("opt_terms", tblInvApp[0].datTerms.ToString()) + " days";
                }
                if (tblInvApp[0].IsdatInvestmentNameNull() == false)
                {
                    this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString();
                }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false)
                {
                    this.lblModeOfInv.InnerText = util.displayValue("opt_payment_modes", tblInvApp[0].datModeOfRepayment.ToString());
                }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false)
                {
                    this.lblFreqPayment.InnerText = util.displayValue("opt_frequencies_investments", tblInvApp[0].datFrequencyOfInterestPayment.ToString());
                }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false)
                {
                    this.lblAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$", "");
                }
                if (tblInvApp[0].IsdatValueDateNull() == false)
                {
                    this.txtValue.Text = tblInvApp[0].datValueDate.ToString("dd-MM-yyyy");
                }
            }
        }
        catch (Exception ex) { }
    }
    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 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) { }
    }