Exemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();


            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

            InvApp.UpdateInvestmentApp(txtName.Value,
                                       clientname,
                                       GetApplicationNo(),
                                       0,
                                       Convert.ToInt32(ddlTerms.SelectedValue),
                                       Convert.ToDecimal(txtInvestmentAmt.Value),
                                       Convert.ToInt32(ddlType.SelectedValue),
                                       Convert.ToDecimal(txtRatePerAnnum.Value),
                                       Convert.ToInt32(ddlFrequencyInt.SelectedValue),
                                       Convert.ToInt32(ddlModeOfInv.SelectedValue),
                                       txtFunds.Value,
                                       Convert.ToInt32(ddlVerifed.SelectedValue),
                                       MySessionManager.InvAppID);

            loadInvestmentDetails();
        }
        catch (Exception ex) { }
        Response.Redirect(Request.RawUrl.ToString());
    }
    /// <summary>
    /// This function displays information about current application being worked
    /// </summary>
    public void showLoanAppInfo()
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);
        if (tblInvApp.Rows.Count > 0)
        {
            try
            {
                this.lblapplicantName.InnerText = client.GetClientsName(MySessionManager.ClientID).ToString();
                this.lblClientNo.InnerText = client.GetClientNo(MySessionManager.ClientID).ToString();
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false) { this.lblInvestmentAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$", ""); }
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatTermsNull() == false) { this.lblTerm.InnerText = util.displayValue("opt_terms", tblInvApp[0].datTerms.ToString()) + " days"; }
                if (tblInvApp[0].IsdatApplicationNumberNull() == false) { this.lblAppNo.InnerText = tblInvApp[0].datApplicationNumber.ToString(); }
                if (tblInvApp[0].IsdatValueDateNull() == false) { this.lblValueDate.InnerText = tblInvApp[0].datValueDate.ToString("c").Replace("$", ""); }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false) { this.lblInvtype.InnerText = util.displayValue("opt_investment_types", tblInvApp[0].datInvestmentType.ToString()); }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false) { this.lblAccInterest.InnerText = tblInvApp[0].datFrequencyOfInterestPayment.ToString(); }

            }
            catch (Exception ex)
            { }
        }

    }
    protected void btnApply_Click(object sender, EventArgs e)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();

        string EncID = this.ckey.Value;
        //Request.QueryString["id"];
        int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        int cType = Convert.ToInt32(client.GetClientType(DecID));

        if (ddlProducts.SelectedValue == "1")
        {
            int lType = 0;
            if (cType == 1)
            {
                lType = 1;
            }
            else if (cType == 2)
            {
                lType = 2;
            }
            else if (cType == 3)
            {
                lType = 4;
            }
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            string clientname = client.GetClientsName(DecID).ToString();

            loanApp.InsertNewApplication(DecID,
                                         clientname,
                                         lType,
                                         MySessionManager.CurrentUser.BranchID,
                                         MySessionManager.CurrentUser.UserID);
            ShowMessageBox("Loan Application for " + clientname + " submited successfully");
        }
        else if (ddlProducts.SelectedValue == "2")
        {
            string clientname = client.GetClientsName(DecID).ToString();

            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invapp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            invapp.InsertInvestmentApplication(DecID,
                                               clientname,
                                               1,
                                               MySessionManager.CurrentUser.BranchID);
            ShowMessageBox("Investment Application for " + clientname + " submited successfully");
        }
    }
    protected void btnApply_Click(object sender, EventArgs e)
    {

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        
        string EncID = this.ckey.Value;
            //Request.QueryString["id"];
        int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        int cType = Convert.ToInt32(client.GetClientType(DecID));
        if (ddlProducts.SelectedValue == "1")
        {
            int lType=0;
            if (cType == 1) { lType = 1; } else if (cType == 2) { lType = 2; } else if (cType == 3) { lType = 4; }
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            string clientname = client.GetClientsName(DecID).ToString();
           
            loanApp.InsertNewApplication(DecID,
                                         clientname,
                                         lType,
                                         MySessionManager.CurrentUser.BranchID,
                                         MySessionManager.CurrentUser.UserID);
            ShowMessageBox("Loan Application for " + clientname + " submited successfully");
        }
        else if(ddlProducts.SelectedValue=="2")
        {
             string clientname = client.GetClientsName(DecID).ToString();
           
             InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invapp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
             invapp.InsertInvestmentApplication(DecID,
                                                clientname,
                                                1,
                                                MySessionManager.CurrentUser.BranchID);
             ShowMessageBox("Investment Application for " + clientname + " submited successfully");
        
        
        }
    }
 public void showLoanAppInfo()
 {
     mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
     InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
     InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);
     if (tblInvApp.Rows.Count > 0)
     {
         try
         {
             this.lblapplicantName.InnerText = client.GetClientsName(MySessionManager.ClientID).ToString();
             this.lblClientNo.InnerText      = client.GetClientNo(MySessionManager.ClientID).ToString();
             if (tblInvApp[0].IsdatInvestmentAmountNull() == false)
             {
                 this.lblInvestmentAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$", "");
             }
             if (tblInvApp[0].IsdatInvestmentNameNull() == false)
             {
                 this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString();
             }
             if (tblInvApp[0].IsdatTermsNull() == false)
             {
                 this.lblTerm.InnerText = util.displayValue("opt_terms", tblInvApp[0].datTerms.ToString()) + " days";
             }
             if (tblInvApp[0].IsdatApplicationNumberNull() == false)
             {
                 this.lblAppNo.InnerText = tblInvApp[0].datApplicationNumber.ToString();
             }
             if (tblInvApp[0].IsdatValueDateNull() == false)
             {
                 this.lblValueDate.InnerText = tblInvApp[0].datValueDate.ToString("c").Replace("$", "");
             }
             if (tblInvApp[0].IsdatInvestmentTypeNull() == false)
             {
                 this.lblInvtype.InnerText = util.displayValue("opt_investment_types", tblInvApp[0].datInvestmentType.ToString());
             }
             if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false)
             {
                 this.lblAccInterest.InnerText = tblInvApp[0].datFrequencyOfInterestPayment.ToString();
             }
             if (tblInvApp[0].IsdatValueDateNull() == false)
             {
                 this.lblValueDate.InnerText = tblInvApp[0].datValueDate.ToString("dd-MM-yyyy");
             }
         }
         catch (Exception ex)
         { }
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {

            // pass the DateTimeFormat information to DateTime.Parse
            DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);
            try
            {
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int noyrs = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                    txtNoYrs.Value = "0";

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32(ddlFrequency.Text),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "1";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message.ToString());


            }
        }
    }
Exemplo n.º 7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            // pass the DateTimeFormat information to DateTime.Parse
            DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);
            try
            {
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int    noyrs      = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                {
                    txtNoYrs.Value = "0";
                }

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32(ddlFrequency.Text),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "1";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
      
        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        lblbranch.InnerText = util.displayValue("tbl_teams", loanApp.GetLoanAppBranch(MySessionManager.AppID, MySessionManager.ClientID).ToString());
        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        try
        { lblTotal.Text = tempHolder.GetTransTotalAmount(MySessionManager.AppID).ToString(); }
        catch (Exception ex)
        {
            lblTotal.Text = "0.00";
        }
        
        if (tblLoanApp.Rows.Count > 0)
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            lbltotalamt.InnerText = tblLoanApp[0].datLoanAmount.ToString("c").Replace("$", "");
            lbldate.InnerText = DateTime.Now.ToLongDateString();
            lblClient.InnerText = client.GetClientsName(MySessionManager.ClientID).ToString();
        
        }

        if (!(this.editskip.Value =="2"))
        {

        }
        if (!(Request.QueryString["trdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["trdelete"];
                tempHolder.DeleteTransactionDetails(Convert.ToInt32(id), MySessionManager.AppID);

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "trdelete"));
            }
            catch
            { }
        }
        
    }
Exemplo n.º 9
0
 public void showLoanAppInfo()
 {
     mainDSTableAdapters.ClientTableAdapter           client  = new mainDSTableAdapters.ClientTableAdapter();
     LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
     LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
     if (tblLoanApp.Rows.Count > 0)
     {
         try
         {
             this.lblapplicantName.InnerText = client.GetClientsName(MySessionManager.ClientID).ToString();
             this.lblInterestRate.InnerText  = tblLoanApp[0].datInterestRate.ToString("c").Replace("$", "") + "%";
             this.lblDuration.InnerText      = tblLoanApp[0].datDuration.ToString() + " month(s)";
             this.lblAppNo.InnerText         = tblLoanApp[0].datApplicationNumber.ToString();
             this.loanAmount.InnerText       = tblLoanApp[0].datLoanAmount.ToString("c").Replace("$", "");
             this.lblloantype.InnerText      = util.displayValue("opt_loan_types", tblLoanApp[0].datLoanType.ToString());
             this.lblClientNo.InnerText      = client.GetClientNo(MySessionManager.ClientID).ToString();
         }
         catch (Exception ex)
         { }
     }
 }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

        mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
        try
        { lblTotal.Text = tempHolder.GetTransTotalAmount(MySessionManager.AppID).ToString(); }
        catch (Exception ex)
        {
            lblTotal.Text = "0.00";
        }

        if (tblInvApp.Rows.Count > 0)
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            lbltotalamt.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$", "");
            lbldate.InnerText     = DateTime.Now.ToLongDateString();
            lblClient.InnerText   = client.GetClientsName(MySessionManager.ClientID).ToString();
            lblbranch.InnerText   = util.displayValue("tbl_teams", InvApp.GetInvBranch(MySessionManager.InvAppID).ToString());
        }

        if (!(this.editskip.Value == "2"))
        {
        }
        if (!(Request.QueryString["trdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["trdelete"];
                tempHolder.DeleteTransactionDetails(Convert.ToInt32(id), MySessionManager.AppID);

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "trdelete"));
            }
            catch
            { }
        }
    }
    public void showLoanAppInfo()
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            try
            {
                this.lblapplicantName.InnerText = client.GetClientsName(MySessionManager.ClientID).ToString();
                this.lblInterestRate.InnerText = tblLoanApp[0].datInterestRate.ToString("c").Replace("$", "") + "%";
                this.lblDuration.InnerText = tblLoanApp[0].datDuration.ToString() + " month(s)";
                this.lblAppNo.InnerText = tblLoanApp[0].datApplicationNumber.ToString();
                this.loanAmount.InnerText = tblLoanApp[0].datLoanAmount.ToString("c").Replace("$", "");
                this.lblloantype.InnerText = util.displayValue("opt_loan_types", tblLoanApp[0].datLoanType.ToString());
                this.lblClientNo.InnerText = client.GetClientNo(MySessionManager.ClientID).ToString();
            }
            catch (Exception ex)
            { }
        }

    }
    protected void gvClients_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int terms = 0;
            InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
            InvestmentAccountDS.GetInvAccountDataTable tblInvAcc = InvAcc.GetInvAccount(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex].Value));
            string   enpValue = MyEncryption.Encrypt(this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString(), "12345678910");
            DateTime dt       = DateTime.Parse(gvClients.DataKeys[e.Row.RowIndex]["datValueDate"].ToString());
            e.Row.Cells[0].Text = client.GetClientsName(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datClientID"].ToString())).ToString();
            e.Row.Cells[4].Text = util.displayValue("opt_investment_types", gvClients.DataKeys[e.Row.RowIndex]["datInvestmentType"].ToString());
            terms = Convert.ToInt32(util.displayValue("opt_terms", gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString()));
            int   freq    = Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString());
            Panel ItemBox = new Panel();
            ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
            ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
            ItemBox.Attributes.Add("class", "ItemContainer");
            ItemBox.Style.Add("display", "none");
            string htmlContent = "<div class='col-md-9' style='padding-top:0'><label> Matured Interest(s) </label><br/>";
            if (tblInvAcc[0].dat30 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=30&val=" + tblInvAcc[0].dat30.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 30).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat60 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=60&val=" + tblInvAcc[0].dat60.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 60).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat91 > 0 && freq == 2)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=91&val=" + tblInvAcc[0].dat91.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 90).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat121 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=121&val=" + tblInvAcc[0].dat121.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 121).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat151 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=151&val=" + tblInvAcc[0].dat151.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 151).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat182 > 0 && freq == 3)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=182&val=" + tblInvAcc[0].dat182.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 182).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat212 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=212&val=" + tblInvAcc[0].dat212.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 212).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat242 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/iinterestmaturity.aspx?id=" + enpValue + "&schID=242&val=" + tblInvAcc[0].dat242.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 242).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat273 > 0 && freq == 2)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=273&val=" + tblInvAcc[0].dat273.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 273).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat303 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=303&val=" + tblInvAcc[0].dat303.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat333 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=333&val=" + tblInvAcc[0].dat333.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat364 > 0 && freq == 4)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=364&val=" + tblInvAcc[0].dat364.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 364).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            htmlContent += "</div>";

            Literal ItemContent = new Literal();
            ItemContent.Text = htmlContent;
            ItemBox.Controls.Add(ItemContent);

            HyperLink hyp = new HyperLink();
            hyp.NavigateUrl = "javascript:showinfo('div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString() + "')";
            hyp.Text        = e.Row.Cells[0].Text;
            e.Row.Cells[0].Controls.Add(hyp);
            e.Row.Cells[0].Controls.Add(ItemBox);

            //HyperLink clientProfile = (HyperLink)e.Row.FindControl("hyperClientProfile");
            //HyperLink Inv = (HyperLink)e.Row.FindControl("hyperInv");
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                // this.dtCompare.Visible = true;

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);

                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int    noyrs      = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                {
                    txtNoYrs.Value = "0";
                }

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32("0"),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "2";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            #region Obsolete
            //try
            //{
            //    mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            //    string clientname = client.GetClientName(MySessionManager.ClientID)[0].datClientName.ToString();

            //int noofyrs = 0;
            //DateTime dt = DateTime.Parse(txtFirstPaymentDate.Text);
            //if (!(txtNoYrs.Value==""))
            //{
            //    noofyrs = Convert.ToInt32(txtNoYrs.Value.Trim());
            //}

            //LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            //loanApp.Update_IntialInterview(MySessionManager.AppID,
            //                               0,
            //                               Convert.ToInt32(ddlLoanType.Text),
            //                               txtNatureOfBusiness.Value.Trim(),
            //                               ddlTypeOfBusiness.Text,
            //                               Convert.ToInt32 (noofyrs),
            //                               Convert.ToDecimal(txtAveMonthlyIncome.Value.Trim()),
            //                               GenerateAppNumber(),
            //                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
            //                               0,
            //                               0,
            //                               clientname,
            //                               Convert.ToInt32(txtDuration.Value.Trim()),
            //                               Convert.ToInt32(ddlloanpurpose.Text),
            //                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
            //                               dt,
            //                               Convert.ToInt32(ddlFrequency.Text),
            //                               Convert.ToInt32(ddlInterestRate.Text),
            //                               "");

            //}
            //catch
            //{
            //}
            #endregion
        }
        else
        {
            // this.vIntialAssesment.ErrorMessage =
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                // this.dtCompare.Visible = true;

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);

                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int noyrs = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                    txtNoYrs.Value = "0";

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32("0"),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "2";

                //loadLoanDetails(MySessionManager.AppID);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            #region Obsolete
            //try
            //{
            //    mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            //    string clientname = client.GetClientName(MySessionManager.ClientID)[0].datClientName.ToString();

            //int noofyrs = 0;
            //DateTime dt = DateTime.Parse(txtFirstPaymentDate.Text);
            //if (!(txtNoYrs.Value==""))
            //{
            //    noofyrs = Convert.ToInt32(txtNoYrs.Value.Trim());
            //}

            //LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            //loanApp.Update_IntialInterview(MySessionManager.AppID,
            //                               0,
            //                               Convert.ToInt32(ddlLoanType.Text),
            //                               txtNatureOfBusiness.Value.Trim(),
            //                               ddlTypeOfBusiness.Text,
            //                               Convert.ToInt32 (noofyrs),
            //                               Convert.ToDecimal(txtAveMonthlyIncome.Value.Trim()),
            //                               GenerateAppNumber(),
            //                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
            //                               0,
            //                               0,
            //                               clientname,
            //                               Convert.ToInt32(txtDuration.Value.Trim()),
            //                               Convert.ToInt32(ddlloanpurpose.Text),
            //                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
            //                               dt,
            //                               Convert.ToInt32(ddlFrequency.Text),
            //                               Convert.ToInt32(ddlInterestRate.Text),
            //                               "");

            //}
            //catch
            //{
            //} 
            #endregion
        }
        else
        {
          // this.vIntialAssesment.ErrorMessage = 
        
        
        }

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();


            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

            InvApp.UpdateInvestmentApp(txtName.Value,
                                       clientname,
                                       GetApplicationNo(),
                                       0,
                                       Convert.ToInt32(ddlTerms.SelectedValue),
                                       Convert.ToDecimal(txtInvestmentAmt.Value),
                                       Convert.ToInt32(ddlType.SelectedValue),
                                       Convert.ToDecimal(txtRatePerAnnum.Value),
                                       Convert.ToInt32(ddlFrequencyInt.SelectedValue),
                                       Convert.ToInt32(ddlModeOfInv.SelectedValue),
                                       txtFunds.Value,
                                       Convert.ToInt32(ddlVerifed.SelectedValue),
                                       MySessionManager.InvAppID);

            loadInvestmentDetails();
        }
        catch (Exception ex) { }
        Response.Redirect(Request.RawUrl .ToString());
    }
    protected void gvClients_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
             int terms=0;
             InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
             InvestmentAccountDS.GetInvAccountDataTable tblInvAcc = InvAcc.GetInvAccount(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex].Value));
             string enpValue = MyEncryption.Encrypt(this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString(), "12345678910");
             DateTime dt =DateTime.Parse(gvClients.DataKeys[e.Row.RowIndex]["datValueDate"].ToString());
             e.Row.Cells[0].Text = client.GetClientsName(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datClientID"].ToString())).ToString();
             e.Row.Cells[4].Text = util.displayValue("opt_investment_types", gvClients.DataKeys[e.Row.RowIndex]["datInvestmentType"].ToString());
             terms = Convert.ToInt32(util.displayValue("opt_terms", gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString()));
             int freq = Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString());
             Panel ItemBox = new Panel();
             ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
             ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
             ItemBox.Attributes.Add("class", "ItemContainer");
             ItemBox.Style.Add("display", "none");
             string htmlContent = "<div class='col-md-9' style='padding-top:0'><label> Matured Interest(s) </label><br/>";
             if (tblInvAcc[0].dat30 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=30&val=" + tblInvAcc[0].dat30.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 30).ToString("dd/MM/yyyy") + "</a> <br/>";   
             }
             if (tblInvAcc[0].dat60 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=60&val=" + tblInvAcc[0].dat60.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 60).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat91 > 0 && freq == 2)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=91&val=" + tblInvAcc[0].dat91.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 90).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat121 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=121&val=" + tblInvAcc[0].dat121.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 121).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat151 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=151&val=" + tblInvAcc[0].dat151.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 151).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat182 > 0 && freq == 3)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=182&val=" + tblInvAcc[0].dat182.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 182).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat212 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=212&val=" + tblInvAcc[0].dat212.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 212).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat242 > 0 && freq ==1)
             {
                 htmlContent += "<a href=../pages/invaccount/iinterestmaturity.aspx?id=" + enpValue + "&schID=242&val=" + tblInvAcc[0].dat242.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 242).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat273 > 0 && freq == 2)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=273&val=" + tblInvAcc[0].dat273.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 273).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat303 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=303&val=" + tblInvAcc[0].dat303.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat333 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=333&val=" + tblInvAcc[0].dat333.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat364 > 0 && freq == 4)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=364&val=" + tblInvAcc[0].dat364.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 364).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             htmlContent += "</div>";

             Literal ItemContent = new Literal();
             ItemContent.Text = htmlContent;
             ItemBox.Controls.Add(ItemContent);

             HyperLink hyp = new HyperLink();
             hyp.NavigateUrl = "javascript:showinfo('div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString() + "')";
             hyp.Text = e.Row.Cells[0].Text;
             e.Row.Cells[0].Controls.Add(hyp);
             e.Row.Cells[0].Controls.Add(ItemBox);
             
            //HyperLink clientProfile = (HyperLink)e.Row.FindControl("hyperClientProfile");
             //HyperLink Inv = (HyperLink)e.Row.FindControl("hyperInv");

        }
    }