예제 #1
0
        /// <summary>
        /// Creates and edits an alert.
        /// </summary>
        public static void SetAlert(ContentItem content)
        {
            // Create alert, else edit alert.
            if (content.ContentItemID == null)
            {
                content.CountryID = content.CountryIDList != null?String.Join(", ", content.CountryIDList.ToArray()) : "";

                // Send item to CreateContentItem Exigo service to create alert in database.
                var contentItem = ContentService.SetContentItems(content);

                // For each country/language set, create one entry in the ContentItemCountryLanguage DB.
                ContentService.SetContentItemCountryLanguages(contentItem);
            }
            else
            {
                // Send ContentItem to EditContentItems exigo service.
                ContentService.SetContentItems(content);

                // Delete ContentItem from ContentItemCountryLanguage DB since we will re-set the country/language availability.
                ContentService.DeleteContentItemCountryLanguages(content.ContentItemID.ToString());

                //// Create one entry for each country/language selected.
                ContentService.SetContentItemCountryLanguages(content);

                //Deletes content item ID from cache after modifying block, so that page will reload from DB instead of pulling from cache.
                GlobalUtilities.DeleteFromCache(content.ContentItemID.ToString());
            }
        }
예제 #2
0
        /// <summary>
        /// Updates content block in ContentItemCountryLanguages table and deletes from cache.
        /// </summary>
        /// <param name="contentBlock"></param>
        public static void SetContentBlock(ContentItem contentBlock)
        {
            ContentService.SetContentItemCountryLanguages(contentBlock);

            //Deletes content item ID from cache after modifying block, so that page will reload from DB instead of pulling from cache
            GlobalUtilities.DeleteFromCache(contentBlock.ContentItemID.ToString().ToUpper() + contentBlock.CountryID + contentBlock.LanguageID.ToString());
        }