void PrintProductVSByCategory(Remix.Category category, StringBuilder sb) { Products products = new Products(); int.TryParse(Request["page"], out products.CurrentPage); products.CurrentPage = products.CurrentPage == 0 ? 1 : products.CurrentPage; BestBuyCategoryProductsFiller.Do(products, category); sb.Append("<div>"); sb.Append("<h2>Product VS Pair List - Total " + products.TotalPages + " Pages</h2>"); sb.Append("<ul class='better-ranked'>"); foreach (var product in products) { ProductPool.Cache(product, CacheType.Simple); sb.Append(@" <li> <a href='/P.aspx?upc=" + product.UPC + @"&title=" + HttpUtility.UrlEncode(HttpUtility.HtmlEncode(product.Name)) + @"' title='" + product.Name + (product.BBYSalePrice > 0 ? " $" + product.BBYSalePrice : "") + @"'> <img src='" + (string.IsNullOrEmpty(product.LargeImageUrl) ? product.ThumbnailImageUrl : product.LargeImageUrl) + @"' /><br /> " + product.Name + @" " + (product.BBYSalePrice > 0 ? "<br /><span style='color:#000'>$" + product.BBYSalePrice + "</span>" : "") + @" </a> </li> "); } sb.Append("</ul>"); sb.Append("<div class='clear' style='width:100%;'></div>"); sb.Append("</div>"); //page string baseUrl = "/Category.aspx?id=" + HttpUtility.UrlEncode(category.Id); HTMLGenerator.PrintPageNav(products.CurrentPage, products.TotalPages, baseUrl, sb); }
public void UpdateRemix(Remix rmx) { Genre genreLink = _genre.GetGenreNoRemixes(rmx.RequestedGenre.Id); rmx.RequestedGenre = genreLink; _repo.Update(rmx); }
public void AddRemix(Remix rmx) { Genre genrelink = _genre.GetGenreNoRemixes(rmx.RequestedGenre.Id); rmx.UserTable = _user; rmx.RequestedGenre = genrelink; _repo.Add(rmx); }
public static void Do(Products products, Remix.Category category) { products.Type = AggregationType.ByCategory; Remix.Server server = new Remix.Server("", ""); Remix.Products remixProducts = server.GetProduct(category, products.CurrentPage); List<string> relatedSkuList = new List<string>(); if (remixProducts != null && remixProducts.Count > 0) { int.TryParse(remixProducts.TotalPages, out products.TotalPages); int.TryParse(remixProducts.Total, out products.Total); int.TryParse(remixProducts.To, out products.To); int.TryParse(remixProducts.From, out products.From); int.TryParse(remixProducts.CurrentPage, out products.CurrentPage); foreach (var remixProduct in remixProducts) { Product product = new Product(); product.BBYSKU = remixProduct.Sku; product.UPC = remixProduct.UPC; product.Name = remixProduct.Name; product.BBYCategoryPath = remixProduct.CategoryPath.ToArray(); product.ThumbnailImageUrl = string.IsNullOrEmpty(remixProduct.ImageUrl) ? remixProduct.ThumbnailimageUrl : remixProduct.ImageUrl; product.LargeImageUrl = remixProduct.LargeImageUrl; product.BBYUrl = remixProduct.BBYUrl; product.BBYSubClassId = remixProduct.SubclassId; product.BBYSubClassName = remixProduct.Subclass; product.DescShort = remixProduct.ShortDescription; decimal.TryParse(remixProduct.SalePrice, out product.BBYSalePrice); if (remixProduct.RelatedProducts != null) { foreach (var sku in remixProduct.RelatedProducts) { product.SimilarProducts.Add(new Product() { BBYSKU = sku }); relatedSkuList.Add(sku); } } products.Add(product); } } // }
public Remix GetRemix(int id) { Remix single = (from r in _repo.Query <Remix>() where r.Id == id select new Remix { Id = r.Id, OriginalName = r.OriginalName, youtubeUrl = r.youtubeUrl, RequestedGenre = r.RequestedGenre, UserNote = r.UserNote, Status = r.Status, AdminNote = r.AdminNote }).FirstOrDefault(); return(single); }
public IActionResult Post([FromBody] Remix rmx) { if (rmx == null) { return(BadRequest()); } else if (rmx.Id == 0) { _rmx.PassName(User.Identity.Name); _rmx.AddRemix(rmx); return(Ok()); } else { _rmx.UpdateRemix(rmx); return(Ok()); } }
private static List<Product> Fill(Remix.Products remixProducts) { List<Product> products = new List<Product>(); if (remixProducts == null || remixProducts.Count == 0) return products; foreach (var remixProduct in remixProducts) { Product product = new Product(); product.BBYSKU = remixProduct.Sku; product.UPC = remixProduct.UPC; product.Name = remixProduct.Name; product.BBYCategoryPath = remixProduct.CategoryPath.ToArray(); product.LargeImageUrl = string.IsNullOrEmpty(remixProduct.LargeFrontImageUrl) ? remixProduct.LargeImageUrl : remixProduct.LargeFrontImageUrl; product.LargeImageUrl = string.IsNullOrEmpty(product.LargeImageUrl) ? remixProduct.ImageUrl : product.LargeImageUrl; product.ThumbnailImageUrl = string.IsNullOrEmpty(remixProduct.ImageUrl) ? remixProduct.ThumbnailimageUrl : remixProduct.ImageUrl; product.BBYUrl = remixProduct.BBYUrl; product.BBYClassId = remixProduct.ClassId; product.BBYClassName = remixProduct.Class; product.BBYSubClassId = remixProduct.SubclassId; product.BBYSubClassName = remixProduct.Subclass; product.Desc = remixProduct.LongDescription; product.DescShort = remixProduct.ShortDescription; decimal.TryParse(remixProduct.SalePrice, out product.BBYSalePrice); decimal.TryParse(remixProduct.RegularPrice, out product.BBYRegularPrice); int.TryParse(remixProduct.SalesRankLongTerm, out product.BBYSalesRankLongTerm); int.TryParse(remixProduct.SalesRankMediumTerm, out product.BBYSalesRankMediumTerm); int.TryParse(remixProduct.SalesRankShortTerm, out product.BBYSalesRankShortTerm); if (remixProduct.RelatedProducts != null) { foreach (var sku in remixProduct.RelatedProducts) { product.SimilarProducts.Add(new Product() { BBYSKU = sku }); } } products.Add(product); } return products; }
public void DeleteRemix(int id) { Remix toDelete = GetRemix(id); _repo.Delete(toDelete); }
public static void PrintSubCategoryNav(StringBuilder sb, Remix.Category category) { sb.Append("<ul class='sub-cate'>"); // warm up List<string> categoryIds = new List<string>(); foreach (var subCategory in category.SubCategories) { categoryIds.Add(subCategory.Id); } CategoryPool.WarmUpCategories(categoryIds); // sub foreach (var subCategory in category.SubCategories) { sb.Append(string.Format(@"<li><a href='/Category.aspx?id={0}' title='{1}'>{1}</a>", subCategory.Id, subCategory.Name)); Remix.Category fullSubCategory = CategoryPool.GetById(subCategory.Id); // sub-sub if (fullSubCategory.SubCategories.Count > 0) { int i = 0; sb.Append(" - "); foreach (var subSubCategory in fullSubCategory.SubCategories) { sb.Append(string.Format(@"<a href='/Category.aspx?id={0}' title='{1}' class='sub-sub-cate'>{1}</a>, ", subSubCategory.Id, subSubCategory.Name)); if (i++ == 3) break; } sb.Append( string.Format(@"<a href='/Category.aspx?id={0}' title='more subcategories' class='sub-sub-cate'>more...</a></li>", subCategory.Id)); } } sb.Append("</ul>"); }