private PropertyLinkPhoto UpdateValue(PropertyLinkPhoto valueToHtml) { Product temp; string outputValue = valueToHtml.PropertyName; if (outputValue.Contains("(") && outputValue.Contains(")")) { outputValue = outputValue.Remove(0, outputValue.IndexOf("(") + 1); outputValue = outputValue.Remove(outputValue.IndexOf(")")); outputValue = outputValue.Replace(" ", ""); //ArtNo Bosch if (outputValue.Length == 10) { temp = ProductService.GetProduct(outputValue); if (temp != null && temp.UrlPath != string.Empty) { outputValue = @"<a href=" + UrlService.GetLink(ParamType.Product, temp.UrlPath, temp.ID) + " class=''link-pv-name'' target='_blank'>" + temp.Name + " [" + temp.ArtNo + "] </a>"; valueToHtml.PropertyLink = outputValue; //valueToHtml.PhotoLink = temp.Photo; valueToHtml.PhotoLink = FoldersHelper.GetImageProductPath(ProductImageType.Small, temp.Photo, false); } } } return(valueToHtml); }
// protected void Page_Load(object sender, EventArgs e) { // IEnumerable<PropertyValue> productProperties = PropertyService.GetSpecificValuesByProductId(ProductId, "Комплект поставки"); string[] tempContainedStringArray = new string[] { "Комплект поставки", "Заголовок", "Комплектация", "Содержание", "Эффективность рекламной акции" }; List <PropertyValue> apr = ProductProperties.Where(p => tempContainedStringArray.Contains(p.Property.Name) ) .ToList(); // if (apr != null && apr.Count > 0) { int[] compareProducts; // ProductIds if (ManufacteruArtNo == string.Empty) //No ManId for this product { compareProducts = new int[] { ProductId }; } else { compareProducts = ProductService.GetProductIdWithSameManufactureId(ManufacteruArtNo).ToArray(); } var propertyNames = new List <string>(); foreach (var item in compareProducts) { propertyNames.AddRange(PropertyService.GetPropertyValuesByProductId(item).Select(p => p.Property.Name).Intersect(tempContainedStringArray)); } PropertyNames = new List <string>(); PropertyNames.AddRange(propertyNames.Distinct()); ProductItems = new List <ProductItem>(); foreach (var item in compareProducts) { Product product = ProductService.GetProduct(item); if (product == null) { continue; } ProductItems.Add(new ProductItem(product, PropertyNames)); if (lblHeader.Text == string.Empty) { lblHeader.Text = Resources.Resource.Client_Details_Set_Properties + ": " + product.Name; } // } foreach (var item in ProductItems) { foreach (var val in item.Properties) { //if (!SetPropertyNames.Keys.Contains(val.Value)) // SetPropertyNames.Add(val.Value, UpdateValue(val.Value)); if (SetPropertyNames.Where(t => t.PropertyName.Contains(val.Value)).ToList().Count == 0) { PropertyLinkPhoto pl = new PropertyLinkPhoto(); pl.PropertyName = val.Value; pl.PropertyLink = val.Value; pl = UpdateValue(pl); SetPropertyNames.Add(pl); } } } HasProperties = true; } else { HasProperties = false; this.Visible = false; } }