protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            LoanDSTableAdapters.LoanFeesTableAdapter fee = new LoanDSTableAdapters.LoanFeesTableAdapter();
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            decimal amt = Convert.ToDecimal(txtAmt.Value.Trim());
            int pmode = Convert.ToInt32(ddlPaymentMode.Text);
            if (!(type == "update"))
            {

                fee.InsertLoanFee(MySessionManager.ClientID,
                                  MySessionManager.AppID,
                                  Convert.ToInt32(ddlFee.Text),
                                  pmode,
                                  Convert.ToDecimal(txtPercentage.Value),
                                  amt);
            }
            else if (type == "update")
            {
                fee.UpdateLoanFees(Convert.ToInt32(ddlFee.Text),
                                   Convert.ToInt32(ddlPaymentMode.Text),
                                   Convert.ToDecimal(txtPercentage.Value),
                                   amt,
                                   id);
            }
            updateLoanAmount("add", amt, pmode, 0);
            Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fedit"));
        }
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         LoanDSTableAdapters.LoanFeesTableAdapter         fee     = new LoanDSTableAdapters.LoanFeesTableAdapter();
         LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
         decimal amt   = Convert.ToDecimal(txtAmt.Value.Trim());
         int     pmode = Convert.ToInt32(ddlPaymentMode.Text);
         if (!(type == "update"))
         {
             fee.InsertLoanFee(MySessionManager.ClientID,
                               MySessionManager.AppID,
                               Convert.ToInt32(ddlFee.Text),
                               pmode,
                               Convert.ToDecimal(txtPercentage.Value),
                               amt);
         }
         else if (type == "update")
         {
             fee.UpdateLoanFees(Convert.ToInt32(ddlFee.Text),
                                Convert.ToInt32(ddlPaymentMode.Text),
                                Convert.ToDecimal(txtPercentage.Value),
                                amt,
                                id);
         }
         updateLoanAmount("add", amt, pmode, 0);
         Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fedit"));
     }
 }