public static string GetPublishIconUrl(CatalogVisibility visibility) { HttpContext context = HttpContext.Current; Page page = context.Handler as Page; if (page != null) { string theme = page.Theme; if (string.IsNullOrEmpty(theme)) { theme = page.StyleSheetTheme; } string baseImagesFolder = (string.IsNullOrEmpty(theme) ? "~/Images/Icons/" : "~/App_Themes/" + theme + "/Images/Icons/"); switch (visibility) { case CatalogVisibility.Public: return(baseImagesFolder + "CmsPublic.png"); case CatalogVisibility.Hidden: return(baseImagesFolder + "CmsHidden.png"); default: return(baseImagesFolder + "CmsPrivate.png"); } } return(string.Empty); }
protected void SaveButton_Click(object sender, EventArgs e) { CatalogVisibility visibility = CatalogVisibility.Public; if (VisPublic.Checked) { visibility = CatalogVisibility.Public; } else if (VisHidden.Checked) { visibility = CatalogVisibility.Hidden; } else { visibility = CatalogVisibility.Private; } foreach (ICatalogable catalogItem in _CatalogItems) { if (catalogItem is Category) { Category item = (Category)catalogItem; item.Visibility = visibility; item.Save(); //CHECK IF WE SHOULD RECURSE if (Scope.SelectedValue == "1") { UpdateChildNodes(item.Id, visibility); } } else if (catalogItem is Product) { Product item = (Product)catalogItem; item.Visibility = visibility; item.Save(); } else if (catalogItem is Webpage) { Webpage item = (Webpage)catalogItem; item.Visibility = visibility; item.Save(); } else if (catalogItem is Link) { Link item = (Link)catalogItem; item.Visibility = visibility; item.Save(); } } //RETURN TO BROWSE MODE Response.Redirect("Browse.aspx?CategoryId=" + _CategoryId.ToString()); }
private void UpdateChildNodes(int categoryId, CatalogVisibility visibility) { IList <CatalogNode> children = CatalogDataSource.LoadForCategory(categoryId, false); IDatabaseSessionManager database = AbleContext.Current.Database; database.BeginTransaction(); foreach (CatalogNode child in children) { child.Visibility = visibility; child.ChildObject.Visibility = visibility; child.Save(true); if (child.CatalogNodeType == CatalogNodeType.Category) { UpdateChildNodes(child.CatalogNodeId, visibility); } } database.CommitTransaction(); }
public override int GetHashCode() { unchecked { var hashCode = Attributes != null?Attributes.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (CatalogVisibility != null ? CatalogVisibility.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Categories != null ? Categories.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ExternalUrl != null ? ExternalUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Featured.GetHashCode(); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ (Images != null ? Images.GetHashCode() : 0); hashCode = (hashCode * 397) ^ InStock.GetHashCode(); hashCode = (hashCode * 397) ^ ManageStock.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ OnSale.GetHashCode(); hashCode = (hashCode * 397) ^ ParentId; hashCode = (hashCode * 397) ^ (Permalink != null ? Permalink.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Price != null ? Price.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PriceHtml != null ? PriceHtml.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Purchasable.GetHashCode(); hashCode = (hashCode * 397) ^ (RegularPrice != null ? RegularPrice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RelatedIds != null ? RelatedIds.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SalePrice != null ? SalePrice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShortDescription != null ? ShortDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Slug != null ? Slug.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (StockQuantity != null ? StockQuantity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TaxClass != null ? TaxClass.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TaxStatus != null ? TaxStatus.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TotalSales; hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Virtual.GetHashCode(); return(hashCode); } }
/// <summary> /// Constructor /// </summary> /// <param name="categoryId">Category Id for this path node</param> /// <param name="catalogNodeId">CatalogNode Id for this path node</param> /// <param name="catalogNodeType">CatalogNode type for this path node</param> /// <param name="visibility">Visibility setting for this path node</param> /// <param name="name">Name of this path node</param> /// <param name="summary">Summary of this path node</param> /// <param name="thumbnailUrl">Thumbnail URL for this path node</param> /// <param name="thumbnailAltText">Alternate text for the thumbnail for this path node</param> /// <param name="theme">The theme applied to this path node</param> public CatalogPathNode(int categoryId, int catalogNodeId, CatalogNodeType catalogNodeType, CatalogVisibility visibility, string name, string summary, string thumbnailUrl, string thumbnailAltText, string theme) { this.CategoryId = categoryId; this.CatalogNodeId = catalogNodeId; this.CatalogNodeType = catalogNodeType; this.Visibility = visibility; this.Name = name; this.Summary = summary; this.ThumbnailUrl = thumbnailUrl; this.ThumbnailAltText = thumbnailAltText; this.Theme = theme; }
/// <summary> /// Constructor /// </summary> /// <param name="categoryId">Category Id of this catalog node</param> /// <param name="catalogNodeId">Catalog node Id of this catalog node</param> /// <param name="catalogNodeType">Type of this catalog node</param> /// <param name="orderBy">The value of OrderBy field</param> /// <param name="isDirty">Does this catalog node need to be saved to database or not</param> /// <param name="visibility">The visibility of this catalog node</param> /// <param name="name">The name of this catalog node</param> /// <param name="summary">The summary field of this catalog node</param> /// <param name="thumbnailUrl">The thumbnail url of this catalog node</param> /// <param name="thumbnailAltText">The alt text for the thumbnail of this catalog node</param> public CatalogNode(int categoryId, int catalogNodeId, CatalogNodeType catalogNodeType, Int16 orderBy, bool isDirty, CatalogVisibility visibility, string name, string summary, string thumbnailUrl, string thumbnailAltText) : this(categoryId, catalogNodeId, catalogNodeType, orderBy, isDirty) { this.Visibility = visibility; this.Name = name; this.Summary = summary; this.ThumbnailUrl = thumbnailUrl; this.ThumbnailAltText = thumbnailAltText; this.m_ICatalogableInitialized = true; }
/// <summary> /// Constructor /// </summary> /// <param name="categoryId">The category Id of this node</param> /// <param name="catalogNodeId">The catalog node id of this node</param> /// <param name="catalogNodeType">The type of this catalog node</param> /// <param name="orderBy">The value of OrderBy field</param> /// <param name="isDirty">Does this node need to be saved to the database?</param> /// <param name="visibility">The visibility setting of this node</param> /// <param name="name">The name of this node</param> /// <param name="summary">The summary field of this node</param> /// <param name="thumbnailUrl">The thumbnail url of this node</param> /// <param name="thumbnailAltText">The alt text for the thumbnail of this node</param> /// <param name="price">The Price of the associated product</param> public CatalogProductNode(int categoryId, int catalogNodeId, CatalogNodeType catalogNodeType, Int16 orderBy, bool isDirty, CatalogVisibility visibility, string name, string summary, string thumbnailUrl, string thumbnailAltText, LSDecimal price) : base(categoryId, catalogNodeId, catalogNodeType, orderBy, isDirty, visibility, name, summary, thumbnailUrl, thumbnailAltText) { this.Price = price; }
public static async Task Producer(string brokerList, string connStr, string topic, string cacertlocation) { try { var config = new ProducerConfig { BootstrapServers = brokerList, SecurityProtocol = SecurityProtocol.SaslSsl, SaslMechanism = SaslMechanism.Plain, SaslUsername = "******", SaslPassword = connStr, SslCaLocation = "", //Debug = "security,broker,protocol" //Uncomment for librdkafka debugging information }; using (var producer = new ProducerBuilder <long, string>(config).SetKeySerializer(Serializers.Int64).SetValueSerializer(Serializers.Utf8).Build()) { Console.WriteLine("Sending 10 messages to topic: " + topic + ", broker(s): " + brokerList); //Data Creation CatalogAvailability availability = new CatalogAvailability { UW = "Yes" }; List <string> CategoryList = new List <string> { "Cat1", "Cat2", "Cat3", "Cat4" }; CatalogContractPrices contractPrices = new CatalogContractPrices { ContractA = "Yes", ContractC = "C", ContractCategoryA = "CatA" }; CatalogVisibility visibility = new CatalogVisibility { ContractA = "A level Visibility", ContractC = "C Visible", Default = "true" }; CatalogFields fields = new CatalogFields { Availability = availability, Brand = "New", CategoryEn = CategoryList, CategoryFr = CategoryList, ContractPrices = contractPrices, NetPrice = "20.2", ProductID = "99115", SaleRank = "First", TitleEn = "Good Product", TitleFr = "French Product", Visibility = visibility }; CatalogModel catalogModel = new CatalogModel { Fields = fields }; var CatalogJsonString = JsonConvert.SerializeObject(catalogModel); for (int x = 0; x < 10; x++) { var msg = string.Format("Sample Catalog #{0} sent at {1}", CatalogJsonString, DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss.ffff")); var deliveryReport = await producer.ProduceAsync(topic, new Message <long, string> { Key = DateTime.UtcNow.Ticks, Value = msg }); Console.WriteLine(string.Format("Message {0} sent (value: '{1}')", x, msg)); } } } catch (Exception e) { Console.WriteLine(string.Format("Exception Occurred - {0}", e.Message)); } }