public void loadfee(int id)
    {
        LoanDSTableAdapters.LoanFeesTableAdapter fees = new LoanDSTableAdapters.LoanFeesTableAdapter();
        LoanDS.LoanFeesDataTable tblLoanFees          = fees.GetLoanFeeDetails(id);

        if (tblLoanFees.Rows.Count > 0)
        {
            txtAmt.Value                 = tblLoanFees[0].datAmount.ToString();
            txtPercentage.Value          = tblLoanFees[0].datPercentage.ToString();
            ddlFee.SelectedIndex         = ddlFee.Items.IndexOf(ddlFee.Items.FindByValue(tblLoanFees[0].datFeeTypeID.ToString()));
            ddlPaymentMode.SelectedIndex = ddlPaymentMode.Items.IndexOf(ddlPaymentMode.Items.FindByValue(tblLoanFees[0].datFeePaymentID.ToString()));
            this.editskip.Value          = "2";
        }
    }
    public void updateLoanAmount(string type, decimal value, int pmode, int id)
    {
        decimal loanAmt    = 0;
        decimal diburseAmt = 0;
        decimal pplanAmt   = 0;
        decimal fees       = 0;

        LoanDSTableAdapters.LoanFeesTableAdapter fee = new LoanDSTableAdapters.LoanFeesTableAdapter();

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            loanAmt    = tblLoanApp[0].datLoanAmount;
            diburseAmt = tblLoanApp[0].datDisburseAmount;
            pplanAmt   = tblLoanApp[0].datPaymentPlanAmount;
            try
            {
                fees = tblLoanApp[0].datFees;
            }
            catch (Exception ex)
            {
                fees = 0;
            }


            if (type == "delete")
            {
                LoanDS.LoanFeesDataTable tblfee = fee.GetLoanFeeDetails(id);
                pmode = tblfee[0].datFeePaymentID;
                value = tblfee[0].datAmount;
                if (pmode == 1)
                {
                    diburseAmt = diburseAmt - value;
                    pplanAmt   = pplanAmt - value;
                }
                else if (pmode == 2)
                {
                    diburseAmt = diburseAmt + value;
                }
                else if (pmode == 3)
                {
                    fees = fees - value;
                }
            }
            else if (type == "add")
            {
                if (pmode == 1)
                {
                    diburseAmt = diburseAmt + value;
                    pplanAmt   = pplanAmt + value;
                }
                else if (pmode == 2)
                {
                    diburseAmt = diburseAmt - value;
                }
                else if (pmode == 3)
                {
                    fees = fees + value;
                }
            }
        }
        loanApp.UpdateLoanAmountComponents(diburseAmt, pplanAmt, fees, MySessionManager.AppID, MySessionManager.ClientID);
    }