Ejemplo n.º 1
0
        protected void grdQuotesAndTrades_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;
                if (!(e.Item is IGridInsertItem))
                {
                    CounterPartyBL counterPartyBL = new CounterPartyBL();
                    RadDropDownList ddlCounterParty =
                          (RadDropDownList)item.FindControl("ddlQCounterParty");
                    ddlCounterParty.DataSource = counterPartyBL.GetCounterParty();
                    ddlCounterParty.DataTextField = "Name";
                    ddlCounterParty.DataValueField = "Name";
                    ddlCounterParty.DataBind();
                    ddlCounterParty.SelectedValue = ((DAL.QuotesAndTrades)((e.Item).DataItem)).CounterParty;

                    CountryBL countryBL = new CountryBL();
                    RadDropDownList ddlCountry = (RadDropDownList)item.FindControl("ddlQCountry");
                    ddlCountry.DataSource = countryBL.GetCountry();
                    ddlCountry.DataTextField = "Name";
                    ddlCountry.DataValueField = "Name";
                    ddlCountry.DataBind();
                    ddlCountry.SelectedValue = ((DAL.QuotesAndTrades)((e.Item).DataItem)).Country;
                }
            }
        }
Ejemplo n.º 2
0
        private void FillData()
        {
            try
            {
                Loans loan = new Loans();
                LoansBLL bll = new LoansBLL();
                loan = bll.GetLoanByID(Convert.ToInt16(Session["EditLoanID"]));
                ddlAddLoanCode.SelectedValue = loan.CodeName;
                txtBoxAddLoanCode.Text = loan.CodeName;
                ddlBorrower.SelectedValue = loan.Borrower;
                //  txtBoxAddSector.Text = loan.Sector;
                ddlSector.SelectedValue = loan.Sector;
                if (loan.Signing_Date != null)
                    txtBoxAddSigningDate.SelectedDate = Convert.ToDateTime(loan.Signing_Date);
                if (loan.Maturity_Date != null)
                    txtBoxAddMaturityDate.SelectedDate = Convert.ToDateTime(loan.Maturity_Date);
                ddlAddFixedOrFloating.SelectedValue = loan.FixedOrFloating;

                txtBoxAddMargin.Text = loan.Margin;
                ddlAddCurrency.SelectedValue = loan.Currency;

                bindCountry();
                if (loan.Country != null)
                {
                    CountryBL countryBL = new CountryBL();
                    int id = countryBL.GetCountryFromName(loan.Country);
                    if (id != 0)
                        ddlCountry.SelectedValue = Convert.ToString(id);
                }
                ddlAddCouponFrequency.SelectedValue = loan.CouponFrequency;

                txtBoxFacilitySize.Text = Convert.ToDecimal(loan.FacilitySize).ToString("N");
                if (loan.Bilateral == true)
                    ddlAddBilateral.SelectedValue = "Yes";
                else
                    ddlAddBilateral.SelectedValue = "No";
                ddlAmortizing.SelectedValue = loan.Amortizing;
                CheckNodes(tvCreditRating, loan);
                //txtCouponDate.
                //txtNotional
                txtPP.Text = loan.PP;
                //     txtCRating.Text = loan.CreditRating;
                txtStructureID.Text = loan.StructureID;
                txtBoxAddMargin.Text = loan.Margin;
                if (loan.CouponDate != null)
                    txtCouponDate.SelectedDate = Convert.ToDateTime(loan.CouponDate);
                txtNotional.Text = Convert.ToDecimal(loan.Notional).ToString("N");
                if (ddlAmortizing.SelectedValue == "Yes")
                {
                    if (loan.AmortisationsStartPoint != null)
                        txtAmortisationsStartDate.SelectedDate = Convert.ToDateTime(loan.AmortisationsStartPoint);
                    txtAmortisations.Text = loan.NoOfAmortisationPoint.ToString();
                    trDate.Visible = true;
                    trNo.Visible = true;
                    tblAmortisation.Visible = true;
                }
                txtSummitCredit.Text = loan.SummitCreditEntity;
                txtGrid.Text = loan.Grid;
                txtGurantor.Text = loan.Gurantor;
                LoanScheduleBL scheduleBL = new LoanScheduleBL();
                List<LoanSchedule> scheduleList = scheduleBL.GetLoanByID(loan.ID);

                if (scheduleList != null && scheduleList.Count > 0)
                {
                    dt1.Clear();
                    //dt1.Columns.Add("ID", typeof(int));
                    //dt1.Columns.Add("StartDate", typeof(DateTime));
                    //dt1.Columns.Add("EndDate", typeof(DateTime));
                    //dt1.Columns.Add("Notional", typeof(long));
                    //dt1.Columns.Add("Factor", typeof(float));

                    for (int i = 0; i < scheduleList.Count; i++)
                    {
                        //  dt1.Rows.Add(scheduleList[i].ID, scheduleList[i].StartDate, scheduleList[i].EndDate, scheduleList[i].Notation, scheduleList[i].Factor);
                        dt1.Rows.Add(i + 1, scheduleList[i].StartDate.Value.ToShortDateString(), scheduleList[i].EndDate.Value.ToShortDateString(), scheduleList[i].CoupFrac, scheduleList[i].Notation, scheduleList[i].Amortisation, scheduleList[i].Factor);
                    }
                    pnlAmortizing.Visible = true;
                    grdAmortizing.Visible = true;
                    btnCalculatSchedule.Visible = true;
                    grdAmortizing.DataSource = dt1;
                    grdAmortizing.DataBind();
                }
                hfLoanID.Value = loan.ID.ToString();
                lblConfirm.Text = "Loan already exists, do you wish to overwrite?";
                _operation = "Edit";
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 3
0
        protected void grdLoans_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
        {
            DataTable data = new DataTable();

            switch (e.Column.DataField)
            {
                case "CodeName":
                    data.Columns.Add("CodeName");
                    LoansBLL loansBLL = new LoansBLL();
                    List<Loans> loans = loansBLL.GetLoans();

                    for (int i = 0; i <= loans.Count - 1; i++)
                    {
                        data.Rows.Add(loans[i].CodeName);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CodeName";
                    e.ListBox.DataTextField = "CodeName";
                    e.ListBox.DataValueField = "CodeName";
                    e.ListBox.DataBind();

                    break;
                case "Borrower":
                    data = new DataTable();
                    data.Columns.Add("Borrower");

                    BorrowersBL borrowerBL = new BorrowersBL();
                    List<Borrower> borrower = borrowerBL.GetBorrowers();
                    for (int i = 0; i < borrower.Count - 1; i++)
                    {
                        data.Rows.Add(borrower[i].Name);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Borrower";
                    e.ListBox.DataTextField = "Borrower";
                    e.ListBox.DataValueField = "Borrower";
                    e.ListBox.DataBind();
                    break;
                case "Country":
                    data = new DataTable();
                    data.Columns.Add("Country");

                    CountryBL CountryBL = new CountryBL();
                    List<tblCountry> country = CountryBL.GetCountry();
                    for (int i = 0; i < country.Count - 1; i++)
                    {
                        data.Rows.Add(country[i].Name);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Country";
                    e.ListBox.DataTextField = "Country";
                    e.ListBox.DataValueField = "Country";
                    e.ListBox.DataBind();
                    break;
                case "CreditRating":
                    data = new DataTable();
                    data.Columns.Add("CreditRating");

                    CreditRatingsBL CreditRatingsBL = new CreditRatingsBL();
                    List<CreditRating> CreditRating = CreditRatingsBL.GetRatings();
                    for (int i = 0; i < CreditRating.Count - 1; i++)
                    {
                        data.Rows.Add(CreditRating[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRating";
                    e.ListBox.DataTextField = "CreditRating";
                    e.ListBox.DataValueField = "CreditRating";
                    e.ListBox.DataBind();
                    break;
                case "Sector":
                    data = new DataTable();
                    data.Columns.Add("Sector");

                    LoansBLL loansBll = new LoansBLL();
                    List<Sectors> sector = loansBll.GetSector();

                    for (int i = 0; i < sector.Count; i++)
                    {
                        if (sector[i] != null)
                        {
                            data.Rows.Add(sector[i].Sector);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Sector";
                    e.ListBox.DataTextField = "Sector";
                    e.ListBox.DataValueField = "Sector";
                    e.ListBox.DataBind();
                    break;
                case "PP":
                    data = new DataTable();
                    data.Columns.Add("PP");

                    loansBll = new LoansBLL();
                    List<PP> pp = loansBll.GetPP();

                    for (int i = 0; i < pp.Count; i++)
                    {
                        if (pp[i] != null)
                        {
                            data.Rows.Add(pp[i].pp);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "PP";
                    e.ListBox.DataTextField = "PP";
                    e.ListBox.DataValueField = "PP";
                    e.ListBox.DataBind();
                    break;
                case "FixedOrFloating":
                    data = new DataTable();
                    data.Columns.Add("FixedOrFloating");

                    loansBll = new LoansBLL();
                    List<BLL.FixedOrFloating> fof = loansBll.GetFixedFloating();

                    for (int i = 0; i < fof.Count; i++)
                    {
                        if (fof[i] != null)
                        {
                            data.Rows.Add(fof[i].fixedorfloating);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "FixedOrFloating";
                    e.ListBox.DataTextField = "FixedOrFloating";
                    e.ListBox.DataValueField = "FixedOrFloating";
                    e.ListBox.DataBind();
                    break;
                case "Notional":
                    data = new DataTable();
                    data.Columns.Add("Notional");

                    loansBll = new LoansBLL();
                    List<BLL.Notional> notional = loansBll.GetNotional();

                    for (int i = 0; i < notional.Count; i++)
                    {
                        if (notional[i] != null)
                        {
                            data.Rows.Add(notional[i].notional);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Notional";
                    e.ListBox.DataTextField = "Notional";
                    e.ListBox.DataValueField = "Notional";
                    e.ListBox.DataBind();
                    break;
                case "Margin":
                    data = new DataTable();
                    data.Columns.Add("Margin");

                    loansBll = new LoansBLL();
                    List<BLL.Margin> margin = loansBll.GetMargin();

                    for (int i = 0; i < margin.Count; i++)
                    {
                        if (margin[i] != null)
                        {
                            data.Rows.Add(margin[i].margin);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Margin";
                    e.ListBox.DataTextField = "Margin";
                    e.ListBox.DataValueField = "Margin";
                    e.ListBox.DataBind();
                    break;
                case "Currency":
                    data = new DataTable();
                    data.Columns.Add("Currency");

                    CurrenciesBL currencyBL = new CurrenciesBL();
                    List<Currency> currency = currencyBL.GetCurrency();

                    for (int i = 0; i < currency.Count; i++)
                    {
                        if (currency[i].Currancy != null)
                        {
                            data.Rows.Add(currency[i].Currancy);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Currency";
                    e.ListBox.DataTextField = "Currency";
                    e.ListBox.DataValueField = "Currency";
                    e.ListBox.DataBind();
                    break;
                case "CouponFrequency":
                    data = new DataTable();
                    data.Columns.Add("CouponFrequency");

                    loansBll = new LoansBLL();
                    List<BLL.CouponFrequency> couponFreq = loansBll.GetCouponFrequency();

                    for (int i = 0; i < couponFreq.Count; i++)
                    {
                        if (couponFreq[i] != null)
                        {
                            data.Rows.Add(couponFreq[i].coupon);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CouponFrequency";
                    e.ListBox.DataTextField = "CouponFrequency";
                    e.ListBox.DataValueField = "CouponFrequency";
                    e.ListBox.DataBind();
                    break;
                case "FacilitySize":
                    data = new DataTable();
                    data.Columns.Add("FacilitySize");

                    loansBll = new LoansBLL();
                    List<BLL.FacilitySize> facility = loansBll.GetFacilitySize();

                    for (int i = 0; i < facility.Count; i++)
                    {
                        if (facility[i] != null)
                        {
                            data.Rows.Add(facility[i].facility);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "FacilitySize";
                    e.ListBox.DataTextField = "FacilitySize";
                    e.ListBox.DataValueField = "FacilitySize";
                    e.ListBox.DataBind();
                    break;
                case "CreditRatingModys":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingModdys = loansBll.GetCreditRatingModdys();
                    for (int i = 0; i < creditRatingModdys.Count; i++)
                    {
                        data.Rows.Add(creditRatingModdys[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingSPs":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingSPs = loansBll.GetCreditRatingSP();
                    for (int i = 0; i < creditRatingSPs.Count; i++)
                    {
                        data.Rows.Add(creditRatingSPs[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingFitch":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingFitch = loansBll.GetCreditRatingFitch();
                    for (int i = 0; i < creditRatingFitch.Count; i++)
                    {
                        data.Rows.Add(creditRatingFitch[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingING":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingING = loansBll.GetCreditRatingING();
                    for (int i = 0; i < creditRatingING.Count; i++)
                    {
                        data.Rows.Add(creditRatingING[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                //case "NoOfAmortisation":
                //    data = new DataTable();
                //    data.Columns.Add("NoOfAmortrization");

                //    loansBll = new LoansBLL();
                //    List<BLL.NoOfAmortrization> noOfAmort = loansBll.GetNoOfAmortrization();

                //    for (int i = 0; i < noOfAmort.Count; i++)
                //    {
                //        if (noOfAmort[i] != null)
                //        {
                //            data.Rows.Add(noOfAmort[i].noofAmort);
                //        }
                //    }

                //    e.ListBox.DataSource = data;
                //    e.ListBox.DataKeyField = "noofAmort";
                //    e.ListBox.DataTextField = "noofAmort";
                //    e.ListBox.DataValueField = "noofAmort";
                //    e.ListBox.DataBind();
                //    break;
                case "StructureID":
                    data = new DataTable();
                    data.Columns.Add("StructureID");

                    loansBll = new LoansBLL();
                    List<BLL.StructureID> structure = loansBll.GetStructureID();

                    for (int i = 0; i < structure.Count; i++)
                    {
                        if (structure[i] != null)
                        {
                            data.Rows.Add(structure[i].structureID);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "StructureID";
                    e.ListBox.DataTextField = "StructureID";
                    e.ListBox.DataValueField = "StructureID";
                    e.ListBox.DataBind();
                    break;
                default:
                    break;
            }

            //// sector

            //data = new DataTable();
            //data.Columns.Add("CreditRating");

            //CreditRatingsBL CreditRatingsBL = new CreditRatingsBL();
            //List<CreditRating> CreditRating = CreditRatingsBL.GetRatings();
            //for (int i = 0; i < CreditRating.Count - 1; i++)
            //{
            //    data.Rows.Add(CreditRating[i].Rating);
            //}

            //e.ListBox.DataSource = data;
            //e.ListBox.DataKeyField = "CreditRating";
            //e.ListBox.DataTextField = "CreditRating";
            //e.ListBox.DataValueField = "CreditRating";
            //e.ListBox.DataBind();
        }
        protected void btnCountrySave_Click(object sender, EventArgs e)
        {
            CountryBL countryBL = new CountryBL();
            if (txtCountryName.Text != "" || txtCountryCode.Text != "")
            {

                DAL.tblCountry country = new DAL.tblCountry();
                country.Name = txtCountryName.Text.Trim();
                country.Code = txtCountryCode.Text.Trim();

                if (!string.IsNullOrEmpty(hfCountryID.Value))
                {
                    country.ID = Convert.ToInt32(hfCountryID.Value);
                    LogActivity("Country Updated", "Country has been updated", string.Empty);
                }
                else
                {
                    LogActivity("Country Created", "Country has been created", string.Empty);
                }

                string result = countryBL.SaveCountry(country);

                lblCountryError.Visible = true;
                lblCountryError.Text = result;
                ShowMessage("Message", result);
                BindCountry();
                hfCountryID.Value = string.Empty;
                Clear();
            }
            else
            {
                lblCountryError.Visible = true;
                lblCountryError.Text = "Please Enter The Details First.";
            }
        }
        private void BindRegions()
        {
            CountryBL countryBL = new CountryBL();
            txtCPRegion.DataSource = countryBL.GetCountry();
            txtCPRegion.DataTextField = "Name";
            txtCPRegion.DataValueField = "Name";
            txtCPRegion.DataBind();

            ddlBorrowerRegion.DataSource = countryBL.GetCountry();
            ddlBorrowerRegion.DataTextField = "Name";
            ddlBorrowerRegion.DataValueField = "Name";
            ddlBorrowerRegion.DataBind();
        }
 private void BindCountry()
 {
     CountryBL countryBL = new CountryBL();
     grdCountry.DataSource = countryBL.GetCountry().OrderBy(c => c.Name).ToList();
     grdCountry.DataBind();
 }
        protected void grdCountry_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            CountryBL countryBL = new CountryBL();
            if (e.CommandName == "RemoveCountry")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                countryBL.Delete(id);

                LogActivity("Country Removed", "Country has been removed", string.Empty);

            }
            else if (e.CommandName == "EditCountry")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                tblCountry country = countryBL.GetByID(id);
                txtCountryName.Text = country.Name;
                txtCountryCode.Text = country.Code;

                hfCountryID.Value = country.ID.ToString();
            }
            BindCountry();
        }