private void rptProductsList_ItemDataBound(object source, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } Literal litHeader = (Literal)e.Item.FindControl("rowHeader"); Literal litFooter = (Literal)e.Item.FindControl("rowFooter"); //Alternate items displayed differently? _itemCounter++; try { IProductSummary ps = e.Item.DataItem as IProductSummary; ScaledPriceProcessor priceScaler = new ScaledPriceProcessor(); Literal litPrice = (Literal)e.Item.FindControl("litPrice"); litPrice.Text = HtmlFormatUtils.FormatMoney(new Money(ps.Price)) + " " + ps.PriceDescription; RenderProductNameAndDescription(e, ps); RenderProductImage(e, ps); _itemCounter = 0; } catch (Exception f) { LogManager.GetLogger(GetType()).Error(f); } }
public Category GetUpdatedCategory() { ReadRequestParams(); Category newCategory; if (CatID != CATEGORY_ID_NEW) { newCategory = controller.CatalogueViewer.GetCategory(1, "en-GB", CatID);//hack } else { newCategory = new Category(); newCategory.IsPublished = true; newCategory.ParentCategory = controller.CatalogueViewer.GetCategory(1, "en-GB", ParentNodeID);//hack } newCategory.CategoryDescription = fckDescription.Value; newCategory.CategoryName = txtCategoryName.Text; newCategory.CssClass = txtCss.Text; decimal changeBY = 0; try { changeBY = Convert.ToDecimal(txtPriceChangePercent.Text); } catch { changeBY = 0; } ScaledPriceProcessor priceScaler = new ScaledPriceProcessor(); if(changeBY > 0){ ICategoryView view = controller.CatalogueViewer.GetCategoryView(1, "en-GB", CatID);//hack if (view.ProductList.Count == 0) { ICategoryView subView; foreach (ICategory node in view.ChildNodes) { subView = controller.CatalogueViewer.GetCategoryView(1, "en-GB", node.NodeID);//hack List<IProductSummary> productList = subView.ProductList; foreach (IProductSummary p in productList) { priceScaler.SaveProductPriceChange(p.ProductID, priceScaler.GenerateScaledPrice(changeBY, p.Price)); } } } else { List<IProductSummary> productList = view.ProductList; foreach (IProductSummary p in productList) { priceScaler.SaveProductPriceChange(p.ProductID, priceScaler.GenerateScaledPrice(changeBY, p.Price)); } } } if (wim.ImageHeight != null && wim.WebImagePath != null) { newCategory.Height = Convert.ToInt16(wim.ImageHeight); newCategory.Width = Convert.ToInt16(wim.ImageWidth); newCategory.Url = WebHelper.GetImageUrl(wim.WebImagePath); } return newCategory; }