protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString["id"] != null)
            {
                int id=Convert.ToInt32(Request.QueryString["id"]);
                string val = Request.QueryString["action"];
                 LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                if (val=="reinstate")
                {
                   
                    LoanDS.LoanApplicationsRow rLoanApp = loanApp.GetLoanApplication(id.ToString())[0];
                    if (rLoanApp.IsdatReinstateIDNull() == false)
                    {
                        int reinstateid = rLoanApp.datReinstateID;
                        loanApp.UpdateAppReinstate(reinstateid, id);
                    }
                    
                }
                else if( val=="delete")
                {
                    loanApp.UpdateAppReinstate(null, id);
                
                }


            }

        }catch(Exception ex){}

    }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString["id"] != null)
         {
             int    id  = Convert.ToInt32(Request.QueryString["id"]);
             string val = Request.QueryString["action"];
             LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
             if (val == "reinstate")
             {
                 LoanDS.LoanApplicationsRow rLoanApp = loanApp.GetLoanApplication(id.ToString())[0];
                 if (rLoanApp.IsdatReinstateIDNull() == false)
                 {
                     int reinstateid = rLoanApp.datReinstateID;
                     loanApp.UpdateAppReinstate(reinstateid, id);
                 }
             }
             else if (val == "delete")
             {
                 loanApp.UpdateAppReinstate(null, id);
             }
         }
     }catch (Exception ex) {}
 }
    public void createAccount()
    {
        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        mainDSTableAdapters.ClientTableAdapter           client  = new mainDSTableAdapters.ClientTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        mainDS.ClientDataTable           tblClient  = client.GetClientProfile(MySessionManager.ClientID);

        decimal interestrate = Convert.ToDecimal(tblLoanApp[0].datInterestRate.ToString());

        decimal IntAmt = (Convert.ToDecimal(lbltotalamt.InnerText) * (interestrate / 100));

        interestamt = IntAmt;
        decimal  AmtOut = Convert.ToDecimal(lbltotalamt.InnerText);
        decimal  FinRptBalance_monthly = IntAmt + AmtOut;
        DateTime enddate = addMonth(DateTime.Now, Convert.ToInt32(tblLoanApp[0].datDuration.ToString()));

        if ((tblClient.Rows.Count > 0) || (tblLoanApp.Rows.Count > 0))
        {
            int refreshedID = 0;
            if (tblLoanApp[0].IsdatRefreshedIDNull() == false)
            {
                refreshedID = tblLoanApp[0].datRefreshedID;
            }
            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter account = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            account.InsertLoanAccount(createAccountNumber(MySessionManager.ClientID),
                                      Convert.ToDecimal(tblLoanApp[0].datFees.ToString()),
                                      MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      Convert.ToInt32(tblLoanApp[0].datTeamID.ToString()),
                                      DateTime.Now,
                                      enddate,
                                      Convert.ToInt32(tblLoanApp[0].datInterestRate),
                                      Convert.ToInt32(tblLoanApp[0].datDuration.ToString()),
                                      0,
                                      IntAmt,
                                      AmtOut,
                                      FinRptBalance_monthly,
                                      MySessionManager.CurrentUser.UserID,
                                      FinRptBalance_monthly,
                                      DateTime.Now,
                                      DateTime.Now,
                                      Convert.ToInt32(tblLoanApp[0].datPurpose.ToString()),
                                      IntAmt,
                                      refreshedID,
                                      Convert.ToInt32(tblLoanApp[0].datCreditTeamID.ToString()),
                                      tblClient[0].datClientName.ToString(),
                                      Convert.ToInt32(tblLoanApp[0].datLoanType.ToString()));
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAc = loanAc.GetLoanAccount1(MySessionManager.AppID, MySessionManager.ClientID);

        if (tblLoanAc.Rows.Count > 0)
        {
            MySessionManager.AccountID   = tblLoanAc[0].datID;
            MySessionManager.AppBranchID = tblLoanApp[0].datTeamID;
        }
    }
예제 #4
0
 public void loadLoanDetails(int AppID)
 {
     try{
         // DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, usCulture.DateTimeFormat).To;
         LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
         LoanDS.LoanApplicationsDataTable loanAppDetails          = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
         if (loanAppDetails.Rows.Count > 0)
         {
             txtLoanAmount.Value      = loanAppDetails[0].datLoanAmount.ToString();
             txtDuration.Value        = loanAppDetails[0].datDuration.ToString();
             txtFirstPaymentDate.Text = DateTime.Parse(loanAppDetails[0].datFirstPaymentDate.ToString()).ToString("dd-MM-yyyy");
             txtNoYrs.Value           = loanAppDetails[0].datNumberOfYears.ToString();
             txtInterestrate.Value    = loanAppDetails[0].datInterestRate.ToString();
             if (loanAppDetails[0].IsdatLoanTypeNull() == false)
             {
                 ddlLoanType.SelectedValue = loanAppDetails[0].datLoanType.ToString();
             }
             if (loanAppDetails[0].IsdatInterestRateNull() == false)
             {
                 ddlInterestRate.SelectedValue = loanAppDetails[0].datInterestRateType.ToString();
             }
             if (loanAppDetails[0].IsdatPurposeNull() == false)
             {
                 ddlloanpurpose.SelectedValue = loanAppDetails[0].datPurpose.ToString();
             }
             if (loanAppDetails[0].IsdatTypeOfBusinessNull() == false)
             {
                 ddlTypeOfBusiness.SelectedValue = loanAppDetails[0].datTypeOfBusiness.ToString();
             }
             if (loanAppDetails[0].IsdatAveMonthlyIncomeNull() == false)
             {
                 txtAveMonthlyIncome.Value = loanAppDetails[0].datAveMonthlyIncome.ToString();
             }
             if (loanAppDetails[0].IsdatNatureOfBusinessNull() == false)
             {
                 txtNatureOfBusiness.Value = loanAppDetails[0].datNatureOfBusiness.ToString();
             }
             string ApNo = loanAppDetails[0].datApplicationNumber.ToString();
             if (ApNo == "")
             {
                 this.appCode.Value = (100000 + (Convert.ToInt32(loanAppDetails[0].datID.ToString()))).ToString();
             }
             else
             {
                 this.appCode.Value = loanAppDetails[0].datApplicationNumber.ToString();
             }
             this.editskip.Value = "2";
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
    public void loadLoanDetails(int AppID)
    {
        try
        {

            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            LoanDS.LoanApplicationsDataTable loanAppDetails = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
            if (loanAppDetails.Rows.Count > 0)
            {
                string ApNo;
                
                try { ApNo = loanAppDetails[0].datApplicationNumber.ToString(); }
                catch (Exception ex) { ApNo = ""; }
                if (ApNo == "")
                {
                    this.appCode.Value = (100000 + (Convert.ToInt32(loanAppDetails[0].datID.ToString()))).ToString();
                }
                else
                {
                    this.appCode.Value = loanAppDetails[0].datApplicationNumber.ToString();
                }
                this.editskip.Value = "2";
                if (loanAppDetails[0].IsdatLoanAmountNull() == false) { txtLoanAmount.Value = loanAppDetails[0].datLoanAmount.ToString(); }
                if (loanAppDetails[0].IsdatDurationNull() == false) { txtDuration.Value = loanAppDetails[0].datDuration.ToString();}
                if (loanAppDetails[0].IsdatFirstPaymentDateNull() == false) { txtFirstPaymentDate.Text = DateTime.Parse(loanAppDetails[0].datFirstPaymentDate.ToString()).ToString("dd-MM-yyyy");}
                if (loanAppDetails[0].IsdatInterestRateNull() == false) { txtInterestrate.Value = loanAppDetails[0].datInterestRate.ToString(); }
                try
                {
                    ddlLoanType.ClearSelection();
                    ddlTypeOfBusiness.ClearSelection();
                    ddlloanpurpose.ClearSelection();
                    ddlInterestRate.ClearSelection();
                    if (loanAppDetails[0].IsdatLoanTypeNull()==false) { ddlLoanType.SelectedValue = loanAppDetails[0].datLoanType.ToString(); }
                    if (loanAppDetails[0].IsdatInterestRateTypeNull()==false) { ddlInterestRate.SelectedValue = loanAppDetails[0].datInterestRateType.ToString(); }
                    if (loanAppDetails[0].IsdatPurposeNull()==false) { ddlloanpurpose.SelectedValue = loanAppDetails[0].datPurpose.ToString(); }
                    if (loanAppDetails[0].IsdatTypeOfBusinessNull()==false) { ddlTypeOfBusiness.SelectedValue = loanAppDetails[0].datTypeOfBusiness.ToString(); }

                }
                catch (Exception ex) { }
                

                txtAveMonthlyIncome.Value = loanAppDetails[0].datAveMonthlyIncome.ToString();
                
               
            }
            else
            { }

        }
        catch (Exception ex)
        {

            Console.WriteLine(ex.Message);

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Utility util = new Utility();

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(Convert.ToString(MySessionManager.AppID));
        if (tblLoanApp.Rows.Count > 0)
        {
            if (!(this.editskip.Value == "2"))
            {
                if (tblLoanApp[0].IsdatDurationNull() == false)
                {
                    txtperiod.Text = tblLoanApp[0].datDuration.ToString();
                }
                if (tblLoanApp[0].IsdatInterestRateNull() == false)
                {
                    txtinterestrate.Text = tblLoanApp[0].datInterestRate.ToString();
                }
                if (tblLoanApp[0].IsdatInterestRateTypeNull() == false)
                {
                    txtinterestrateType.Text = util.displayValue("opt_interest_rate_types", tblLoanApp[0].datInterestRateType.ToString());
                }
                if (tblLoanApp[0].IsdatFirstPaymentDateNull() == false)
                {
                    txtfirstpaymentdate.Text = tblLoanApp[0].datFirstPaymentDate.ToString("dd-MM-yyyy");
                }
                txtFrequency.Text = util.displayValue("opt_frequencies", tblLoanApp[0].datFrequency.ToString());
                if (tblLoanApp[0].IsdatLoanAmountNull() == false)
                {
                    txtprincipal.Text = tblLoanApp[0].datLoanAmount.ToString();
                }
                this.editskip.Value = "2";
                int    mnths = Convert.ToInt32(tblLoanApp[0].datDuration.ToString());
                double per   = Convert.ToDouble(tblLoanApp[0].datInterestRate.ToString());
                double amt   = Convert.ToDouble(tblLoanApp[0].datLoanAmount.ToString());
                try
                {
                    GenerateMonths(mnths, DateTime.Parse(txtfirstpaymentdate.Text));
                }
                catch (Exception ex) { }
            }
            else
            {
                int    mnths = Convert.ToInt32(txtperiod.Text);
                double per   = Convert.ToDouble(txtinterestrate.Text);
                double amt   = Convert.ToDouble(txtprincipal.Text);
                try
                {
                    GenerateMonths(mnths, DateTime.Parse(txtfirstpaymentdate.Text));
                }
                catch (Exception ex) { }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ListItem LItem = new ListItem("--Select--", "0");
        ddlPaymetMode.Items.Insert(0, LItem);
        
        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        txtBranch.InnerText = util.displayValue("tbl_teams", loanApp.GetLoanAppBranch(MySessionManager.AppID, MySessionManager.ClientID).ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            this.lblTotalAmt.InnerText = tblLoanApp[0].datDisburseAmount.ToString("c").Replace("$","");
            this.txtDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
        }
        if (!(this.editskip1.Value == "2"))
        {
            txtVoucherNo.Value = getPVNo();
            loadfv();

            txtTotalAmount.Text = sumAmount().ToString();
            txtAmtWords.Value = NTE.changeNumericToWords(Convert.ToDouble(sumAmount())) + "Ghana Cedis ";
        }
        if (!(Request.QueryString["pvedit"] == null))
        {
            type = "update";
            id = Convert.ToInt32(Request.QueryString["pvedit"]);
            if (!(this.editskip.Value == "2"))
            {
                //txtVoucherNo.Value = getPVNo();
                loadpv(id);
            }
        }
        else if (!(Request.QueryString["pvdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["pvdelete"];
                util.deleteItem("tbl_payment_vouchers", id);

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "pvdelete"));
            }
            catch
            { }
        }


    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ListItem LItem = new ListItem("--Select--", "0");

        ddlPaymetMode.Items.Insert(0, LItem);

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        txtBranch.InnerText = util.displayValue("tbl_teams", loanApp.GetLoanAppBranch(MySessionManager.AppID, MySessionManager.ClientID).ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            this.lblTotalAmt.InnerText = tblLoanApp[0].datDisburseAmount.ToString("c").Replace("$", "");
            this.txtDate.Text          = DateTime.Now.ToString("dd-MM-yyyy");
        }
        if (!(this.editskip1.Value == "2"))
        {
            txtVoucherNo.Value = getPVNo();
            loadfv();

            txtTotalAmount.Text = sumAmount().ToString();
            txtAmtWords.Value   = NTE.changeNumericToWords(Convert.ToDouble(sumAmount())) + "Ghana Cedis ";
        }
        if (!(Request.QueryString["pvedit"] == null))
        {
            type = "update";
            id   = Convert.ToInt32(Request.QueryString["pvedit"]);
            if (!(this.editskip.Value == "2"))
            {
                //txtVoucherNo.Value = getPVNo();
                loadpv(id);
            }
        }
        else if (!(Request.QueryString["pvdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["pvdelete"];
                util.deleteItem("tbl_payment_vouchers", id);

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "pvdelete"));
            }
            catch
            { }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Utility util = new Utility();

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(Convert.ToString(MySessionManager.AppID));
        if (tblLoanApp.Rows.Count > 0)
        {
            if (!(this.editskip.Value == "2"))
            {
                if (tblLoanApp[0].IsdatDurationNull()==false){ txtperiod.Text = tblLoanApp[0].datDuration.ToString(); }
                 if (tblLoanApp[0].IsdatInterestRateNull()==false){txtinterestrate.Text = tblLoanApp[0].datInterestRate.ToString();}
                 if (tblLoanApp[0].IsdatInterestRateTypeNull() == false) { txtinterestrateType.Text = util.displayValue("opt_interest_rate_types", tblLoanApp[0].datInterestRateType.ToString()); }
                 if (tblLoanApp[0].IsdatFirstPaymentDateNull() == false) { txtfirstpaymentdate.Text = tblLoanApp[0].datFirstPaymentDate.ToString("dd-MM-yyyy"); }
                txtFrequency.Text = util.displayValue("opt_frequencies", tblLoanApp[0].datFrequency.ToString());
                if (tblLoanApp[0].IsdatLoanAmountNull() == false) { txtprincipal.Text = tblLoanApp[0].datLoanAmount.ToString(); }
                this.editskip.Value = "2";
                int mnths = Convert.ToInt32(tblLoanApp[0].datDuration.ToString());
                double per = Convert.ToDouble(tblLoanApp[0].datInterestRate.ToString());
                double amt = Convert.ToDouble(tblLoanApp[0].datLoanAmount.ToString());
                try
                {
                    GenerateMonths(mnths, DateTime.Parse(txtfirstpaymentdate.Text));
                }
                catch (Exception ex) { }
                
            }
            else 
            {
                int mnths = Convert.ToInt32(txtperiod.Text);
                double per = Convert.ToDouble(txtinterestrate.Text);
                double amt = Convert.ToDouble(txtprincipal.Text);
                try
                {
                    GenerateMonths(mnths, DateTime.Parse(txtfirstpaymentdate.Text));
                }
                catch (Exception ex) { }
                
            }
        }
    }
    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
            { }
        }
        
    }
예제 #11
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)
         { }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ListItem LItem = new ListItem("--Select--", "0");
        ddlFee.Items.Insert(0, LItem);
        ddlPaymentMode.Items.Insert(0, LItem);

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            txtUpdatedLoanAmt.Text = tblLoanApp[0].datLoanAmount.ToString("c").Replace("$", "");
            txtUpddateDisburseAmt.Text = tblLoanApp[0].datDisburseAmount.ToString("c").Replace("$", "");
        
        }
        txtLoanAmt.Value = Convert.ToString(loanApp.GetLoanAmount(MySessionManager.AppID, MySessionManager.ClientID)).ToString();

        if (!(Request.QueryString["fedit"] == null))
        {
            type = "update";
            id = Convert.ToInt32(Request.QueryString["fedit"]);
            if (!(this.editskip.Value == "2"))
            {
                loadfee(id);
            }
        }
        else if (!(Request.QueryString["fdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["fdelete"];
               updateLoanAmount("delete", 0, 0, Convert.ToInt32(id));
                util.deleteItem("tbl_fees", id);
               
                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fdelete"));
            }
            catch
            { }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ListItem LItem = new ListItem("--Select--", "0");

        ddlFee.Items.Insert(0, LItem);
        ddlPaymentMode.Items.Insert(0, LItem);

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        if (tblLoanApp.Rows.Count > 0)
        {
            txtUpdatedLoanAmt.Text     = tblLoanApp[0].datLoanAmount.ToString("c").Replace("$", "");
            txtUpddateDisburseAmt.Text = tblLoanApp[0].datDisburseAmount.ToString("c").Replace("$", "");
        }
        txtLoanAmt.Value = Convert.ToString(loanApp.GetLoanAmount(MySessionManager.AppID, MySessionManager.ClientID)).ToString();

        if (!(Request.QueryString["fedit"] == null))
        {
            type = "update";
            id   = Convert.ToInt32(Request.QueryString["fedit"]);
            if (!(this.editskip.Value == "2"))
            {
                loadfee(id);
            }
        }
        else if (!(Request.QueryString["fdelete"] == null))
        {
            try
            {
                string id = Request.QueryString["fdelete"];
                updateLoanAmount("delete", 0, 0, Convert.ToInt32(id));
                util.deleteItem("tbl_fees", id);

                Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "fdelete"));
            }
            catch
            { }
        }
    }
    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
            { }
        }
    }
    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)
            { }
        }

    }
    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); 
    }
예제 #17
0
    //public void setDropdownlist(DropDownList ddl,string value)
    //{
    //    if (value == "")
    //    {
    //        ListItem Litem = new ListItem("--Select--","0");
    //        ddl.Items.Add(Litem);
    //        //ddl.DataBind();
    //    }
    //    else
    //    {
    //        ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(value));
    //    }
    //}
    
    public void InsertAppTrail()
    {

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        int pastUser = Convert.ToInt32(loanApp.GetPreviousUsersID(MySessionManager.AppID)); 

        TimeSpan  TimeDiff =(DateTime.Now - tblLoanApp[0].datMoveTime);
        string moveTime = TimeDiff.Days + " days " + TimeDiff.Hours + " hours" + TimeDiff.Minutes + " minutes and " + TimeDiff.Seconds+" seconds"; 
        int stage = Convert.ToInt32(loanApp.getApplicationStatus(MySessionManager.AppID));

        try
        {
            LoanDSTableAdapters.ApplicationTrailTableAdapter AppTrail = new LoanDSTableAdapters.ApplicationTrailTableAdapter();
            AppTrail.InsertAppTrail(MySessionManager.AppID,
                                    pastUser,
                                    MySessionManager.CurrentUser.UserID,
                                    tblLoanApp[0].datMoveTime,
                                    stage,
                                    moveTime);


            loanApp.SetNewUserAndTime(MySessionManager.CurrentUser.UserID, DateTime.Now, MySessionManager.AppID);
        }
        catch (Exception ex) { }
    }
    public void createAccount(decimal AmtOut1)
    {

       //LoanAccountDS. 

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanDS.LoanApplicationsDataTable tblLoanApp = loanApp.GetLoanApplication(MySessionManager.AppID.ToString());
        mainDS.ClientDataTable tblClient = client.GetClientProfile(MySessionManager.ClientID);

        decimal interestrate = Convert.ToDecimal(tblLoanApp[0].datInterestRate.ToString());

        decimal IntAmt = (Convert.ToDecimal(AmtOut1) * (interestrate / 100));
        interestamt = IntAmt;
        decimal AmtOut = Convert.ToDecimal(AmtOut1);
        decimal FinRptBalance_monthly = IntAmt + AmtOut;
        DateTime enddate = addMonth(DateTime.Now, Convert.ToInt32(tblLoanApp[0].datDuration.ToString()));

        if ((tblClient.Rows.Count > 0) || (tblLoanApp.Rows.Count > 0))
        {

            LoanAccountDSTableAdapters.GetLoanAccountTableAdapter account = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
            account.InsertLoanAccount(createAccountNumber(MySessionManager.ClientID),
                                      Convert.ToDecimal(tblLoanApp[0].datFees.ToString()),
                                      MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      Convert.ToInt32(tblLoanApp[0].datTeamID.ToString()),
                                      DateTime.Now,
                                      enddate,
                                      Convert.ToInt32(tblLoanApp[0].datInterestRate),
                                      Convert.ToInt32(tblLoanApp[0].datDuration.ToString()),
                                      0,
                                      IntAmt,
                                      AmtOut,
                                      FinRptBalance_monthly,
                                      MySessionManager.CurrentUser.UserID,
                                      FinRptBalance_monthly,
                                      DateTime.Now,
                                      DateTime.Now,
                                      Convert.ToInt32(tblLoanApp[0].datPurpose.ToString()),
                                      IntAmt,
                                      Convert.ToInt32(tblLoanApp[0].datRefreshedID.ToString()),
                                      Convert.ToInt32(tblLoanApp[0].datCreditTeamID.ToString()),
                                      tblClient[0].datClientName.ToString(),
                                      Convert.ToInt32(tblLoanApp[0].datLoanType.ToString()));
        }
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoanAc = loanAc.GetLoanAccount1(MySessionManager.AppID, MySessionManager.ClientID);

        if (tblLoanAc.Rows.Count > 0)
        {
            MySessionManager.AccountID = tblLoanAc[0].datID;
            MySessionManager.AppBranchID = tblLoanApp[0].datTeamID;
        }

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