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");
        
        
        }
    }