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());
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

        //int DecID = Convert.ToInt32(EncID);

        
        #region "QueryString Block"
            string EncID = Request.QueryString["id"];
            int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.InvAppID = DecID;
            MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));
        #endregion
            setNotifications();
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type cstype = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }
        showLoanAppInfo();
    }
    //
    public void paymentschedule()
    {
        decimal amt = 0;
        decimal per = 0;
        DateTime dt = DateTime.Now;
        int term = 0, freq = 0, type = 0;
        try
        {

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

            InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false) { type = tblInvApp[0].datInvestmentType; }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false) { amt = tblInvApp[0].datInvestmentAmount; }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false) {; per = tblInvApp[0].datInterestRatePerAnnum; }
                if (tblInvApp[0].IsdatTermsNull() == false) { term = tblInvApp[0].datTerms; }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false) { freq = Convert.ToInt32(tblInvApp[0].datFrequencyOfInterestPayment); }
                if (tblInvApp[0].IsdatValueDateNull() == false) { dt = tblInvApp[0].datValueDate; }                
                term = converrtterm(term);
                freq = convertfrequency(freq);
                CalculateIntPayment(term, freq, amt, per, dt);


            }

        }
        catch (Exception ex) { }

    }
    /// <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)
            { }
        }

    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

        //int DecID = Convert.ToInt32(EncID);


        #region "QueryString Block"
        string EncID = Request.QueryString["id"];
        int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        MySessionManager.InvAppID = DecID;
        MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));
        #endregion
        setNotifications();
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type   cstype  = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }
        showLoanAppInfo();
    }
Exemplo n.º 6
0
    public string GetApplicationNo()
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        int GetCount = Convert.ToInt32(InvApp.GetInvAppCount());

        return((GetCount + 1).ToString());
    }
Exemplo n.º 7
0
    public void loadInvestmentDetails()
    {
        decimal  amt = 0;
        decimal  per = 0;
        DateTime dt = DateTime.Now;
        int      term = 0, freq = 0, type = 0;

        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

            InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false)
                {
                    txtName.Value = tblInvApp[0].datInvestmentName.ToString();
                }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false)
                {
                    ddlType.SelectedValue = tblInvApp[0].datInvestmentType.ToString(); type = tblInvApp[0].datInvestmentType;
                }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false)
                {
                    txtInvestmentAmt.Value = tblInvApp[0].datInvestmentAmount.ToString(); amt = tblInvApp[0].datInvestmentAmount;
                }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false)
                {
                    ddlModeOfInv.SelectedValue = tblInvApp[0].datModeOfRepayment.ToString();
                }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false)
                {
                    txtRatePerAnnum.Value = tblInvApp[0].datInterestRatePerAnnum.ToString(); per = tblInvApp[0].datInterestRatePerAnnum;
                }
                if (tblInvApp[0].IsdatTermsNull() == false)
                {
                    ddlTerms.SelectedValue = tblInvApp[0].datTerms.ToString(); term = tblInvApp[0].datTerms;
                }
                if (tblInvApp[0].IsdatFundsNull() == false)
                {
                    txtFunds.Value = tblInvApp[0].datFunds.ToString();
                }
                if (tblInvApp[0].IsdatVerifiedNull() == false)
                {
                    ddlVerifed.SelectedValue = tblInvApp[0].datVerified.ToString();
                }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false)
                {
                    ddlFrequencyInt.SelectedValue = tblInvApp[0].datFrequencyOfInterestPayment.ToString(); freq = Convert.ToInt32(tblInvApp[0].datFrequencyOfInterestPayment);
                }
                this.editskip.Value = "2";
                term = converrtterm(term);
                freq = convertfrequency(freq);
                CalculateIntPayment(term, freq, amt, per, dt);
            }
        }
        catch (Exception ex) { }
    }
 protected void btnFinalize_Click(object sender, EventArgs e)
 {
     try
     {
         InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
         InvApp.UpdateApplicationStatus(2, MySessionManager.InvAppID);
         Response.Redirect("~/pages/invapplications.aspx");
     }
     catch (Exception ex) { }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         // fetch the en-GB culture
         CultureInfo ukCulture = new CultureInfo("en-GB");
         // pass the DateTimeFormat information to DateTime.Parse
         DateTime dt = DateTime.Parse(txtValue.Text, ukCulture);
         InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
         InvApp.UpdateSetValueDate(dt, MySessionManager.InvAppID);
     }
     catch (Exception ex) { }
 }
    public void setURLs()
    {
        this.btnIntestmentDetails.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=1&ops=load";
        this.btnPersonalInfo.PostBackUrl      = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=2&ops=load";
        this.btnJointInfo.PostBackUrl         = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=3&ops=load";
        this.btnCoporateInfo.PostBackUrl      = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=4&ops=load";
        this.btnInitiatorsInfo.PostBackUrl    = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=5&ops=load";
        this.btnDirectors.PostBackUrl         = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=6&ops=load";
        this.btnBeneficiaries.PostBackUrl     = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=7&ops=load";
        this.btnnok.PostBackUrl            = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=8&ops=load";
        this.btnConPerson.PostBackUrl      = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=9&ops=load";
        this.btnbankers.PostBackUrl        = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=10&ops=load";
        this.btnsupportingdocs.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=11&ops=load";
        this.btnAdvise.PostBackUrl         = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=12&ops=load";

        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        int type = Convert.ToInt32(InvApp.GetInvestmentType(MySessionManager.InvAppID));

        if (type == 1)
        {
            this.btnJointInfo.Visible      = false;
            this.btnCoporateInfo.Visible   = false;
            this.btnDirectors.Visible      = false;
            this.btnBeneficiaries.Visible  = false;
            this.btnInitiatorsInfo.Visible = false;
        }
        else if (type == 2)
        {
            this.btnPersonalInfo.Visible   = false;
            this.btnDirectors.Visible      = false;
            this.btnBeneficiaries.Visible  = false;
            this.btnCoporateInfo.Visible   = false;
            this.btnInitiatorsInfo.Visible = false;
        }
        else if (type == 3)
        {
            this.btnPersonalInfo.Visible  = false;
            this.btnBeneficiaries.Visible = false;
            this.btnJointInfo.Visible     = false;
            btnInitiatorsInfo.Visible     = false;
            this.btnnok.Visible           = false;
        }
        else if (type == 4)
        {
            this.btnPersonalInfo.Visible = false;
            this.btnCoporateInfo.Visible = false;
            this.btnJointInfo.Visible    = false;
            this.btnDirectors.Visible    = false;
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            // fetch the en-GB culture
            CultureInfo ukCulture = new CultureInfo("en-GB");
            // pass the DateTimeFormat information to DateTime.Parse
            DateTime dt=DateTime.Parse(txtValue .Text, ukCulture);
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateSetValueDate(dt,MySessionManager.InvAppID);


        }
        catch (Exception ex) { }
    }
Exemplo n.º 12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            editFlag = true;
            CultureInfo ukCulture = new CultureInfo("en-GB");
            DateTime    dt        = DateTime.Parse(txtValue.Text, ukCulture);
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateSetValueDate(dt, MySessionManager.InvAppID);


            paymentschedule();
        }
        catch (Exception ex) { }
    }
 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 Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

        //int DecID = Convert.ToInt32(EncID);

        
        #region "QueryString Block"
            string EncID = Request.QueryString["id"];
            int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
            MySessionManager.InvAppID = DecID;
            MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));
        #endregion
            try
            {
                mainDSTableAdapters.NotificationCountTableAdapter tblCounter = new mainDSTableAdapters.NotificationCountTableAdapter();
                mainDS.NotificationCountRow itemcount = tblCounter.NotificationCount(MySessionManager.CurrentUser.BranchID, MySessionManager.CurrentUser.UserID, MySessionManager.CurrentUser.TeamID)[0];

                this.pendingRecInfo.InnerText = (Convert.ToInt32(itemcount.receipts.ToString())).ToString();
                this.pendingDisInfo.InnerText = (Convert.ToInt32(itemcount.disbursementI.ToString()) + Convert.ToInt32(itemcount.disbursementII.ToString()) + Convert.ToInt32(itemcount.disbursementIII.ToString())).ToString();
            }
            catch (Exception ex)
            {

            }
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type cstype = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }
        showLoanAppInfo();
    }
Exemplo n.º 15
0
    //
    public void paymentschedule()
    {
        decimal  amt = 0;
        decimal  per = 0;
        DateTime dt = DateTime.Now;
        int      term = 0, freq = 0, type = 0;

        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

            InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false)
                {
                    type = tblInvApp[0].datInvestmentType;
                }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false)
                {
                    amt = tblInvApp[0].datInvestmentAmount;
                }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false)
                {
                    ; per = tblInvApp[0].datInterestRatePerAnnum;
                }
                if (tblInvApp[0].IsdatTermsNull() == false)
                {
                    term = tblInvApp[0].datTerms;
                }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false)
                {
                    freq = Convert.ToInt32(tblInvApp[0].datFrequencyOfInterestPayment);
                }
                if (tblInvApp[0].IsdatValueDateNull() == false)
                {
                    dt = tblInvApp[0].datValueDate;
                }
                term = converrtterm(term);
                freq = convertfrequency(freq);
                CalculateIntPayment(term, freq, amt, per, dt);
            }
        }
        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");
        }
    }
    /// <summary>
    /// Calculate the interest of an application for a certain number of days
    /// It takes the ID of the investment application and the number of days
    /// </summary>
    /// <param name="id">The Investment Application ID </param>
    /// <param name="days">The number of days</param>
    /// <returns>The interest that have been calculated</returns>
    public decimal calc_interest(int id, int days)
    {
        decimal interest = 0;
        decimal intRate  = 0;
        decimal amt      = 0;

        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

        if (tblInvApp.Rows.Count > 0)
        {
            intRate = tblInvApp[0].datInterestRatePerAnnum;
            amt     = tblInvApp[0].datInvestmentAmount;
        }
        interest = ((amt * intRate) / 36500) * days;
        return(interest);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();

        //int DecID = Convert.ToInt32(EncID);


        #region "QueryString Block"
        string EncID = Request.QueryString["id"];
        int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        MySessionManager.InvAppID = DecID;
        MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));
        #endregion
        try
        {
            mainDSTableAdapters.NotificationCountTableAdapter tblCounter = new mainDSTableAdapters.NotificationCountTableAdapter();
            mainDS.NotificationCountRow itemcount = tblCounter.NotificationCount(MySessionManager.CurrentUser.BranchID, MySessionManager.CurrentUser.UserID, MySessionManager.CurrentUser.TeamID)[0];

            this.pendingRecInfo.InnerText = (Convert.ToInt32(itemcount.receipts.ToString())).ToString();
            this.pendingDisInfo.InnerText = (Convert.ToInt32(itemcount.disbursementI.ToString()) + Convert.ToInt32(itemcount.disbursementII.ToString()) + Convert.ToInt32(itemcount.disbursementIII.ToString())).ToString();
        }
        catch (Exception ex)
        {
        }
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type   cstype  = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }
        showLoanAppInfo();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try 
        {
            editFlag = true;
            CultureInfo ukCulture = new CultureInfo("en-GB");
            DateTime dt = DateTime.Parse(txtValue.Text, ukCulture);
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateSetValueDate(dt, MySessionManager.InvAppID);


            paymentschedule();
        
        
        }
        catch (Exception ex) { }

    }
    /// <summary>
    /// Loads  the record of the selected application  
    /// </summary>
    public void loadInvSummary()
    {
        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter client = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClient = client.GetClientInfo(MySessionManager.ClientID);
            if(tblClient.Rows.Count>0)
            {
                if(tblClient[0].IsdatClientNameNull()==false ){lblClientName.InnerText = tblClient[0].datClientName.ToString();}
                if(tblClient[0].IsdatClientNumberNull()==false ){lblClientNo.InnerText = tblClient[0].datClientNumber.ToString();}
                if(tblClient[0].IsdatMobileNumber1Null()==false ){lblMobile1.InnerText = tblClient[0].datMobileNumber1.ToString();}

            
            
            }

            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0) 
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false) { this.lblRatePerAnnum.InnerText = tblInvApp[0].datInterestRatePerAnnum.ToString("c").Replace("$",""); }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false) { this.lblType.InnerText =util.displayValue("opt_investment_types" ,tblInvApp[0].datInvestmentType.ToString()); }
                if (tblInvApp[0].IsdatTermsNull() == false) { this.lblTerms.InnerText =util.displayValue("opt_terms" , tblInvApp[0].datTerms.ToString())+" days"; }
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false) { this.lblModeOfInv.InnerText = util.displayValue("opt_payment_modes", tblInvApp[0].datModeOfRepayment.ToString()); }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false) { this.lblFreqPayment.InnerText = util.displayValue("opt_frequencies_investments", tblInvApp[0].datFrequencyOfInterestPayment.ToString()); }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false) { this.lblAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$",""); }
                if (tblInvApp[0].IsdatValueDateNull() == false) { this.txtValue.Text = tblInvApp[0].datValueDate.ToString("dd-MM-yyyy"); }  
            }
        }
        catch (Exception ex) { }







    }
    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
            { }
        }
        
    }
Exemplo n.º 22
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
            { }
        }
    }
    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 loadTab(int id, string ops)
    {
        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
             int InvType = Convert.ToInt32(InvApp.GetInvestmentType(MySessionManager.InvAppID));
            if (InvType == 1)
            {
                for (int j = 0; j < indie.Length; j++)
                {
                    if (indie[j] == id)
                    {
                        if (ops == "Next")
                        {
                            int m = j + 1;
                            setTab(indie[m]);
                            MySessionManager.CurrentTab = indie[m].ToString();
                        }
                        else if (ops == "Previous")
                        {
                            if (j > 0)
                            {
                                int m = j - 1;
                                setTab(m);
                                MySessionManager.CurrentTab = indie[m].ToString();
                            }
                        }
                    }
                }

            }
            else if (InvType == 2 )
            {
                for (int j = 0; j < joint.Length; j++)
                {

                    if (joint[j] == id)
                    {
                        if (ops == "Next")
                        {
                            int m = j + 1;
                            setTab(joint[m]);
                            MySessionManager.CurrentTab = joint[m].ToString();
                        }
                        else if (ops == "Previous")
                        {
                            if (j > 0)
                            {
                                int m = j - 1;
                                setTab(joint[m]);
                                MySessionManager.CurrentTab = joint[m].ToString();
                            }
                        }
                    }
                }
            }
            else if( InvType == 3)
            {
                for (int j = 0; j < insti.Length; j++)
                {

                    if (insti[j] == id)
                    {
                        if (ops == "Next")
                        {
                            int m = j + 1;
                            setTab(insti[m]);
                            MySessionManager.CurrentTab = insti[m].ToString();
                        }
                        else if (ops == "Previous")
                        {
                            if (j > 0)
                            {
                                int m = j - 1;
                                setTab(insti[m]);
                                MySessionManager.CurrentTab = insti[m].ToString();
                            }
                        }
                    }
                }
            }
            else if (InvType == 4)
            {
                for (int j = 0; j < intrust.Length; j++)
                {
                    if (intrust[j] == id)
                    {
                        if (ops == "Next")
                        {
                            int m = j + 1;
                            setTab(intrust[m]);
                            MySessionManager.CurrentTab = intrust[m].ToString();
                        }
                        else if (ops == "Previous")
                        {
                            if (j > 0)
                            {
                                int m = j - 1;
                                setTab(intrust[m]);
                                MySessionManager.CurrentTab = intrust[m].ToString();
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex) { }
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        try
        {
            MySessionManager.cash = 0;
            MySessionManager.bank = 0;
            decimal amtDeductable = 0;
            decimal fees = 0;
            decimal amt = 0;
            int ops = 0;

            mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
            mTemp.GetTransactionDetailsDataTable tblTempHolder = tempHolder.GetInvTempTransactions(MySessionManager.InvAppID);
            LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
            int rows = tblTempHolder.Rows.Count;

            for (int i = 0; i < rows; i++)
            {
                int? datDebitAc = null;
                int? datCreditAc = null;
                if (tblTempHolder[i].datDebit > 0)
                {
                    datDebitAc = tblTempHolder[i].datAccountID;
                    amt = tblTempHolder[i].datDebit;
                    ops = 1;
                }
                else if (tblTempHolder[i].datCredit > 0)
                {
                    datCreditAc = tblTempHolder[i].datAccountID;
                    amt = tblTempHolder[i].datCredit;
                    ops = 2;
                }
                //
                if (tblTempHolder[i].datPaymentMethod == 1)
                {
                    getAmtForPaymentMode(amt, "cash", ops);
                }
                else if (tblTempHolder[i].datPaymentMethod == 2)
                {
                    getAmtForPaymentMode(amt, "bank", ops);
                }
                fintrans.InsertFinancialTransaction(MySessionManager.InvAppID,
                                                    MySessionManager.ClientID,
                                                    tblTempHolder[i].datAccountID,
                                                    MySessionManager.InvAppID,
                                                    tblTempHolder[i].datDescription,
                                                    batch(),
                                                    tblTempHolder[i].datPaymentMethod,
                                                    MySessionManager.AppBranchID,
                                                    tblTempHolder[i].datCredit,
                                                    tblTempHolder[i].datDebit,
                                                    datCreditAc,
                                                    datDebitAc,
                                                    0,
                                                    MySessionManager.CurrentUser.UserID);
            }
                
                 
        }
        catch(Exception ex) { }

        //This block of code changes the status of the application
        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateApplicationStatus(3, MySessionManager.InvAppID);
            Response.Redirect("~/pages/invapplications.aspx");

        }
        catch (Exception ex) { }
    }
    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 btnFinalize_Click(object sender, EventArgs e)
    {
        try
        {
            ///End the application process.
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateApplicationStatus(5, MySessionManager.InvAppID);


            ///Converts the application into an account
            InvestmentDS.GetInvestmentAppDataTable rowInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (rowInvApp.Rows.Count > 0)
            {
                InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
                InvAcc.InsertInvAccount(rowInvApp[0].datInvestmentName,
                                        rowInvApp[0].datApplicationNumber,
                                        MySessionManager.ClientID,
                                        rowInvApp[0].datInvestmentType,
                                        rowInvApp[0].datTerms,
                                        rowInvApp[0].datInvestmentAmount,
                                        rowInvApp[0].datInterestRatePerAnnum,
                                        rowInvApp[0].datFrequencyOfInterestPayment,
                                        rowInvApp[0].datModeOfRepayment,
                                        rowInvApp[0].datAdvise,
                                        rowInvApp[0].datValueDate,
                                        rowInvApp[0].datInvestmentAmount,
                                        MySessionManager.CurrentUser.BranchID,
                                        0,
                                        0,
                                        0,
                                        0,
                                        1,
                                        MySessionManager.InvAppID);


                ///Calculates the interest for the days elapsed before creation of the account
                int days = DateDiff(DateTime.Now, rowInvApp[0].datValueDate);
                int term = Convert.ToInt32(util.displayValue("opt_terms", rowInvApp[0].datTerms.ToString()));
                if (days > term)
                {
                    days = term;
                }

                InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter InvAcc1 = new InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter();

                if (days > 0)
                {
                    decimal previousInt = calc_interest(MySessionManager.InvAppID, days);

                    ///Insert a new record into the calculation table for the Daily chron-job
                    InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(),
                                          MySessionManager.ClientID,
                                          rowInvApp[0].datApplicationNumber.ToString(),
                                          DateTime.Now.ToShortDateString(),
                                          rowInvApp[0].datInvestmentAmount,
                                          rowInvApp[0].datInterestRatePerAnnum,
                                          days,
                                          term,
                                          previousInt,
                                          previousInt);
                }
                else
                {
                    // decimal previousInt = calc_interest(MySessionManager.InvAppID, days);

                    ///Insert a new record into the calculation table for the Daily chron-job
                    InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(),
                                          MySessionManager.ClientID,
                                          rowInvApp[0].datApplicationNumber.ToString(),
                                          DateTime.Now.ToShortDateString(),
                                          rowInvApp[0].datInvestmentAmount,
                                          rowInvApp[0].datInterestRatePerAnnum,
                                          0,
                                          term,
                                          0,
                                          0);
                }
            }

            Response.Redirect("~/pages/invapplications.aspx");
        }
        catch (Exception ex) { }
    }
 public string GetApplicationNo()
 {
     InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
     int GetCount =Convert.ToInt32(InvApp.GetInvAppCount());
     return (GetCount +1).ToString();
 }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateApplicationStatus(2, MySessionManager.InvAppID);
            Response.Redirect("~/pages/invapplications.aspx");

        }
        catch (Exception ex) { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();


        #region "QueryString Block"
        string EncID = Request.QueryString["id"];
        int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        MySessionManager.InvAppID = DecID;
        MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));

        if (!(Request.QueryString["ops"] == null))
        {
            if (!(Request.QueryString["tab"] == null))
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                {
                    currentTab = Convert.ToInt32(MySessionManager.CurrentTab);
                }
                ops = Request.QueryString["ops"].ToString();
                setTab(currentTab);
                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";

                string urlpath = util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                urlpath = util.RemoveQueryStringByKey(urlpath, "ops");
                Response.Redirect(urlpath);
            }
            else
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                {
                    currentTab = 1;
                }

                ops = "load";
                setTab(currentTab);

                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "ops");
            }
        }
        else
        {
            ops = MySessionManager.OpsTab.ToString();

            //For handling the tabs
            if (!(MySessionManager.CurrentTab == ""))
            {
                currentTab = int.Parse(MySessionManager.CurrentTab);
            }
            else
            {
                currentTab = 1;
            }
            MySessionManager.CurrentTab = currentTab.ToString();
            setTab(currentTab);
        }
        #endregion


        //For posting the alert that has been placed on the application
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type   cstype  = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }

        setURLs();
        showLoanAppInfo();
        setNotifications();
    }
    /// <summary>
    /// Loads  the record of the selected application
    /// </summary>
    public void loadInvSummary()
    {
        try
        {
            mainDSTableAdapters.GetClientInfoTableAdapter client = new mainDSTableAdapters.GetClientInfoTableAdapter();
            mainDS.GetClientInfoDataTable tblClient = client.GetClientInfo(MySessionManager.ClientID);
            if (tblClient.Rows.Count > 0)
            {
                if (tblClient[0].IsdatClientNameNull() == false)
                {
                    lblClientName.InnerText = tblClient[0].datClientName.ToString();
                }
                if (tblClient[0].IsdatClientNumberNull() == false)
                {
                    lblClientNo.InnerText = tblClient[0].datClientNumber.ToString();
                }
                if (tblClient[0].IsdatMobileNumber1Null() == false)
                {
                    lblMobile1.InnerText = tblClient[0].datMobileNumber1.ToString();
                }
            }

            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false)
                {
                    this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString();
                }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false)
                {
                    this.lblRatePerAnnum.InnerText = tblInvApp[0].datInterestRatePerAnnum.ToString("c").Replace("$", "");
                }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false)
                {
                    this.lblType.InnerText = util.displayValue("opt_investment_types", tblInvApp[0].datInvestmentType.ToString());
                }
                if (tblInvApp[0].IsdatTermsNull() == false)
                {
                    this.lblTerms.InnerText = util.displayValue("opt_terms", tblInvApp[0].datTerms.ToString()) + " days";
                }
                if (tblInvApp[0].IsdatInvestmentNameNull() == false)
                {
                    this.lblInvestmentName.InnerText = tblInvApp[0].datInvestmentName.ToString();
                }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false)
                {
                    this.lblModeOfInv.InnerText = util.displayValue("opt_payment_modes", tblInvApp[0].datModeOfRepayment.ToString());
                }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false)
                {
                    this.lblFreqPayment.InnerText = util.displayValue("opt_frequencies_investments", tblInvApp[0].datFrequencyOfInterestPayment.ToString());
                }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false)
                {
                    this.lblAmount.InnerText = tblInvApp[0].datInvestmentAmount.ToString("c").Replace("$", "");
                }
                if (tblInvApp[0].IsdatValueDateNull() == false)
                {
                    this.txtValue.Text = tblInvApp[0].datValueDate.ToString("dd-MM-yyyy");
                }
            }
        }
        catch (Exception ex) { }
    }
    public void setURLs()
    {

        this.btnIntestmentDetails.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=1&ops=load";
        this.btnPersonalInfo.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=2&ops=load";
        this.btnJointInfo.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=3&ops=load";
        this.btnCoporateInfo.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=4&ops=load";
        this.btnInitiatorsInfo.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=5&ops=load";
        this.btnDirectors.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=6&ops=load";
        this.btnBeneficiaries.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=7&ops=load";
        this.btnnok.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=8&ops=load";
        this.btnConPerson.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=9&ops=load";
        this.btnbankers.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=10&ops=load";
        this.btnsupportingdocs.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=11&ops=load";
        this.btnAdvise.PostBackUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&tab=12&ops=load";

        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        int type =Convert.ToInt32(InvApp.GetInvestmentType(MySessionManager.InvAppID));
        if(type==1)
        {
            this.btnJointInfo.Visible = false;
            this.btnCoporateInfo.Visible = false;
            this.btnDirectors.Visible = false;
            this.btnBeneficiaries.Visible = false;
            this.btnInitiatorsInfo.Visible = false;
        }
        else if (type == 2) 
        {
            this.btnPersonalInfo.Visible = false;
            this.btnDirectors.Visible = false;
            this.btnBeneficiaries.Visible = false;
            this.btnCoporateInfo.Visible = false;
            this.btnInitiatorsInfo.Visible = false;
        }
        else if (type == 3)
        {
            this.btnPersonalInfo.Visible = false;
            this.btnBeneficiaries.Visible = false;
            this.btnJointInfo.Visible = false;
            btnInitiatorsInfo.Visible = false;
            this.btnnok.Visible = false;        
        }
        else if (type == 4)
        {
            this.btnPersonalInfo.Visible = false;
            this.btnCoporateInfo.Visible = false;
            this.btnJointInfo.Visible = false;
            this.btnDirectors.Visible = false;
        }


    }
 public void loadTab(int id, string ops)
 {
     try
     {
         InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
         int InvType = Convert.ToInt32(InvApp.GetInvestmentType(MySessionManager.InvAppID));
         if (InvType == 1)
         {
             for (int j = 0; j < indie.Length; j++)
             {
                 if (indie[j] == id)
                 {
                     if (ops == "Next")
                     {
                         int m = j + 1;
                         setTab(indie[m]);
                         MySessionManager.CurrentTab = indie[m].ToString();
                     }
                     else if (ops == "Previous")
                     {
                         if (j > 0)
                         {
                             int m = j - 1;
                             setTab(m);
                             MySessionManager.CurrentTab = indie[m].ToString();
                         }
                     }
                 }
             }
         }
         else if (InvType == 2)
         {
             for (int j = 0; j < joint.Length; j++)
             {
                 if (joint[j] == id)
                 {
                     if (ops == "Next")
                     {
                         int m = j + 1;
                         setTab(joint[m]);
                         MySessionManager.CurrentTab = joint[m].ToString();
                     }
                     else if (ops == "Previous")
                     {
                         if (j > 0)
                         {
                             int m = j - 1;
                             setTab(joint[m]);
                             MySessionManager.CurrentTab = joint[m].ToString();
                         }
                     }
                 }
             }
         }
         else if (InvType == 3)
         {
             for (int j = 0; j < insti.Length; j++)
             {
                 if (insti[j] == id)
                 {
                     if (ops == "Next")
                     {
                         int m = j + 1;
                         setTab(insti[m]);
                         MySessionManager.CurrentTab = insti[m].ToString();
                     }
                     else if (ops == "Previous")
                     {
                         if (j > 0)
                         {
                             int m = j - 1;
                             setTab(insti[m]);
                             MySessionManager.CurrentTab = insti[m].ToString();
                         }
                     }
                 }
             }
         }
         else if (InvType == 4)
         {
             for (int j = 0; j < intrust.Length; j++)
             {
                 if (intrust[j] == id)
                 {
                     if (ops == "Next")
                     {
                         int m = j + 1;
                         setTab(intrust[m]);
                         MySessionManager.CurrentTab = intrust[m].ToString();
                     }
                     else if (ops == "Previous")
                     {
                         if (j > 0)
                         {
                             int m = j - 1;
                             setTab(intrust[m]);
                             MySessionManager.CurrentTab = intrust[m].ToString();
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex) { }
 }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        try
        {
            ///End the application process.
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateApplicationStatus(5, MySessionManager.InvAppID);


            ///Converts the application into an account
            InvestmentDS.GetInvestmentAppDataTable rowInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (rowInvApp.Rows.Count > 0)
            {
                InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
                InvAcc.InsertInvAccount(rowInvApp[0].datInvestmentName,
                                        rowInvApp[0].datApplicationNumber,
                                        MySessionManager.ClientID,
                                        rowInvApp[0].datInvestmentType,
                                        rowInvApp[0].datTerms,
                                        rowInvApp[0].datInvestmentAmount,
                                        rowInvApp[0].datInterestRatePerAnnum,
                                        rowInvApp[0].datFrequencyOfInterestPayment,
                                        rowInvApp[0].datModeOfRepayment,
                                        rowInvApp[0].datAdvise,
                                        rowInvApp[0].datValueDate,
                                        rowInvApp[0].datInvestmentAmount,
                                        MySessionManager.CurrentUser.BranchID,
                                        0,
                                        0,
                                        0,
                                        0,
                                        1,
                                        MySessionManager.InvAppID);


                ///Calculates the interest for the days elapsed before creation of the account
                int days = DateDiff(DateTime.Now, rowInvApp[0].datValueDate);
                int term = Convert.ToInt32(util.displayValue("opt_terms",rowInvApp[0].datTerms.ToString()));
                if (days > term)
                    days = term;

                InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter InvAcc1 = new InvestmentAccountDSTableAdapters.GetInterestCalcTableAdapter();

                if (days > 0)
                {
                    decimal previousInt = calc_interest(MySessionManager.InvAppID, days);

                    ///Insert a new record into the calculation table for the Daily chron-job
                    InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(),
                                          MySessionManager.ClientID,
                                          rowInvApp[0].datApplicationNumber.ToString(),
                                          DateTime.Now.ToShortDateString(),
                                          rowInvApp[0].datInvestmentAmount,
                                          rowInvApp[0].datInterestRatePerAnnum,
                                          days,
                                          term,
                                          previousInt,
                                          previousInt);
                }
                else 
                {
                    
                       // decimal previousInt = calc_interest(MySessionManager.InvAppID, days);

                        ///Insert a new record into the calculation table for the Daily chron-job
                        InvAcc1.InsertInvCalc(MySessionManager.InvAppID.ToString(),
                                              MySessionManager.ClientID,
                                              rowInvApp[0].datApplicationNumber.ToString(),
                                              DateTime.Now.ToShortDateString(),
                                              rowInvApp[0].datInvestmentAmount,
                                              rowInvApp[0].datInterestRatePerAnnum,
                                              0,
                                              term,
                                              0,
                                              0);
                    }
                
                
                }
            
            Response.Redirect("~/pages/invapplications.aspx");

        }
        catch (Exception ex) { }

    }
Exemplo n.º 35
0
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        try
        {
            MySessionManager.cash = 0;
            MySessionManager.bank = 0;
            decimal amtDeductable = 0;
            decimal fees          = 0;
            decimal amt           = 0;
            int     ops           = 0;

            mTempTableAdapters.GetTransactionDetailsTableAdapter tempHolder = new mTempTableAdapters.GetTransactionDetailsTableAdapter();
            mTemp.GetTransactionDetailsDataTable tblTempHolder             = tempHolder.GetInvTempTransactions(MySessionManager.InvAppID);
            LoanDSTableAdapters.FinancialTransactionsTableAdapter fintrans = new LoanDSTableAdapters.FinancialTransactionsTableAdapter();
            int rows = tblTempHolder.Rows.Count;

            for (int i = 0; i < rows; i++)
            {
                int?datDebitAc  = null;
                int?datCreditAc = null;
                if (tblTempHolder[i].datDebit > 0)
                {
                    datDebitAc = tblTempHolder[i].datAccountID;
                    amt        = tblTempHolder[i].datDebit;
                    ops        = 1;
                }
                else if (tblTempHolder[i].datCredit > 0)
                {
                    datCreditAc = tblTempHolder[i].datAccountID;
                    amt         = tblTempHolder[i].datCredit;
                    ops         = 2;
                }
                //
                if (tblTempHolder[i].datPaymentMethod == 1)
                {
                    getAmtForPaymentMode(amt, "cash", ops);
                }
                else if (tblTempHolder[i].datPaymentMethod == 2)
                {
                    getAmtForPaymentMode(amt, "bank", ops);
                }
                fintrans.InsertFinancialTransaction(MySessionManager.InvAppID,
                                                    MySessionManager.ClientID,
                                                    tblTempHolder[i].datAccountID,
                                                    MySessionManager.InvAppID,
                                                    tblTempHolder[i].datDescription,
                                                    batch(),
                                                    tblTempHolder[i].datPaymentMethod,
                                                    MySessionManager.AppBranchID,
                                                    tblTempHolder[i].datCredit,
                                                    tblTempHolder[i].datDebit,
                                                    datCreditAc,
                                                    datDebitAc,
                                                    0,
                                                    MySessionManager.CurrentUser.UserID);
            }
        }
        catch (Exception ex) { }

        //This block of code changes the status of the application
        try
        {
            InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
            InvApp.UpdateApplicationStatus(3, MySessionManager.InvAppID);
            Response.Redirect("~/pages/invapplications.aspx");
        }
        catch (Exception ex) { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

        #region "QueryString Block"
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        string EncID = Request.QueryString["id"];
        int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        MySessionManager.InvAppID = DecID;
        MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));
        if (!(Request.QueryString["ops"] == null))
        {
            if (!(Request.QueryString["tab"] == null))
            {
                if (!(Request.QueryString["tab"] == ""))
                    currentTab = int.Parse(Request.QueryString["tab"]);
                else
                    currentTab = Convert.ToInt32(MySessionManager.CurrentTab);
                ops = Request.QueryString["ops"].ToString();
                setTab(currentTab);
                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab = "load";

                string urlpath = util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                urlpath = util.RemoveQueryStringByKey(urlpath, "ops");
                Response.Redirect(urlpath);
            }
            else
            {
                if (!(Request.QueryString["tab"] == ""))
                    currentTab = int.Parse(Request.QueryString["tab"]);
                else
                    currentTab = 1;

                ops = "load";
                setTab(currentTab);

                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab = "load";
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "ops");
            }
        }
        else
        {
            ops = MySessionManager.OpsTab.ToString();

            //For handling the tabs
            if (!(MySessionManager.CurrentTab == ""))

                currentTab = int.Parse(MySessionManager.CurrentTab);
            else
                currentTab = 1;
            MySessionManager.CurrentTab = currentTab.ToString();
            setTab(currentTab);
        }
        #endregion


        //For posting the alert that has been placed on the application
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type cstype = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }

        setURLs();
        setNotifications();
        showLoanAppInfo();
    }
    /// <summary>
    /// Calculate the interest of an application for a certain number of days
    /// It takes the ID of the investment application and the number of days
    /// </summary>
    /// <param name="id">The Investment Application ID </param>
    /// <param name="days">The number of days</param>
    /// <returns>The interest that have been calculated</returns>
    public decimal calc_interest(int id, int days)
    {
        decimal interest=0;
        decimal intRate=0;
        decimal amt=0;
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter InvApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
        InvestmentDS.GetInvestmentAppDataTable tblInvApp = InvApp.GetInvestmentApp(MySessionManager.InvAppID);

        if (tblInvApp.Rows.Count > 0)
        {
            intRate = tblInvApp[0].datInterestRatePerAnnum;
            amt = tblInvApp[0].datInvestmentAmount;
        }
        interest =((amt*intRate)/36500)*days;
        return interest;
    
    }
    public void loadInvestmentDetails()
    {
        decimal amt=0;
         decimal per=0;
        DateTime dt =DateTime.Now;
        int term=0,freq=0,type=0;
        try 
        {

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

            InvestmentDS.GetInvestmentAppDataTable tblInvApp = invApp.GetInvestmentApp(MySessionManager.InvAppID);

            if (tblInvApp.Rows.Count > 0)
            {
                if (tblInvApp[0].IsdatInvestmentNameNull() == false) { txtName.Value = tblInvApp[0].datInvestmentName.ToString(); }
                if (tblInvApp[0].IsdatInvestmentTypeNull() == false) { ddlType.SelectedValue = tblInvApp[0].datInvestmentType.ToString(); type = tblInvApp[0].datInvestmentType; }
                if (tblInvApp[0].IsdatInvestmentAmountNull() == false) { txtInvestmentAmt.Value = tblInvApp[0].datInvestmentAmount.ToString(); amt = tblInvApp[0].datInvestmentAmount; }
                if (tblInvApp[0].IsdatModeOfRepaymentNull() == false) { ddlModeOfInv.SelectedValue = tblInvApp[0].datModeOfRepayment.ToString(); }
                if (tblInvApp[0].IsdatInterestRatePerAnnumNull() == false) { txtRatePerAnnum.Value = tblInvApp[0].datInterestRatePerAnnum.ToString(); per = tblInvApp[0].datInterestRatePerAnnum; }
                if (tblInvApp[0].IsdatTermsNull() == false) { ddlTerms.SelectedValue = tblInvApp[0].datTerms.ToString(); term =tblInvApp[0].datTerms; }
                if (tblInvApp[0].IsdatFundsNull() == false) { txtFunds.Value = tblInvApp[0].datFunds.ToString(); }
                if (tblInvApp[0].IsdatVerifiedNull() == false) { ddlVerifed.SelectedValue = tblInvApp[0].datVerified.ToString(); }
                if (tblInvApp[0].IsdatFrequencyOfInterestPaymentNull() == false) { ddlFrequencyInt.SelectedValue = tblInvApp[0].datFrequencyOfInterestPayment.ToString(); freq = Convert.ToInt32(tblInvApp[0].datFrequencyOfInterestPayment); }
                this.editskip.Value = "2";
                term = converrtterm(term);
                freq = convertfrequency(freq);
                CalculateIntPayment(term,freq,amt,per,dt);
            }
        
        }
        catch (Exception ex) { }

    }