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(); }
private void BindBorrowers() { BorrowersBL bl = new BorrowersBL(); grdBorrowers.DataSource = bl.GetBorrowers().OrderBy(c => c.Name).ToList(); grdBorrowers.DataBind(); }