Exemple #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());
    }
Exemple #2
0
    public void loadClientInformation(int ClientID)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientDataTable cinfo = client.GetClientProfile(ClientID);
        if (cinfo.Count > 0)
        {
            try
            {
                mainDS.ClientRow rinfo = cinfo[0];
                lblClientName.InnerText = rinfo.datClientName.ToString();
                lblClientNo.InnerText   = rinfo.datClientNumber.ToString();
                string ctype = "Individual";
                if (rinfo.datClientType == 2)
                {
                    ctype = "Corporate";
                }
                lblClientType.InnerText = ctype;

                lblEmail.InnerText         = rinfo.datEmailAddress;
                lblMobile.InnerText        = rinfo.datMobileNumber1 + " " + rinfo.datMobileNumber2;
                lblNationality.InnerText   = rinfo.datNationality.ToString();
                lblPostalAddress.InnerText = rinfo.datPostalAddress;
                lblResAddress.InnerText    = rinfo.datCurrentResidentialAddress;
                lblTelephone.InnerText     = rinfo.datHomeTelephoneNumber;
            }
            catch (Exception ex) { }
        }
    }
Exemple #3
0
    public void getProfileType(int ClientID)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            int?type = int.Parse(client.GetClientType(ClientID).ToString());

            if (type == 1)
            {
                this.individualclientprofile.Visible = true;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible   = false;
            }
            else if (type == 2)
            {
                this.individualclientprofile.Visible = false;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible   = true;
            }
            else if (type == 3)
            {
                this.individualclientprofile.Visible = true;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible   = false;
            }
        }
        catch (Exception ex) { }
    }
    public void getProfileType(int ClientID)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            int? type = int.Parse(client.GetClientType(ClientID).ToString());

            if (type == 1)
            {
                this.individualclientprofile.Visible = true;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible = false;
            }
            else if (type == 2)
            {
                this.individualclientprofile.Visible = false;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible = true;
            }
            else if (type == 3)
            {
                this.individualclientprofile.Visible = true;
                this.enterpriseclientprofile.Visible = false;
                this.coporateclientprofile.Visible = false;
            }
        }
        catch (Exception ex) { }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        fullname = txtSurname.Value + ' ' + txtMiddlename.Value + ' ' + txtfirstname.Value;

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        int?objID = null;

        client.InsertClient(GenerateClientNumber(),
                            3,
                            Convert.ToInt32(this.ddlTitle.SelectedValue),
                            txtfirstname.Value.Trim(),
                            txtMiddlename.Value.Trim(),
                            txtSurname.Value.Trim(),
                            fullname,
                            txttelephone.Value.Trim(),
                            txtMobileNo.Value.Trim(),
                            txtEmail.Value.Trim(),
                            txthomeAddress.Value.Trim(), ref objID);


        if (objID.Value > 0)
        {
            MySessionManager.ClientID = Convert.ToInt32(objID);
        }
        ShowMessageBox("New Enterprise has been created");
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
   
                fullname = txtSurname.Value + " " + txtMiddlename.Value + " " + txtfirstname.Value;
                
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                int? objID = null;
                client.InsertClient(GenerateClientNumber(),
                                    1,
                                    Convert.ToInt32(this.ddlTitle.SelectedValue),
                                    txtfirstname.Value.Trim(),
                                    txtMiddlename.Value.Trim(),
                                    txtSurname.Value.Trim(),
                                    fullname,
                                    txttelephone.Value.Trim(),
                                    txtMobileNo.Value.Trim(),
                                    txtEmail.Value.Trim(),
                                    txthomeAddress.Value.Trim(), ref objID);
                                        

                if (objID.Value > 0)
                {
                    MySessionManager.ClientID = Convert.ToInt32(objID); 
                }
                ShowMessageBox("New Individual client has been created");    

          }
 public string GenerateClientNumber()
 {
     mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
     int noClients = Convert.ToInt32(client.GetClientCount().ToString());
     string ClientNo = "C" + (100000 + (noClients+1)).ToString();
     return ClientNo;
 }
    /// <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)
            { }
        }

    }
Exemple #9
0
    public void loadCompanyDetails(int clientID)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];
            LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
            LoanDS.CoporateInformationDataTable tblCompanyDetails = companyDetails.GetCoporateInformation(MySessionManager.ClientID);

            if (tblCompanyDetails.Rows.Count > 0)
            {
                txtCompanyName.Value       = tblCompanyDetails[0].datCompanyName.ToString();
                txtCommencementDate.Text   = tblCompanyDetails[0].datCommencementDate.ToShortDateString();
                txtNatureofbusiness.Value  = tblCompanyDetails[0].datNatureOfBusiness.ToString();
                txtPhysicalAddress.Value   = tblCompanyDetails[0].datPhysicalAddress.ToString();
                txtRegistrationNumber.Text = tblCompanyDetails[0].datRegistrationNumber.ToString();
                txtRegistrationDate.Text   = tblCompanyDetails[0].datRegistrationDate.ToShortDateString();
                txtYearsInBusiness.Value   = tblCompanyDetails[0].datYearsInBusiness.ToString();
                txtwebsite.Value           = tblCompanyDetails[0].datWebsite.ToString();
                txtVATNo.Value             = tblCompanyDetails[0].datVATNumber.ToString();
                txtTIN.Value = tblCompanyDetails[0].datTIN.ToString();
                if (tblCompanyDetails[0].IsdatTelephoneNumber1Null() == false)
                {
                    txtTel1.Value = tblCompanyDetails[0].datTelephoneNumber1.ToString();
                }
                else if (tblClient.IsdatMobileNumber1Null() == false)
                {
                    txtTel1.Value = tblClient.datMobileNumber1.ToString();
                }
                if (tblCompanyDetails[0].IsdatTelephoneNumber2Null() == false)
                {
                    txtTel2.Value = tblCompanyDetails[0].datTelephoneNumber2.ToString();
                }
                else if (tblClient.IsdatMobileNumber2Null() == false)
                {
                    txtTel2.Value = tblClient.datMobileNumber2.ToString();
                }
                txtTel2.Value = tblCompanyDetails[0].datTelephoneNumber2.ToString();
                txtFax.Value  = tblCompanyDetails[0].datFaxNumber.ToString();
                if (tblCompanyDetails[0].IsdatIndustryTypeNull() == false)
                {
                    ddlIndustryType.SelectedValue = tblCompanyDetails[0].datIndustryType.ToString();
                }
                //if (tblCompanyDetails[0].IsdatSectorNull()==false) { if(ddlIndustryType.SelectedValue = tblCompanyDetails[0].datSector.ToString(); }
                if (tblCompanyDetails[0].IsdatPremissesStatusNull() == false)
                {
                    ddlPremisesStatus.SelectedValue = tblCompanyDetails[0].datPremissesStatus.ToString();
                }
                if (tblCompanyDetails[0].IsdatIsRegisteredNull() == false)
                {
                    ddlRegistered.SelectedValue = tblCompanyDetails[0].datIsRegistered.ToString();
                }
                this.type.Value     = "update";
                this.editskip.Value = "2";
            }
        }
        catch (Exception ex)
        { }
    }
Exemple #10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (!(txtfirstname.Value == "" || txtSurname.Value == ""))
            {
                int nochildren;
                if (txtNoChildren.Text == "")
                {
                    nochildren = 0;
                }
                else
                {
                    nochildren = Convert.ToInt32(txtNoChildren.Text);
                }

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime dt = DateTime.Parse(txtBirthdate.Text, ukCulture.DateTimeFormat);

                string clientname = txtfirstname.Value.Trim() + " " + txtMiddlename.Value.Trim() + " " + txtSurname.Value.Trim();
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                client.UpdateClient(GenerateClientNumber(),
                                    Convert.ToInt32(ddlTitle.Text),
                                    txtfirstname.Value.Trim(),
                                    txtMiddlename.Value.Trim(),
                                    txtSurname.Value.Trim(),
                                    clientname,
                                    ddlNo1.Text,
                                    ddlNo2.Text,
                                    ddlidNo3.Text,
                                    txtidNo1.Value.Trim(),
                                    txtidNo2.Value.Trim(),
                                    txtidNo3.Value.Trim(),
                                    Convert.ToInt32(ddlNationality.SelectedValue),
                                    Convert.ToInt32(ddlRegion.SelectedValue),
                                    Convert.ToInt32(ddlMaritalStatus.SelectedValue),
                                    txtSpouse.Text,
                                    nochildren,
                                    Convert.ToInt32(ddlGender.SelectedValue),
                                    dt,
                                    txttelephone.Value.Trim(),
                                    txtOfficePhone.Value,
                                    txtMobileNo1.Value.Trim(),
                                    txtMobileNo2.Value.Trim(),
                                    txtfaxnumber.Value,
                                    txtEmail.Value.Trim(),
                                    Convert.ToInt32(ddlRecStatus.Text),
                                    txthomeAddress.Value.Trim(),
                                    txtpreviousAddress.Value.Trim(),
                                    txtPostalAddress.Value.Trim(),
                                    txtLandMark.Value.Trim(),
                                    MySessionManager.CurrentUser.UserID,
                                    MySessionManager.ClientID);
                this.editskip.Value = "1";
            }
        }catch (Exception ex) {}
    }
Exemple #11
0
    public string GenerateClientNumber()
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        int    noClients = Convert.ToInt32(MySessionManager.ClientID);
        string ClientNo  = "C" + (100000 + noClients).ToString();

        return(ClientNo);
    }
    public string GenerateClientNumber()
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        int    noClients = Convert.ToInt32(client.GetClientCount().ToString());
        string ClientNo  = "C" + (100000 + (noClients + 1)).ToString();

        return(ClientNo);
    }
    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;
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (!(txtfirstname.Value == "" || txtSurname.Value == ""))
            {
                int nochildren;
                if (txtNoChildren.Text == "")
                { nochildren = 0; }
                else { nochildren = Convert.ToInt32(txtNoChildren.Text); }

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime dt = DateTime.Parse(txtBirthdate.Text, ukCulture.DateTimeFormat);

                string clientname = txtfirstname.Value.Trim() + " " + txtMiddlename.Value.Trim() + " " + txtSurname.Value.Trim();
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                client.UpdateClient(GenerateClientNumber(),
                                    Convert.ToInt32(ddlTitle.Text),
                                    txtfirstname.Value.Trim(),
                                    txtMiddlename.Value.Trim(),
                                    txtSurname.Value.Trim(),
                                    clientname,
                                    ddlNo1.Text,
                                    ddlNo2.Text,
                                    ddlidNo3.Text,
                                    txtidNo1.Value.Trim(),
                                    txtidNo2.Value.Trim(),
                                    txtidNo3.Value.Trim(),
                                    Convert.ToInt32(ddlNationality.SelectedValue),
                                    Convert.ToInt32(ddlRegion.SelectedValue),
                                    Convert.ToInt32(ddlMaritalStatus.SelectedValue),
                                    txtSpouse.Text,
                                    nochildren,
                                    Convert.ToInt32(ddlGender.SelectedValue),
                                    dt,
                                    txttelephone.Value.Trim(),
                                    txtOfficePhone.Value,
                                    txtMobileNo1.Value.Trim(),
                                    txtMobileNo2.Value.Trim(),
                                    txtfaxnumber.Value,
                                    txtEmail.Value.Trim(),
                                    Convert.ToInt32(ddlRecStatus.Text),
                                    txthomeAddress.Value.Trim(),
                                    txtpreviousAddress.Value.Trim(),
                                    txtPostalAddress.Value.Trim(),
                                    txtLandMark.Value.Trim(),
                                    MySessionManager.CurrentUser.UserID,
                                    MySessionManager.ClientID);
                this.editskip.Value = "1";
            }
        }catch(Exception ex){}
    }
Exemple #15
0
    public void UpdateIndividualClient()
    {
        //Get Clients profile information
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];

        string Fullname = tblClient.datFirstName.ToString() + " " + tblClient.datMiddleName.ToString() + " " + tblClient.datSurname.ToString();

        //Delete all initiators tied up the application
        LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
        initiator.DeleteInitiator(MySessionManager.AppID, MySessionManager.ClientID);

        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        loanApp.UpdateClientName(Fullname, MySessionManager.ClientID);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {

            // pass the DateTimeFormat information to DateTime.Parse
            DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);
            try
            {
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int noyrs = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                    txtNoYrs.Value = "0";

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32(ddlFrequency.Text),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "1";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message.ToString());


            }
        }
    }
 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)
         { }
     }
 }
    public void loadPersonalInformation()
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            mainDS.ClientDataTable tblClient = client.GetClientProfile(MySessionManager.ClientID);

            if (tblClient.Rows.Count > 0)
            {
                this.editskip.Value = "2";
            
                if (tblClient[0].IsdatFirstNameNull() == false) { txtfirstname.Value = tblClient[0].datFirstName.ToString(); }
                if (tblClient[0].IsdatSurnameNull() == false) { txtSurname.Value = tblClient[0].datSurname.ToString(); }
                if (tblClient[0].IsdatMiddleNameNull() == false) { txtMiddlename.Value = tblClient[0].datMiddleName.ToString(); }
                if (tblClient[0].IsdatIDType1Null() == false) { ddlNo1.SelectedValue = tblClient[0].datIDType1; }
                if (tblClient[0].IsdatIDType2Null() == false) { ddlNo2.SelectedValue = tblClient[0].datIDType2; }
                if (tblClient[0].IsdatIDType3Null() == false) { ddlidNo3.SelectedValue = tblClient[0].datIDType3; }
                if (tblClient[0].IsdatGenderNull() == false) { ddlGender.SelectedValue = tblClient[0].datGender.ToString(); }
                if (tblClient[0].IsdatTitleNull() == false) { ddlTitle.SelectedValue = tblClient[0].datTitle.ToString(); }
                if (tblClient[0].IsdatRegionNull() == false) { ddlRegion.SelectedValue = tblClient[0].datRegion.ToString(); }
                if (tblClient[0].IsdatMaritalStatusNull() == false) { ddlMaritalStatus.SelectedValue = tblClient[0].datMaritalStatus.ToString(); }
                if (tblClient[0].IsdatNationalityNull() == false) { ddlNationality.SelectedValue = tblClient[0].datNationality.ToString(); }
                if (tblClient[0].IsdatResidentialStatusNull() == false) { ddlRecStatus.SelectedValue = tblClient[0].datResidentialStatus.ToString(); }
                if (tblClient[0].IsdatIDValue1Null() == false) { txtidNo1.Value = tblClient[0].datIDValue1.ToString(); }
                if (tblClient[0].IsdatIDValue2Null() == false) { txtidNo2.Value = tblClient[0].datIDValue2.ToString(); }
                if (tblClient[0].IsdatIDValue3Null() == false) { txtidNo3.Value = tblClient[0].datIDValue3.ToString(); }
               // if (tblClient[0].IsdatResidentialStatusNull() == false) { ddlRecStatus.SelectedValue = tblClient[0].datResidentialStatus.ToString(); }
                if (tblClient[0].IsdatSpouseNull() == false) { txtSpouse.Text = tblClient[0].datSpouse.ToString(); }
                if (tblClient[0].IsdatNoChildrenNull() == false) { txtNoChildren.Text = tblClient[0].datNoChildren.ToString(); }
                if (tblClient[0].IsdatMobileNumber1Null() == false) { txtMobileNo1.Value = tblClient[0].datMobileNumber1.ToString(); }
                if (tblClient[0].IsdatMobileNumber2Null() == false) { txtMobileNo2.Value = tblClient[0].datMobileNumber2.ToString(); }
                if (tblClient[0].IsdatOfficeTelephoneNumberNull() == false) { txtOfficePhone.Value = tblClient[0].datOfficeTelephoneNumber.ToString(); }
                if (tblClient[0].IsdatPostalAddressNull() == false) { txtPostalAddress.Value = tblClient[0].datPostalAddress.ToString(); }
                if (tblClient[0].IsdatNearestLandMarkNull() == false) { txtLandMark.Value = tblClient[0].datNearestLandMark.ToString(); }
                if (tblClient[0].IsdatCurrentResidentialAddressNull() == false) { txthomeAddress.Value = tblClient[0].datCurrentResidentialAddress.ToString(); }
                if (tblClient[0].IsdatPreviousResidentialAddressNull() == false) { txtpreviousAddress.Value = tblClient[0].datPreviousResidentialAddress.ToString(); }
                if (tblClient[0].IsdatHomeTelephoneNumberNull() == false) { txttelephone.Value = tblClient[0].datHomeTelephoneNumber.ToString(); }
                if (tblClient[0].IsdatFaxNumberNull() == false) { txtfaxnumber.Value = tblClient[0].datFaxNumber.ToString(); }
                if (tblClient[0].IsdatEmailAddressNull() == false) { txtEmail.Value = tblClient[0].datEmailAddress.ToString(); }
                if (tblClient[0].IsdatDateOfBirthNull() == false) { txtBirthdate.Text = tblClient[0].datDateOfBirth.ToString("dd-MM-yyyy"); }
            }
        }
        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");
        }
    }
Exemple #20
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            // pass the DateTimeFormat information to DateTime.Parse
            DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);
            try
            {
                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int    noyrs      = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                {
                    txtNoYrs.Value = "0";
                }

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32(ddlFrequency.Text),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "1";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            fullname = txtcompanyname.Value;
            mainDSTableAdapters.ClientTableAdapter clients = new mainDSTableAdapters.ClientTableAdapter();
            int? objID = null;
            clients.InsertClient(GenerateClientNumber(),
                                  2,
                                  0,
                                  this.txtInFullname.Value.Trim(),
                                  "",
                                  "",
                                  this.fullname,
                                  txttelno.Value.Trim(),
                                  "",
                                  "",
                                  txtphysicalAddress.Value.Trim(),
                                  ref objID);



            if (objID.Value > 0)
            {
                // this.lblinfo.Text = "Client Profile Created Successfully...";
                MySessionManager.ClientID = Convert.ToInt32(objID);
                LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
                initiator.InsertInitiator(null,
                                          MySessionManager.ClientID,
                                          txtInFullname.Value,
                                          "",
                                          txtMobileno.Value.Trim(),
                                          null,
                                          txtEmail.Value.Trim(),
                                          null,
                                          null);


            }
            else
            {

            }
        }
    }
    public void loadCompanyDetails(int clientID)
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];
            LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
            LoanDS.CoporateInformationDataTable tblCompanyDetails = companyDetails.GetCoporateInformation(MySessionManager.ClientID);

            if (tblCompanyDetails.Rows.Count > 0)
            {
                txtCompanyName.Value = tblCompanyDetails[0].datCompanyName.ToString();
                txtCommencementDate.Text = tblCompanyDetails[0].datCommencementDate.ToShortDateString();
                txtNatureofbusiness.Value = tblCompanyDetails[0].datNatureOfBusiness.ToString();
                txtPhysicalAddress.Value = tblCompanyDetails[0].datPhysicalAddress.ToString();
                txtRegistrationNumber.Text = tblCompanyDetails[0].datRegistrationNumber.ToString();
                txtRegistrationDate.Text = tblCompanyDetails[0].datRegistrationDate.ToShortDateString();
                txtYearsInBusiness.Value = tblCompanyDetails[0].datYearsInBusiness.ToString();
                txtwebsite.Value = tblCompanyDetails[0].datWebsite.ToString();
                txtVATNo.Value = tblCompanyDetails[0].datVATNumber.ToString();
                txtTIN.Value = tblCompanyDetails[0].datTIN.ToString();
                if (tblCompanyDetails[0].IsdatTelephoneNumber1Null() == false)
                { txtTel1.Value = tblCompanyDetails[0].datTelephoneNumber1.ToString(); }
                else if (tblClient.IsdatMobileNumber1Null() == false)
                { txtTel1.Value = tblClient.datMobileNumber1.ToString(); }
                if (tblCompanyDetails[0].IsdatTelephoneNumber2Null() == false)
                { txtTel2.Value = tblCompanyDetails[0].datTelephoneNumber2.ToString(); }
                else if (tblClient.IsdatMobileNumber2Null() == false)
                { txtTel2.Value = tblClient.datMobileNumber2.ToString(); }
                txtTel2.Value = tblCompanyDetails[0].datTelephoneNumber2.ToString();
                txtFax.Value = tblCompanyDetails[0].datFaxNumber.ToString();
                if (tblCompanyDetails[0].IsdatIndustryTypeNull() == false) { ddlIndustryType.SelectedValue = tblCompanyDetails[0].datIndustryType.ToString(); }
                //if (tblCompanyDetails[0].IsdatSectorNull()==false) { if(ddlIndustryType.SelectedValue = tblCompanyDetails[0].datSector.ToString(); }
                if (tblCompanyDetails[0].IsdatPremissesStatusNull() == false) { ddlPremisesStatus.SelectedValue = tblCompanyDetails[0].datPremissesStatus.ToString(); }
                if (tblCompanyDetails[0].IsdatIsRegisteredNull() == false) { ddlRegistered.SelectedValue = tblCompanyDetails[0].datIsRegistered.ToString(); }
                this.type.Value = "update";
                this.editskip.Value = "2";
            }


        }
        catch (Exception ex)
        { }

    }
 public void showAccountInfomartion()
 {
     try { 
          LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
          LoanAccountDS.GetLoanAccountRow tblLoanAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
          mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
          lblAccNo.InnerText = " " + tblLoanAcc.datAccountNumber.ToString();
          lblClienttName.InnerText = " " + tblLoanAcc.datClientFullName.ToString();
          lblEmail.InnerText = " " + tblLoanAcc.datIssueDate.ToString("d MMMM  yyyy");
          lblloantype.InnerText = " " + util.displayValue("opt_loan_types", tblLoanAcc.datLoanType.ToString());
          lblAmtOutstanding.InnerText = " " + tblLoanAcc.datOutstandingAmount.ToString("c").Replace("$", "");
          lblloanAmount.InnerText = " " + tblLoanAcc.datInitialAmount.ToString("c").Replace("$", "");
          lblClientNo.InnerText = " " + client.GetClientNo(tblLoanAcc.datClientID);
          lblDuration.InnerText = " " + tblLoanAcc.datDuration.ToString()+" month(s)";
          lblIntRate.InnerText = " " + tblLoanAcc.datInterestRate.ToString("c").Replace("$", "") + "%";
     }
     catch (Exception ex) { }
 }
Exemple #24
0
 public void showAccountInfomartion()
 {
     try {
         LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
         LoanAccountDS.GetLoanAccountRow        tblLoanAcc             = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID))[0];
         mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
         lblAccNo.InnerText          = " " + tblLoanAcc.datAccountNumber.ToString();
         lblClienttName.InnerText    = " " + tblLoanAcc.datClientFullName.ToString();
         lblEmail.InnerText          = " " + tblLoanAcc.datIssueDate.ToString("d MMMM  yyyy");
         lblloantype.InnerText       = " " + util.displayValue("opt_loan_types", tblLoanAcc.datLoanType.ToString());
         lblAmtOutstanding.InnerText = " " + tblLoanAcc.datOutstandingAmount.ToString("c").Replace("$", "");
         lblloanAmount.InnerText     = " " + tblLoanAcc.datInitialAmount.ToString("c").Replace("$", "");
         lblClientNo.InnerText       = " " + client.GetClientNo(tblLoanAcc.datClientID);
         lblDuration.InnerText       = " " + tblLoanAcc.datDuration.ToString() + " month(s)";
         lblIntRate.InnerText        = " " + tblLoanAcc.datInterestRate.ToString("c").Replace("$", "") + "%";
     }
     catch (Exception ex) { }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            fullname = txtcompanyname.Value;
            mainDSTableAdapters.ClientTableAdapter clients = new mainDSTableAdapters.ClientTableAdapter();
            int?objID = null;
            clients.InsertClient(GenerateClientNumber(),
                                 2,
                                 0,
                                 this.txtInFullname.Value.Trim(),
                                 "",
                                 "",
                                 this.fullname,
                                 txttelno.Value.Trim(),
                                 "",
                                 "",
                                 txtphysicalAddress.Value.Trim(),
                                 ref objID);



            if (objID.Value > 0)
            {
                // this.lblinfo.Text = "Client Profile Created Successfully...";
                MySessionManager.ClientID = Convert.ToInt32(objID);
                LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
                initiator.InsertInitiator(null,
                                          MySessionManager.ClientID,
                                          txtInFullname.Value,
                                          "",
                                          txtMobileno.Value.Trim(),
                                          null,
                                          txtEmail.Value.Trim(),
                                          null,
                                          null);
            }
            else
            {
            }
        }
    }
    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
            { }
        }
        
    }
Exemple #27
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)
         { }
     }
 }
Exemple #28
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
            { }
        }
    }
Exemple #29
0
    public void UpdateCompanyClientName(string ClientName)
    {
        //Copy the Initiator Details From the Clients  Table
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];

        string Fullname = tblClient.datFirstName.ToString() + tblClient.datMiddleName.ToString() + tblClient.datSurname.ToString();

        LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
        initiator.InsertInitiator(MySessionManager.AppID,
                                  MySessionManager.ClientID,
                                  Fullname,
                                  null,
                                  tblClient.datMobileNumber1.ToString(),
                                  tblClient.datHomeTelephoneNumber.ToString(),
                                  tblClient.datEmailAddress.ToString(),
                                  tblClient.datFaxNumber.ToString(),
                                  tblClient.datCurrentResidentialAddress.ToString());


        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        loanApp.UpdateClientName(ClientName, MySessionManager.ClientID);
    }
    protected void btnApply_Click(object sender, EventArgs e)
    {

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        
        string EncID = this.ckey.Value;
            //Request.QueryString["id"];
        int DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        int cType = Convert.ToInt32(client.GetClientType(DecID));
        if (ddlProducts.SelectedValue == "1")
        {
            int lType=0;
            if (cType == 1) { lType = 1; } else if (cType == 2) { lType = 2; } else if (cType == 3) { lType = 4; }
            LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            string clientname = client.GetClientsName(DecID).ToString();
           
            loanApp.InsertNewApplication(DecID,
                                         clientname,
                                         lType,
                                         MySessionManager.CurrentUser.BranchID,
                                         MySessionManager.CurrentUser.UserID);
            ShowMessageBox("Loan Application for " + clientname + " submited successfully");
        }
        else if(ddlProducts.SelectedValue=="2")
        {
             string clientname = client.GetClientsName(DecID).ToString();
           
             InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invapp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();
             invapp.InsertInvestmentApplication(DecID,
                                                clientname,
                                                1,
                                                MySessionManager.CurrentUser.BranchID);
             ShowMessageBox("Investment Application for " + clientname + " submited successfully");
        
        
        }
    }
    protected void gvClients_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
             int terms=0;
             InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
             InvestmentAccountDS.GetInvAccountDataTable tblInvAcc = InvAcc.GetInvAccount(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex].Value));
             string enpValue = MyEncryption.Encrypt(this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString(), "12345678910");
             DateTime dt =DateTime.Parse(gvClients.DataKeys[e.Row.RowIndex]["datValueDate"].ToString());
             e.Row.Cells[0].Text = client.GetClientsName(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datClientID"].ToString())).ToString();
             e.Row.Cells[4].Text = util.displayValue("opt_investment_types", gvClients.DataKeys[e.Row.RowIndex]["datInvestmentType"].ToString());
             terms = Convert.ToInt32(util.displayValue("opt_terms", gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString()));
             int freq = Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString());
             Panel ItemBox = new Panel();
             ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
             ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
             ItemBox.Attributes.Add("class", "ItemContainer");
             ItemBox.Style.Add("display", "none");
             string htmlContent = "<div class='col-md-9' style='padding-top:0'><label> Matured Interest(s) </label><br/>";
             if (tblInvAcc[0].dat30 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=30&val=" + tblInvAcc[0].dat30.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 30).ToString("dd/MM/yyyy") + "</a> <br/>";   
             }
             if (tblInvAcc[0].dat60 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=60&val=" + tblInvAcc[0].dat60.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 60).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat91 > 0 && freq == 2)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=91&val=" + tblInvAcc[0].dat91.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 90).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat121 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=121&val=" + tblInvAcc[0].dat121.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 121).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat151 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=151&val=" + tblInvAcc[0].dat151.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 151).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat182 > 0 && freq == 3)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=182&val=" + tblInvAcc[0].dat182.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 182).ToString("dd/MM/yyyy") + "</a> <br/>";
             }
             if (tblInvAcc[0].dat212 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=212&val=" + tblInvAcc[0].dat212.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 212).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat242 > 0 && freq ==1)
             {
                 htmlContent += "<a href=../pages/invaccount/iinterestmaturity.aspx?id=" + enpValue + "&schID=242&val=" + tblInvAcc[0].dat242.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 242).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat273 > 0 && freq == 2)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=273&val=" + tblInvAcc[0].dat273.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 273).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat303 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=303&val=" + tblInvAcc[0].dat303.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat333 > 0 && freq == 1)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=333&val=" + tblInvAcc[0].dat333.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             if (tblInvAcc[0].dat364 > 0 && freq == 4)
             {
                 htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=364&val=" + tblInvAcc[0].dat364.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 364).ToString("dd/MM/yyyy") + "  </a> <br/>";
             }
             htmlContent += "</div>";

             Literal ItemContent = new Literal();
             ItemContent.Text = htmlContent;
             ItemBox.Controls.Add(ItemContent);

             HyperLink hyp = new HyperLink();
             hyp.NavigateUrl = "javascript:showinfo('div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString() + "')";
             hyp.Text = e.Row.Cells[0].Text;
             e.Row.Cells[0].Controls.Add(hyp);
             e.Row.Cells[0].Controls.Add(ItemBox);
             
            //HyperLink clientProfile = (HyperLink)e.Row.FindControl("hyperClientProfile");
             //HyperLink Inv = (HyperLink)e.Row.FindControl("hyperInv");

        }
    }
    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 gvClients_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int terms = 0;
            InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter InvAcc = new InvestmentAccountDSTableAdapters.GetInvAccountTableAdapter();
            InvestmentAccountDS.GetInvAccountDataTable tblInvAcc = InvAcc.GetInvAccount(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex].Value));
            string   enpValue = MyEncryption.Encrypt(this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString(), "12345678910");
            DateTime dt       = DateTime.Parse(gvClients.DataKeys[e.Row.RowIndex]["datValueDate"].ToString());
            e.Row.Cells[0].Text = client.GetClientsName(Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datClientID"].ToString())).ToString();
            e.Row.Cells[4].Text = util.displayValue("opt_investment_types", gvClients.DataKeys[e.Row.RowIndex]["datInvestmentType"].ToString());
            terms = Convert.ToInt32(util.displayValue("opt_terms", gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString()));
            int   freq    = Convert.ToInt32(gvClients.DataKeys[e.Row.RowIndex]["datFrequencyOfInterestPayment"].ToString());
            Panel ItemBox = new Panel();
            ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
            ItemBox.Attributes.Add("id", "div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString());
            ItemBox.Attributes.Add("class", "ItemContainer");
            ItemBox.Style.Add("display", "none");
            string htmlContent = "<div class='col-md-9' style='padding-top:0'><label> Matured Interest(s) </label><br/>";
            if (tblInvAcc[0].dat30 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=30&val=" + tblInvAcc[0].dat30.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 30).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat60 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=60&val=" + tblInvAcc[0].dat60.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 60).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat91 > 0 && freq == 2)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=91&val=" + tblInvAcc[0].dat91.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 90).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat121 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=121&val=" + tblInvAcc[0].dat121.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 121).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat151 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=151&val=" + tblInvAcc[0].dat151.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 151).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat182 > 0 && freq == 3)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=182&val=" + tblInvAcc[0].dat182.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 182).ToString("dd/MM/yyyy") + "</a> <br/>";
            }
            if (tblInvAcc[0].dat212 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=212&val=" + tblInvAcc[0].dat212.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 212).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat242 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/iinterestmaturity.aspx?id=" + enpValue + "&schID=242&val=" + tblInvAcc[0].dat242.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 242).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat273 > 0 && freq == 2)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=273&val=" + tblInvAcc[0].dat273.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 273).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat303 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=303&val=" + tblInvAcc[0].dat303.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat333 > 0 && freq == 1)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=333&val=" + tblInvAcc[0].dat333.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 303).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            if (tblInvAcc[0].dat364 > 0 && freq == 4)
            {
                htmlContent += "<a href=../pages/invaccount/interestmaturity.aspx?id=" + enpValue + "&schID=364&val=" + tblInvAcc[0].dat364.ToString() + ">Int. Maturity for " + addDaysElapsed(dt, 364).ToString("dd/MM/yyyy") + "  </a> <br/>";
            }
            htmlContent += "</div>";

            Literal ItemContent = new Literal();
            ItemContent.Text = htmlContent;
            ItemBox.Controls.Add(ItemContent);

            HyperLink hyp = new HyperLink();
            hyp.NavigateUrl = "javascript:showinfo('div" + this.gvClients.DataKeys[e.Row.RowIndex].Value.ToString() + "')";
            hyp.Text        = e.Row.Cells[0].Text;
            e.Row.Cells[0].Controls.Add(hyp);
            e.Row.Cells[0].Controls.Add(ItemBox);

            //HyperLink clientProfile = (HyperLink)e.Row.FindControl("hyperClientProfile");
            //HyperLink Inv = (HyperLink)e.Row.FindControl("hyperInv");
        }
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        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.GetAccTransactions(Convert.ToInt32(MySessionManager.AccountID));
        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;
                amtDeductable = amtDeductable + tblTempHolder[i].datDebit;
                ops           = 1;
            }
            else if (tblTempHolder[i].datCredit > 0)
            {
                datCreditAc   = tblTempHolder[i].datAccountID;
                amt           = tblTempHolder[i].datCredit;
                amtDeductable = amtDeductable - 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.AppID,
                                                MySessionManager.ClientID,
                                                tblTempHolder[i].datAccountID,
                                                Convert.ToInt32(MySessionManager.AccountID),
                                                tblTempHolder[i].datDescription,
                                                batch(),
                                                tblTempHolder[i].datPaymentMethod,
                                                MySessionManager.CurrentUser.BranchID,
                                                tblTempHolder[i].datCredit,
                                                tblTempHolder[i].datDebit,
                                                datCreditAc,
                                                datDebitAc,
                                                0,
                                                MySessionManager.CurrentUser.UserID);
        }

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc         = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoaonAcc                     = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
        LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter repayment = new LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter();

        if (tblLoaonAcc.Rows.Count > 0)
        {
            repayment.InsertLoanRepayment(receiptNo(),
                                          DateTime.Now,
                                          tblLoaonAcc[0].datID,
                                          tblLoaonAcc[0].datAccountNumber.ToString(),
                                          client.GetClientNo(Convert.ToInt32(MySessionManager.AccountID)),
                                          tblLoaonAcc[0].datIssueDate,
                                          tblLoaonAcc[0].datInterestRate,
                                          MySessionManager.cash,
                                          MySessionManager.bank,
                                          (MySessionManager.cash + MySessionManager.bank),
                                          fees,
                                          tblLoaonAcc[0].datLoanType,
                                          tblLoaonAcc[0].datPurpose,
                                          tblLoaonAcc[0].datTeamID,
                                          MySessionManager.CurrentUser.UserID);
        }

        loanAcc.UpdateNewAmtOutstanding(amtDeductable, Convert.ToInt32(MySessionManager.AccountID));

        decimal outstanding = Convert.ToDecimal(loanAcc.GetAmtOutstanding(Convert.ToInt32(MySessionManager.AccountID)));

        if (outstanding <= 0)
        {
            loanAcc.UpdateCloseAccount(Convert.ToInt32(MySessionManager.AccountID));
        }
        tempHolder.DeleteTempTransByAccID(Convert.ToInt32(MySessionManager.AccountID));
    }
    public void loadClientInformation(int ClientID)
    {
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientDataTable cinfo = client.GetClientProfile(ClientID);
        if (cinfo.Count > 0)
        {
            try
            {
                mainDS.ClientRow rinfo = cinfo[0];
                lblClientName.InnerText = rinfo.datClientName.ToString();
                lblClientNo.InnerText = rinfo.datClientNumber.ToString();
                string ctype = "Individual";
                if (rinfo.datClientType == 2)
                {
                    ctype = "Corporate";
                }
                lblClientType.InnerText = ctype;

                lblEmail.InnerText = rinfo.datEmailAddress;
                lblMobile.InnerText = rinfo.datMobileNumber1 + " " + rinfo.datMobileNumber2;
                lblNationality.InnerText = rinfo.datNationality.ToString();
                lblPostalAddress.InnerText = rinfo.datPostalAddress;
                lblResAddress.InnerText = rinfo.datCurrentResidentialAddress;
                lblTelephone.InnerText = rinfo.datHomeTelephoneNumber;
            }
            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());
    }
 public string GenerateClientNumber()
 {
     mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
     int noClients = Convert.ToInt32(MySessionManager.ClientID);
     string ClientNo = "C" + (100000 + noClients).ToString();
     return ClientNo;
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                // this.dtCompare.Visible = true;

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);

                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int noyrs = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                    txtNoYrs.Value = "0";

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32("0"),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "2";

                //loadLoanDetails(MySessionManager.AppID);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            #region Obsolete
            //try
            //{
            //    mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            //    string clientname = client.GetClientName(MySessionManager.ClientID)[0].datClientName.ToString();

            //int noofyrs = 0;
            //DateTime dt = DateTime.Parse(txtFirstPaymentDate.Text);
            //if (!(txtNoYrs.Value==""))
            //{
            //    noofyrs = Convert.ToInt32(txtNoYrs.Value.Trim());
            //}

            //LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            //loanApp.Update_IntialInterview(MySessionManager.AppID,
            //                               0,
            //                               Convert.ToInt32(ddlLoanType.Text),
            //                               txtNatureOfBusiness.Value.Trim(),
            //                               ddlTypeOfBusiness.Text,
            //                               Convert.ToInt32 (noofyrs),
            //                               Convert.ToDecimal(txtAveMonthlyIncome.Value.Trim()),
            //                               GenerateAppNumber(),
            //                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
            //                               0,
            //                               0,
            //                               clientname,
            //                               Convert.ToInt32(txtDuration.Value.Trim()),
            //                               Convert.ToInt32(ddlloanpurpose.Text),
            //                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
            //                               dt,
            //                               Convert.ToInt32(ddlFrequency.Text),
            //                               Convert.ToInt32(ddlInterestRate.Text),
            //                               "");

            //}
            //catch
            //{
            //} 
            #endregion
        }
        else
        {
          // this.vIntialAssesment.ErrorMessage = 
        
        
        }

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

    }
Exemple #40
0
    public void loadPersonalInformation()
    {
        try
        {
            mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            mainDS.ClientDataTable tblClient = client.GetClientProfile(MySessionManager.ClientID);

            if (tblClient.Rows.Count > 0)
            {
                this.editskip.Value = "2";
                if (tblClient[0].IsdatFirstNameNull() == false)
                {
                    txtfirstname.Value = tblClient[0].datFirstName.ToString();
                }
                if (tblClient[0].IsdatSurnameNull() == false)
                {
                    txtSurname.Value = tblClient[0].datSurname.ToString();
                }
                if (tblClient[0].IsdatMiddleNameNull() == false)
                {
                    txtMiddlename.Value = tblClient[0].datMiddleName.ToString();
                }
                if (tblClient[0].IsdatIDType1Null() == false)
                {
                    ddlNo1.SelectedValue = tblClient[0].datIDType1;
                }
                if (tblClient[0].IsdatIDType2Null() == false)
                {
                    ddlNo2.SelectedValue = tblClient[0].datIDType2;
                }
                if (tblClient[0].IsdatIDType3Null() == false)
                {
                    ddlidNo3.SelectedValue = tblClient[0].datIDType3;
                }
                if (tblClient[0].IsdatGenderNull() == false)
                {
                    ddlGender.SelectedValue = tblClient[0].datGender.ToString();
                }
                if (tblClient[0].IsdatTitleNull() == false)
                {
                    ddlTitle.SelectedValue = tblClient[0].datTitle.ToString();
                }
                if (tblClient[0].IsdatRegionNull() == false)
                {
                    ddlRegion.SelectedValue = tblClient[0].datRegion.ToString();
                }
                if (tblClient[0].IsdatMaritalStatusNull() == false)
                {
                    ddlMaritalStatus.SelectedValue = tblClient[0].datMaritalStatus.ToString();
                }
                if (tblClient[0].IsdatNationalityNull() == false)
                {
                    ddlNationality.SelectedValue = tblClient[0].datNationality.ToString();
                }
                if (tblClient[0].IsdatResidentialStatusNull() == false)
                {
                    ddlRecStatus.SelectedValue = tblClient[0].datResidentialStatus.ToString();
                }
                if (tblClient[0].IsdatIDValue1Null() == false)
                {
                    txtidNo1.Value = tblClient[0].datIDValue1.ToString();
                }
                if (tblClient[0].IsdatIDValue2Null() == false)
                {
                    txtidNo2.Value = tblClient[0].datIDValue2.ToString();
                }
                if (tblClient[0].IsdatIDValue3Null() == false)
                {
                    txtidNo3.Value = tblClient[0].datIDValue3.ToString();
                }
                if (tblClient[0].IsdatResidentialStatusNull() == false)
                {
                    ddlRecStatus.SelectedValue = tblClient[0].datResidentialStatus.ToString();
                }
                if (tblClient[0].IsdatSpouseNull() == false)
                {
                    txtSpouse.Text = tblClient[0].datSpouse.ToString();
                }
                if (tblClient[0].IsdatNoChildrenNull() == false)
                {
                    txtNoChildren.Text = tblClient[0].datNoChildren.ToString();
                }
                if (tblClient[0].IsdatMobileNumber1Null() == false)
                {
                    txtMobileNo1.Value = tblClient[0].datMobileNumber1.ToString();
                }
                if (tblClient[0].IsdatMobileNumber2Null() == false)
                {
                    txtMobileNo2.Value = tblClient[0].datMobileNumber2.ToString();
                }
                if (tblClient[0].IsdatOfficeTelephoneNumberNull() == false)
                {
                    txtOfficePhone.Value = tblClient[0].datOfficeTelephoneNumber.ToString();
                }
                if (tblClient[0].IsdatPostalAddressNull() == false)
                {
                    txtPostalAddress.Value = tblClient[0].datPostalAddress.ToString();
                }
                if (tblClient[0].IsdatNearestLandMarkNull() == false)
                {
                    txtLandMark.Value = tblClient[0].datNearestLandMark.ToString();
                }
                if (tblClient[0].IsdatCurrentResidentialAddressNull() == false)
                {
                    txthomeAddress.Value = tblClient[0].datCurrentResidentialAddress.ToString();
                }
                if (tblClient[0].IsdatPreviousResidentialAddressNull() == false)
                {
                    txtpreviousAddress.Value = tblClient[0].datPreviousResidentialAddress.ToString();
                }
                if (tblClient[0].IsdatHomeTelephoneNumberNull() == false)
                {
                    txttelephone.Value = tblClient[0].datHomeTelephoneNumber.ToString();
                }
                if (tblClient[0].IsdatFaxNumberNull() == false)
                {
                    txtfaxnumber.Value = tblClient[0].datFaxNumber.ToString();
                }
                if (tblClient[0].IsdatEmailAddressNull() == false)
                {
                    txtEmail.Value = tblClient[0].datEmailAddress.ToString();
                }
                if (tblClient[0].IsdatDateOfBirthNull() == false)
                {
                    txtBirthdate.Text = Convert.ToDateTime(tblClient[0].datDateOfBirth.ToString()).ToString("dd-MM-yyyy");
                }
            }
        }
        catch
        {
        }
    }
    public void UpdateCompanyClientName(string ClientName)
    {

        //Copy the Initiator Details From the Clients  Table 
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];

        string Fullname = tblClient.datFirstName.ToString()+ tblClient.datMiddleName.ToString()+ tblClient.datSurname.ToString();

        LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
        initiator.InsertInitiator (MySessionManager.AppID,
                                   MySessionManager.ClientID,
                                   Fullname,
                                   null,
                                   tblClient.datMobileNumber1.ToString(),
                                   tblClient.datHomeTelephoneNumber.ToString(),
                                   tblClient.datEmailAddress.ToString(),
                                   tblClient.datFaxNumber.ToString(),
                                   tblClient.datCurrentResidentialAddress.ToString());


        LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        loanApp.UpdateClientName(ClientName, MySessionManager.ClientID); 
    }
    public void UpdateIndividualClient()
    {
        //Get Clients profile information
        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        mainDS.ClientRow tblClient = client.GetClientProfile(MySessionManager.ClientID)[0];

        string Fullname = tblClient.datFirstName.ToString()+" "+tblClient.datMiddleName.ToString()+" "+ tblClient.datSurname.ToString();

        //Delete all initiators tied up the application
        LoanDSTableAdapters.IntiatorTableAdapter initiator = new LoanDSTableAdapters.IntiatorTableAdapter();
        initiator.DeleteInitiator(MySessionManager.AppID, MySessionManager.ClientID);
        
         LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
        loanApp.UpdateClientName(Fullname, MySessionManager.ClientID); 
        
    
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        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.GetAccTransactions(Convert.ToInt32( MySessionManager.AccountID));
        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;
                amtDeductable = amtDeductable + tblTempHolder[i].datDebit;
                ops = 1;
            }
            else if (tblTempHolder[i].datCredit > 0)
            {
                datCreditAc = tblTempHolder[i].datAccountID;
                amt = tblTempHolder[i].datCredit;
                amtDeductable = amtDeductable - 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.AppID,
                                                MySessionManager.ClientID,
                                                tblTempHolder[i].datAccountID,
                                                Convert.ToInt32(MySessionManager.AccountID),
                                                tblTempHolder[i].datDescription,
                                                batch(),
                                                tblTempHolder[i].datPaymentMethod,
                                                MySessionManager.CurrentUser.BranchID,
                                                tblTempHolder[i].datCredit,
                                                tblTempHolder[i].datDebit,
                                                datCreditAc,
                                                datDebitAc,
                                                0,
                                                MySessionManager.CurrentUser.UserID);
        }

        mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
        LoanAccountDSTableAdapters.GetLoanAccountTableAdapter loanAcc = new LoanAccountDSTableAdapters.GetLoanAccountTableAdapter();
        LoanAccountDS.GetLoanAccountDataTable tblLoaonAcc = loanAcc.GetLoanAccount(Convert.ToInt32(MySessionManager.AccountID));
        LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter repayment = new LoanAccountDSTableAdapters.GetAllLoanRepaymentsTableAdapter();

        if(tblLoaonAcc.Rows.Count>0)
        {
            repayment.InsertLoanRepayment(receiptNo(),
                                          DateTime.Now,
                                          tblLoaonAcc[0].datID,
                                          tblLoaonAcc[0].datAccountNumber.ToString(),
                                          client.GetClientNo(Convert.ToInt32(MySessionManager.AccountID)),
                                          tblLoaonAcc[0].datIssueDate,
                                          tblLoaonAcc[0].datInterestRate,
                                          MySessionManager.cash,
                                          MySessionManager.bank,
                                          (MySessionManager.cash + MySessionManager.bank),
                                          fees,
                                          tblLoaonAcc[0].datLoanType,
                                          tblLoaonAcc[0].datPurpose,
                                          tblLoaonAcc[0].datTeamID,
                                          MySessionManager.CurrentUser.UserID);
        }

        loanAcc.UpdateNewAmtOutstanding(amtDeductable,Convert.ToInt32(MySessionManager.AccountID));

        decimal outstanding=Convert.ToDecimal(loanAcc.GetAmtOutstanding(Convert.ToInt32(MySessionManager.AccountID)));
        if (outstanding <= 0)
        {
            loanAcc.UpdateCloseAccount(Convert.ToInt32(MySessionManager.AccountID));
        }
        tempHolder.DeleteTempTransByAccID(Convert.ToInt32(MySessionManager.AccountID));
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                // this.dtCompare.Visible = true;

                // fetch the en-GB culture
                CultureInfo ukCulture = new CultureInfo("en-GB");
                // pass the DateTimeFormat information to DateTime.Parse
                DateTime myDateTime = DateTime.Parse(txtFirstPaymentDate.Text, ukCulture.DateTimeFormat);

                mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
                string clientname = client.GetClientsName(MySessionManager.ClientID).ToString();
                int    noyrs      = 0;
                if (!int.TryParse(txtNoYrs.Value, out noyrs))
                {
                    txtNoYrs.Value = "0";
                }

                LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
                loanApp.Update_IntialInterview(MySessionManager.AppID,
                                               0,
                                               Convert.ToInt32(ddlLoanType.Text),
                                               txtNatureOfBusiness.Value,
                                               ddlTypeOfBusiness.Text,
                                               noyrs,
                                               Convert.ToDecimal(txtAveMonthlyIncome.Value),
                                               appCode.Value.Trim(),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
                                               clientname,
                                               Convert.ToInt32(txtDuration.Value.Trim()),
                                               Convert.ToInt32(ddlloanpurpose.Text),
                                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
                                               myDateTime,
                                               Convert.ToInt32("0"),
                                               Convert.ToInt32(ddlInterestRate.Text),
                                               "");
                this.editskip.Value = "2";

                //loadLoanDetails(MySessionManager.AppID);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
            }
            #region Obsolete
            //try
            //{
            //    mainDSTableAdapters.ClientTableAdapter client = new mainDSTableAdapters.ClientTableAdapter();
            //    string clientname = client.GetClientName(MySessionManager.ClientID)[0].datClientName.ToString();

            //int noofyrs = 0;
            //DateTime dt = DateTime.Parse(txtFirstPaymentDate.Text);
            //if (!(txtNoYrs.Value==""))
            //{
            //    noofyrs = Convert.ToInt32(txtNoYrs.Value.Trim());
            //}

            //LoanDSTableAdapters.LoanApplicationsTableAdapter loanApp = new LoanDSTableAdapters.LoanApplicationsTableAdapter();
            //loanApp.Update_IntialInterview(MySessionManager.AppID,
            //                               0,
            //                               Convert.ToInt32(ddlLoanType.Text),
            //                               txtNatureOfBusiness.Value.Trim(),
            //                               ddlTypeOfBusiness.Text,
            //                               Convert.ToInt32 (noofyrs),
            //                               Convert.ToDecimal(txtAveMonthlyIncome.Value.Trim()),
            //                               GenerateAppNumber(),
            //                               Convert.ToDecimal(txtLoanAmount.Value.Trim()),
            //                               0,
            //                               0,
            //                               clientname,
            //                               Convert.ToInt32(txtDuration.Value.Trim()),
            //                               Convert.ToInt32(ddlloanpurpose.Text),
            //                               Convert.ToDecimal(txtInterestrate.Value.Trim()),
            //                               dt,
            //                               Convert.ToInt32(ddlFrequency.Text),
            //                               Convert.ToInt32(ddlInterestRate.Text),
            //                               "");

            //}
            //catch
            //{
            //}
            #endregion
        }
        else
        {
            // this.vIntialAssesment.ErrorMessage =
        }
    }