private void ExecutedOrderByCommand(string column) { if (!SortBy.Equals(column)) { IsAscending = false; } if (!IsAscending) { Users = column == "Name" ? new ObservableCollection <UserModel>(Users.OrderBy(c => c.Name)) : column == "Email" ? new ObservableCollection <UserModel>(Users.OrderBy(c => c.Email)) : column == "Phone" ? new ObservableCollection <UserModel>(Users.OrderBy(c => c.Phone)) : column == "Age" ? new ObservableCollection <UserModel>(Users.OrderBy(c => c.Age)) : column == "Postal" ? new ObservableCollection <UserModel>(Users.OrderBy(c => c.Postal)) : new ObservableCollection <UserModel>(Users.OrderBy(c => c.Name)); } else { Users = column == "Name" ? new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Name)) : column == "Email" ? new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Email)) : column == "Phone" ? new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Phone)) : column == "Age" ? new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Age)) : column == "Postal" ? new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Postal)) : new ObservableCollection <UserModel>(Users.OrderByDescending(c => c.Name)); } IsAscending = !IsAscending; SortBy = column; }
public bool Equals(GroupQuery input) { if (input == null) { return(false); } return (( Name == input.Name || (Name != null && Name.Equals(input.Name)) ) && ( GroupType == input.GroupType || (GroupType != null && GroupType.Equals(input.GroupType)) ) && ( CreationDate == input.CreationDate || (CreationDate != null && CreationDate.Equals(input.CreationDate)) ) && ( SortBy == input.SortBy || (SortBy != null && SortBy.Equals(input.SortBy)) ) && ( GroupMemberCountFilter == input.GroupMemberCountFilter || (GroupMemberCountFilter.Equals(input.GroupMemberCountFilter)) ) && ( LocaleFilter == input.LocaleFilter || (LocaleFilter != null && LocaleFilter.Equals(input.LocaleFilter)) ) && ( TagText == input.TagText || (TagText != null && TagText.Equals(input.TagText)) ) && ( ItemsPerPage == input.ItemsPerPage || (ItemsPerPage.Equals(input.ItemsPerPage)) ) && ( CurrentPage == input.CurrentPage || (CurrentPage.Equals(input.CurrentPage)) ) && ( RequestContinuationToken == input.RequestContinuationToken || (RequestContinuationToken != null && RequestContinuationToken.Equals(input.RequestContinuationToken)) )); }
// override object.Equals public override bool Equals(object obj) { // // See the full list of guidelines at // http://go.microsoft.com/fwlink/?LinkID=85237 // and also the guidance for operator== at // http://go.microsoft.com/fwlink/?LinkId=85238 // if (obj == null || GetType() != obj.GetType()) { return(false); } return(SortBy.Equals(obj)); }
public ActionResult Details(SavingsAccountDetailsViewModel model, String TransactionNumber, String DateRange, String Description, String TransactionType, String PriceRange, String RangeFrom, String RangeTo, SortBy TransactionNumberSort, SortBy TransactionTypeSort, SortBy DescriptionSort, SortBy AmountSort, SortBy DateSort) { int?id = model.SavingsAccountID; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SavingsAccount savingsAccount = db.SavingsAccounts.Find(id); SavingsAccountDetailsViewModel modelToPass = new SavingsAccountDetailsViewModel { SavingsAccountID = id, SavingsAccount = savingsAccount, Transactions = savingsAccount.Transactions }; if (savingsAccount == null) { return(HttpNotFound()); } var query = from t in savingsAccount.Transactions select t; if (TransactionNumber != null && TransactionNumber != "") { Int32 number; try { number = Convert.ToInt32(TransactionNumber); query = query.Where(t => t.TransactionID.Equals(number)); } catch { ViewBag.TransactionNumberValidation = "Enter a whole number"; ViewBag.Count = savingsAccount.Transactions.Count(); ViewBag.TransactionTypes = new SelectList(Utilities.Utility.TranscationTypes); return(View(modelToPass)); } } query = query.Where(t => t.Description.Contains(Description)); if (!DateRange.Equals("Custom") && !DateRange.Equals("All")) { if (DateRange.Equals("Last 15 days")) { query = query.Where(t => t.TransactionDate >= DateTime.Now.AddDays(-1)); } else if (DateRange.Equals("Last 30 days")) { query = query.Where(t => t.TransactionDate >= DateTime.Now.AddDays(-30)); } else { query = query.Where(t => t.TransactionDate >= DateTime.Now.AddDays(-60)); } } if (DateRange.Equals("Custom")) { query = query.Where(t => t.TransactionDate >= model.DateFrom && t.TransactionDate <= model.DateTo); } if (!TransactionType.Equals("All")) { query = query.Where(t => t.TransactionType.Equals(TransactionType)); } if (!PriceRange.Equals("Custom")) { if (PriceRange.Equals("$0-$100")) { query = query.Where(t => t.Amount >= 0 && t.Amount <= 100); } else if (PriceRange.Equals("$100-$200")) { query = query.Where(t => t.Amount >= 100 && t.Amount <= 200); } else if (PriceRange.Equals("$200-$300")) { query = query.Where(t => t.Amount >= 200 && t.Amount <= 300); } else { query = query.Where(t => t.Amount >= 300); } } else { Decimal rangeFrom; Decimal rangeTo; try { rangeFrom = Convert.ToDecimal(RangeFrom); rangeTo = Convert.ToDecimal(RangeTo); query = query.Where(t => t.Amount >= rangeFrom && t.Amount <= rangeTo); } catch { ViewBag.Message = "Enter a valid range of numbers"; ViewBag.Count = savingsAccount.Transactions.Count(); ViewBag.TransactionTypes = new SelectList(Utilities.Utility.TranscationTypes); return(View(modelToPass)); } } if (TransactionNumberSort.Equals(SortBy.Ascending)) { if (TransactionTypeSort.Equals(SortBy.Ascending)) { if (DescriptionSort.Equals(SortBy.Ascending)) { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } else { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } } else { if (DescriptionSort.Equals(SortBy.Ascending)) { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } else { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderBy(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } } } else { if (TransactionTypeSort.Equals(SortBy.Ascending)) { if (DescriptionSort.Equals(SortBy.Ascending)) { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } else { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenBy(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } } else { if (DescriptionSort.Equals(SortBy.Ascending)) { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenBy(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } else { if (AmountSort.Equals(SortBy.Ascending)) { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenBy(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } else { if (DateSort.Equals(SortBy.Ascending)) { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenBy(t => t.TransactionDate); } else { query.OrderByDescending(t => t.TransactionID).ThenByDescending(t => t.TransactionType).ThenByDescending(t => t.Description).ThenByDescending(t => t.Amount).ThenByDescending(t => t.TransactionDate); } } } } } query.OrderByDescending(t => t.TransactionID); List <Transaction> list = query.ToList(); modelToPass = new SavingsAccountDetailsViewModel { SavingsAccountID = id, SavingsAccount = savingsAccount, Transactions = list }; ViewBag.Count = list.Count(); ViewBag.TransactionTypes = new SelectList(Utilities.Utility.TranscationTypes); return(View(modelToPass)); }
protected void Page_Load(object sender, EventArgs e) { var pageType = Request.QueryString["ID"]; var gametype = gameType.Value; var sortby = SortBy.Value; var genre = GameGenre.Value; switch (pageType) { case "PC": Session["currentPage"] = "PC"; break; case "PS": Session["currentPage"] = "PS"; break; case "Xbox": Session["currentPage"] = "xbox"; break; case "Nintendo": Session["currentPage"] = "nintendo"; break; } StringBuilder display = new StringBuilder(); display.Clear(); var db = new AlchemyLinkDataContext(); dynamic games = from g in db.Products where g.Platfrom.Equals(pageType) && g.Type.Equals(gametype) select g; dynamic orders = from o in db.Order_Products select o; List <int> popGamesCount = new List <int>(); List <int> popGames = new List <int>(); List <GameCount> popGameRating = new List <GameCount>(); foreach (Order_Product o in orders) { popGamesCount.Add(o.ProductID); } popGames = popGamesCount.Distinct().ToList(); for (int i = 0; i < popGames.Count; i++) { GameCount newGame = new GameCount(); newGame.setGameID(popGames.ElementAt(i)); newGame.setGameCount(0); popGameRating.Add(newGame); } for (int i = 0; i < popGameRating.Count; i++) { foreach (int id in popGamesCount) { if (popGameRating.ElementAt(i).getGameID().Equals(id)) { int count = popGameRating.ElementAt(i).getGameCount(); count++; popGameRating.ElementAt(i).setGameCount(count); } } } popGameRating = popGameRating.OrderByDescending(o => o.getGameCount()).ToList(); if (genre.Equals("none")) { if (sortby.Equals("Pop")) { List <int> rejectGames = new List <int>(); List <int> selectedGames = new List <int>(); for (int i = 0; i < popGameRating.Count; i++) { Product prodR = popGameRating.ElementAt(i).GetProduct(); foreach (Product prod in games) { if (prodR.Id.Equals(prod.Id)) { if (prod.StockLevels > 0) { selectedGames.Add(prod.Id); display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } } foreach (Product p in games) { Boolean found = false; foreach (int i in selectedGames) { if (p.Id.Equals(i)) { found = true; } } if (!found) { rejectGames.Add(p.Id); } } for (int i = 0; i < rejectGames.Count; i++) { Product prod = (from p in db.Products where p.Id.Equals(rejectGames.ElementAt(i)) select p).FirstOrDefault(); if (prod.StockLevels > 0) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } else if (sortby.Equals("High")) { dynamic game = from g in db.Products where g.Platfrom.Equals(pageType) && g.Type.Equals(gametype) orderby g.Price descending select g; foreach (Product prod in game) { if (prod.StockLevels > 0) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } else { testMsg.InnerHtml = "Low reached"; dynamic game = from g in db.Products where g.Platfrom.Equals(pageType) && g.Type.Equals(gametype) orderby g.Price ascending select g; foreach (Product prod in game) { if (prod.StockLevels > 0) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } } else { if (SortBy.Equals("Pop")) { List <int> rejectGames = new List <int>(); List <int> selectedGames = new List <int>(); for (int i = 0; i < popGameRating.Count; i++) { Product prodR = popGameRating.ElementAt(i).GetProduct(); foreach (Product prod in games) { if (prodR.Id.Equals(prod.Id)) { if ((prod.StockLevels > 0) && (prod.Genre.Equals(genre))) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } } foreach (Product p in games) { Boolean found = false; foreach (int i in selectedGames) { if (p.Id.Equals(i)) { found = true; } } if (!found) { rejectGames.Add(p.Id); } } for (int i = 0; i < rejectGames.Count; i++) { Product prod = (from p in db.Products where p.Id.Equals(rejectGames.ElementAt(i)) select p).FirstOrDefault(); if ((prod.StockLevels > 0) && (prod.Genre.Equals(genre))) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } else if (sortby.Equals("High")) { dynamic game = from g in db.Products where g.Platfrom.Equals(pageType) && g.Type.Equals(gametype) orderby g.Price descending select g; foreach (Product prod in game) { if ((prod.StockLevels > 0) && (prod.Genre.Equals(genre))) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } else { testMsg.InnerHtml = "Low reached"; dynamic game = from g in db.Products where g.Platfrom.Equals(pageType) && g.Type.Equals(gametype) orderby g.Price ascending select g; foreach (Product prod in game) { if ((prod.StockLevels > 0) && (prod.Genre.Equals(genre))) { display.Append("<div class=\"product\">" + Environment.NewLine); display.Append("<div class=\"inner-product\">" + Environment.NewLine); display.Append("<div class=\"figure-image\">" + Environment.NewLine); display.Append("<a href =\"single.aspx?ID=" + prod.Id + "\">" + Environment.NewLine); display.Append("<img src=\"" + prod.ImageLink + "\"></a>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); display.Append("<h3 class=\"product-title\"><a href=\"Single.aspx?ID=" + prod.Id + "\">" + prod.Name + "</a></h3>" + Environment.NewLine); display.Append("<small class=\"price\">" + String.Format("{0:C2}", prod.Price) + "</small>" + Environment.NewLine); display.Append("<br />"); display.Append("</div>" + Environment.NewLine); display.Append("</div>" + Environment.NewLine); } } } } prodList.InnerHtml = display.ToString(); display.Clear(); }