Exemple #1
0
        private void AddCustomTaxonomy(IEnumerable <string> taxonNames, string taxonomyName, DynamicContent pressArticleItem, bool isHierarchicalTaxonomy = false)
        {
            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

            if (!isHierarchicalTaxonomy)
            {
                foreach (var taxonName in taxonNames)
                {
                    var taxon = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Title == taxonName).FirstOrDefault();
                    if (taxon != null)
                    {
                        pressArticleItem.Organizer.AddTaxa(taxonomyName, taxon.Id);
                    }
                }
            }
            else
            {
                foreach (var taxonName in taxonNames)
                {
                    var taxon = taxonomyManager.GetTaxa <HierarchicalTaxon>().Where(t => t.Title == taxonName).FirstOrDefault();
                    if (taxon != null)
                    {
                        pressArticleItem.Organizer.AddTaxa(taxonomyName, taxon.Id);
                    }
                }
            }
        }
        public void NewsWidget_SelectByCategoryNewsFunctionalityAndPaging()
        {
            var newsController = new NewsController();

            newsController.Model.DisplayMode = ListDisplayMode.Paging;
            int itemsPerPage = 3;

            newsController.Model.ItemsPerPage = itemsPerPage;
            string categoryTitle = "Category";

            string[] newsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            Guid[]   newsId     = new Guid[newsTitles.Count()];

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var             category0       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var             category1       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < newsTitles.Count(); i++)
                {
                    if (i == 0)
                    {
                        newsId[i] = this.serverOperationsNews.CreatePublishedNewsItem(newsTitles[i]);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category0.Id);
                    }
                    else if (i > 0 && i <= 3)
                    {
                        newsId[i] = this.serverOperationsNews.CreatePublishedNewsItem(newsTitles[i]);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category0.Id);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category1.Id);
                    }
                    else
                    {
                        newsId[i] = this.serverOperationsNews.CreatePublishedNewsItem(newsTitles[i]);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category1.Id);
                    }
                }

                this.VerifyCorrectNewsOnPageWithCategoryFilterAndPaging(category0, category1, newsController, newsTitles);
            }
            finally
            {
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
Exemple #3
0
        public void DynamicWidgets_SelectByCategoryFunctionalityAndPaging()
        {
            var dynamicController = new DynamicContentController();

            dynamicController.Model.ContentType  = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.DisplayMode  = ListDisplayMode.Paging;
            dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName;
            int itemsPerPage = 3;

            dynamicController.Model.ItemsPerPage = itemsPerPage;
            string categoryTitle = "Category";

            string[] itemsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls        = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var             category0       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var             category1       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i == 0)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                    }
                    else if (i > 0 && i <= 3)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                }

                this.VerifyCorrectItemsOnPageWithCategoryFilterAndPaging(category0, category1, dynamicController, itemsTitles);
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
Exemple #4
0
        private static TaxonViewModel BuildTaxaTreeBfs(
            Taxon taxon,
            Func <ITaxon, TaxonViewModel> viewModelBuilder,
            Func <IQueryable <Taxon>, IQueryable <Taxon> > sort,
            TaxonomyManager manager,
            int taxaCountLimit,
            ref int currentTaxaCount)
        {
            var            queue         = new Queue <TaxonData>();
            TaxonViewModel rootViewModel = null;

            queue.Enqueue(new TaxonData()
            {
                Taxon = taxon
            });

            while (queue.Count > 0)
            {
                var currentNode = queue.Dequeue();

                var currentViewModel = viewModelBuilder.Invoke(currentNode.Taxon);

                if (currentViewModel != null)
                {
                    // If this is the first created view model, set it to be the root one.
                    if (rootViewModel == null)
                    {
                        rootViewModel = currentViewModel;
                    }

                    if (currentNode.LastKnownParent != null)
                    {
                        currentNode.LastKnownParent.SubTaxa.Add(currentViewModel);
                    }

                    currentTaxaCount++;
                    if (taxaCountLimit > 0 && currentTaxaCount == taxaCountLimit)
                    {
                        return(rootViewModel);
                    }
                }

                // If the current taxon is included in the tree, it should be the parent of the inner taxa.
                var lastKnownParent = currentViewModel ?? currentNode.LastKnownParent;

                var subTaxa       = manager.GetTaxa <Taxon>().Where(t => t.Parent.Id == currentNode.Taxon.Id);
                var sortedSubtaxa = sort.Invoke(subTaxa);

                foreach (var childTaxon in sortedSubtaxa)
                {
                    queue.Enqueue(new TaxonData()
                    {
                        LastKnownParent = lastKnownParent,
                        Taxon           = childTaxon
                    });
                }
            }

            return(rootViewModel);
        }
Exemple #5
0
        public void SetUp()
        {
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);

            Guid          pageId     = ServerOperations.Pages().CreatePage(PageName);
            List <string> categories = new List <string>();

            foreach (var taxonTitle in this.parentCategories)
            {
                ServerOperations.Taxonomies().CreateCategory(taxonTitle + "0");
                categories.Add(taxonTitle + "0");

                for (int i = 1; i < 6; i++)
                {
                    ServerOperations.Taxonomies().CreateCategory(taxonTitle + i, taxonTitle + (i - 1));
                    categories.Add(taxonTitle + i);
                }
            }

            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
            int             index           = 0;

            foreach (var category in categories)
            {
                var cat = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == category);
                ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(ItemsTitle + index, ItemsTitle + index + "Url", Guid.Empty, cat.Id);
                index++;
            }

            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC");
        }
Exemple #6
0
        public virtual IList <HierarchicalTaxon> GetHierarchicalTaxons(string fieldName)
        {
            var    cahcedResultKey = this.FieldCacheKey("GetHierarchicalTaxonNames", fieldName);
            object cachedResult;

            if (this.cachedFieldValues.TryGetValue(cahcedResultKey, out cachedResult))
            {
                return(cachedResult as IList <HierarchicalTaxon>);
            }

            var             taxonIds = this.Fields.GetMemberValue(fieldName) as IList <Guid>;
            string          taxonomyName;
            TaxonomyManager manager = TaxonomyManager.GetManager();

            if (fieldName == "Category")
            {
                taxonomyName = "Categories";
            }
            else if (fieldName == "Department")
            {
                taxonomyName = "Departments";
            }
            else
            {
                taxonomyName = fieldName;
            }

            var taxonNames = manager.GetTaxa <HierarchicalTaxon>()
                             .Where(t => taxonIds.Contains(t.Id) && t.Taxonomy.Name == taxonomyName).ToList();

            this.cachedFieldValues[cahcedResultKey] = taxonNames;

            return(taxonNames);
        }
Exemple #7
0
        public void DynamicWidgetsDesignerContent_VerifyDynamicItemsByTagFunctionality()
        {
            try
            {
                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var             taxonId         = this.CreatePressArticleAndReturnTagId(this.tagTitles);

                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType  = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName;

                for (int i = 0; i < taxonId.Length; i++)
                {
                    var tag = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Id == taxonId[i]).FirstOrDefault();

                    var modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: tag, page: 1);
                    var dynamicItems = modelItems.Items.ToList();
                    int itemsCount   = dynamicItems.Count;

                    Assert.AreEqual(1, itemsCount, "The count of the dynamic item is not as expected");

                    string title = dynamicItems[0].Fields.Title;
                    Assert.IsTrue(title.Equals(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitles);
            }
        }
Exemple #8
0
        public ActionResult Update()
        {
            var master = nm.GetNewsItems().FirstOrDefault(n => n.Title.Equals("News Item 1") && n.Status == ContentLifecycleStatus.Master);

            var temp = nm.Lifecycle.CheckOut(master) as NewsItem;

            temp.Content = "<div> Hello </div>";
            if (temp.DoesFieldExist("Region"))
            {
                temp.SetValue("Region", "Europe");
            }

            TaxonomyManager tm = TaxonomyManager.GetManager();

            var category = tm.GetTaxa <HierarchicalTaxon>()
                           .FirstOrDefault(t => t.Name == "Press");

            if (category != null)
            {
                var list = temp.GetValue <TrackedList <Guid> >("Category");
                list.Add(category.Id);

                temp.SetValue("Category", list);
            }

            var tag = tm.GetTaxa <FlatTaxon>()
                      .FirstOrDefault(t => t.Name == "news");

            if (tag != null)
            {
                var list = temp.GetValue <TrackedList <Guid> >("Tags");
                list.Add(tag.Id);
                temp.SetValue("Tags", list);
            }


            master = nm.Lifecycle.CheckIn(temp) as NewsItem;

            nm.SaveChanges();

            var bag = new Dictionary <string, string>();

            bag.Add("ContentType", typeof(NewsItem).FullName);
            WorkflowManager.MessageWorkflow(master.Id, typeof(NewsItem), null, "Publish", false, bag);

            return(View());
        }
Exemple #9
0
        public List <PopularToursItemModel> GetItemsBySelectedIds(string ids)
        {
            List <PopularToursItemModel> popularToursItemModel = new List <PopularToursItemModel>();

            if (!string.IsNullOrEmpty(ids))
            {
                var data = JsonConvert.DeserializeObject <List <Guid> >(ids);
                if (data.Any())
                {
                    var  manager = DynamicModuleManager.GetManager();
                    Type Tour    = TypeResolutionService.ResolveType(DynamicContentConstants.DynamicContent.Types.Tour);

                    TaxonomyManager taxaManager      = TaxonomyManager.GetManager();
                    var             adventuresTaxa   = taxaManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == DynamicContentConstants.DynamicContent.Tours.Adventures).ToList();
                    var             difficultiesTaxa = taxaManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == DynamicContentConstants.DynamicContent.Tours.Difficulties).ToList();
                    //get the selected items
                    var items = manager.GetDataItems(Tour).Where(item => item.Status == ContentLifecycleStatus.Live && item.Visible).Where(item => data.Contains(item.Id)).ToList();

                    //order items as selected
                    var orderedItems = items.OrderBy(item => data.IndexOf(item.Id)).ToList();

                    foreach (var item in orderedItems)
                    {
                        var image = item.GetRelatedItems(DynamicContentConstants.DynamicContent.Tours.ThumbnailImage).FirstOrDefault() as Image;
                        var adventureTaxaTitles      = item.GetAssociatedTagNamesForContentItem(DynamicContentConstants.DynamicContent.Tours.Adventures, adventuresTaxa);
                        var difficultyTaxaTitles     = item.GetAssociatedTagNamesForContentItem(DynamicContentConstants.DynamicContent.Tours.Difficulties, difficultiesTaxa);
                        var accomodationChoiceFields = item.GetValue <IEnumerable <ChoiceOption> >(DynamicContentConstants.DynamicContent.Tours.Accomodation).ToList();
                        var model = new PopularToursItemModel
                        {
                            Title          = item.GetString(DynamicContentConstants.DynamicContent.Tours.Title),
                            Description    = item.GetString(DynamicContentConstants.DynamicContent.Tours.Description),
                            NoOfDays       = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.NoOfDays)),
                            SizeOfTour     = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.SizeOfTour)),
                            NoOfTourGuides = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.NoOfTourGuides)),
                            Price          = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.Price)),
                            AdventureTags  = adventureTaxaTitles.Any() ? string.Join(",", adventureTaxaTitles) : string.Empty,
                            DifficultyTags = difficultyTaxaTitles.Any() ? string.Join(",", difficultyTaxaTitles) : string.Empty,
                            Accomodation   = accomodationChoiceFields.Any() ? string.Join(",", accomodationChoiceFields):string.Empty,
                            ImageUrl       = image != null ?image.MediaUrl:string.Empty
                        };
                        popularToursItemModel.Add(model);
                    }
                }
            }
            return(popularToursItemModel);
        }
Exemple #10
0
        private void CreateNews(string[] values)
        {
            NewsManager man = NewsManager.GetManager();

            man.Provider.SuppressSecurityChecks = true;
            TaxonomyManager tMan = TaxonomyManager.GetManager();

            tMan.Provider.SuppressSecurityChecks = true;
            string title   = values[0],
                   tags    = values[1],
                   content = values[2];
            var newsItem   = man.GetNewsItems().FirstOrDefault(i => i.Title == title);

            if (newsItem != null)
            {
                return;
            }
            newsItem = man.CreateNewsItem();
            var newsId = newsItem.Id;

            newsItem.Title   = title;
            newsItem.Content = content;
            var tag  = tMan.GetTaxa <FlatTaxon>().FirstOrDefault(i => i.Title == tags);
            var taxa = tMan.GetTaxonomy <FlatTaxonomy>(TaxonomyManager.TagsTaxonomyId);

            if (tag == null)
            {
                tag             = tMan.CreateTaxon <FlatTaxon>(Guid.NewGuid());
                tag.Title       = tags;
                tag.Name        = tags;
                tag.Description = "This tag categorizes the Breakfast";
                tag.UrlName     = new Lstring(Regex.Replace(tags, @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-").ToLower());
                taxa.Taxa.Add(tag);
                tMan.SaveChanges();
            }

            newsItem.Organizer.AddTaxa("Tags", tag.Id);

            newsItem.DateCreated     = DateTime.UtcNow;
            newsItem.PublicationDate = DateTime.UtcNow;
            newsItem.LastModified    = DateTime.UtcNow;
            newsItem.UrlName         = Regex.Replace(title.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");

            //Recompiles and validates the url of the news item.
            man.RecompileAndValidateUrls(newsItem);

            //Save the changes.
            man.SaveChanges();

            //Publish the news item. The published version acquires new ID.
            var bag = new Dictionary <string, string>();

            bag.Add("ContentType", typeof(NewsItem).FullName);
            WorkflowManager.MessageWorkflow(newsId, typeof(NewsItem), null, "Publish", false, bag);
            man.Lifecycle.Publish(newsItem);
            man.SaveChanges();
        }
 private void GetAllTaxonNamesForDataItem(List<string> taxonNames)
 {
     //get all tags for a data item
     var taxaIds = base.DataItem.GetValue<TrackedList<Guid>>("permissions");
     TaxonomyManager taxaManager = new TaxonomyManager();
     foreach (var taxaId in taxaIds)
     {
         var taxa = taxaManager.GetTaxa<Taxon>().Where(t => t.Id == taxaId).Single();
         taxonNames.Add(taxa.Name.ToLower());
     }
 }
Exemple #12
0
        private void GetAllTaxonNamesForDataItem(List <string> taxonNames)
        {
            //get all tags for a data item
            var             taxaIds     = base.DataItem.GetValue <TrackedList <Guid> >("permissions");
            TaxonomyManager taxaManager = new TaxonomyManager();

            foreach (var taxaId in taxaIds)
            {
                var taxa = taxaManager.GetTaxa <Taxon>().Where(t => t.Id == taxaId).Single();
                taxonNames.Add(taxa.Name.ToLower());
            }
        }
        private static void AddTaxaToProduct(ProductItem productItem, TaxonomyManager taxManager, string taxaName, string taxonName)
        {
            var taxon = taxManager.GetTaxa<FlatTaxon>().SingleOrDefault(t => t.Name == taxonName);

            // Check if a tag with the same name is already added
            var tagExists = productItem.Organizer.TaxonExists(taxaName, taxon.Id);

            if (!tagExists)
            {
                // Add the tag and save the changes
                productItem.Organizer.AddTaxa(taxaName, taxon.Id);
            }
        }
        private static void AddTaxaToProduct(ProductItem productItem, TaxonomyManager taxManager, string taxaName, string taxonName)
        {
            var taxon = taxManager.GetTaxa <FlatTaxon>().SingleOrDefault(t => t.Name == taxonName);

            // Check if a tag with the same name is already added
            var tagExists = productItem.Organizer.TaxonExists(taxaName, taxon.Id);

            if (!tagExists)
            {
                // Add the tag and save the changes
                productItem.Organizer.AddTaxa(taxaName, taxon.Id);
            }
        }
Exemple #15
0
        public ActionResult Index()
        {
            List <PopularToursItemModel> popularToursItemModel = new List <PopularToursItemModel>();
            var  manager = DynamicModuleManager.GetManager();
            Type Tour    = TypeResolutionService.ResolveType(DynamicContentConstants.DynamicContent.Types.Tour);

            TaxonomyManager taxaManager      = TaxonomyManager.GetManager();
            var             adventuresTaxa   = taxaManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == DynamicContentConstants.DynamicContent.Tours.Adventures).ToList();
            var             difficultiesTaxa = taxaManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == DynamicContentConstants.DynamicContent.Tours.Difficulties).ToList();
            //get the selected items
            var items = manager.GetDataItems(Tour).Where(item => item.Status == ContentLifecycleStatus.Live && item.Visible).ToList();



            foreach (var item in items)
            {
                var image = item.GetRelatedItems(DynamicContentConstants.DynamicContent.Tours.ThumbnailImage).FirstOrDefault() as Image;
                var adventureTaxaTitles      = item.GetAssociatedTagNamesForContentItem(DynamicContentConstants.DynamicContent.Tours.Adventures, adventuresTaxa);
                var difficultyTaxaTitles     = item.GetAssociatedTagNamesForContentItem(DynamicContentConstants.DynamicContent.Tours.Difficulties, difficultiesTaxa);
                var accomodationChoiceFields = item.GetValue <IEnumerable <ChoiceOption> >(DynamicContentConstants.DynamicContent.Tours.Accomodation).ToList();
                var model = new PopularToursItemModel
                {
                    Title          = item.GetString(DynamicContentConstants.DynamicContent.Tours.Title),
                    Description    = item.GetString(DynamicContentConstants.DynamicContent.Tours.Description),
                    NoOfDays       = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.NoOfDays)),
                    SizeOfTour     = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.SizeOfTour)),
                    NoOfTourGuides = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.NoOfTourGuides)),
                    Price          = Convert.ToString(item.GetValue(DynamicContentConstants.DynamicContent.Tours.Price)),
                    AdventureTags  = adventureTaxaTitles.Any() ? string.Join(",", adventureTaxaTitles) : string.Empty,
                    DifficultyTags = difficultyTaxaTitles.Any() ? string.Join(",", difficultyTaxaTitles) : string.Empty,
                    Accomodation   = accomodationChoiceFields.Any() ? string.Join(",", accomodationChoiceFields) : string.Empty,
                    ImageUrl       = image != null ? image.MediaUrl : string.Empty
                };
                popularToursItemModel.Add(model);
            }
            model.toursItemModel = popularToursItemModel;
            return(View("Tours" + this._template, model));
        }
Exemple #16
0
 private void CachePermissionsTaxa()
 {
     if (permissionsTaxa.Count == 0)
     {
         TaxonomyManager taxaManager = TaxonomyManager.GetManager();
         var             permissions = taxaManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == "permissions");
         foreach (var permission in permissions)
         {
             if (!permissionsTaxa.Contains(new KeyValuePair <Guid, string>(permission.Id, permission.Name)))
             {
                 permissionsTaxa.Add(permission.Id, permission.Name);
             }
         }
     }
 }
Exemple #17
0
        public virtual IList<HierarchicalTaxon> GetHierarchicalTaxons(string fieldName)
        {
            var cahcedResultKey = this.FieldCacheKey("GetHierarchicalTaxonNames", fieldName);
            object cachedResult;
            if (this.cachedFieldValues.TryGetValue(cahcedResultKey, out cachedResult))
                return cachedResult as IList<HierarchicalTaxon>;

            var taxonIds = this.Fields.GetMemberValue(fieldName) as IList<Guid>;
            TaxonomyManager manager = TaxonomyManager.GetManager();
           
            var taxonNames = manager.GetTaxa<HierarchicalTaxon>()
                   .Where(t => taxonIds.Contains(t.Id)).ToList();
            this.cachedFieldValues[cahcedResultKey] = taxonNames;

            return taxonNames;
        }
        public void NewsWidget_SelectByCategoryNewsFunctionality()
        {
            int    newsCount      = 4;
            string newsTitle      = "Title";
            string categoryTitle  = "Category ";
            var    newsController = new NewsController();

            string[] categoryTitles = new string[newsCount + 1];

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");

                for (int i = 0; i <= newsCount; i++)
                {
                    categoryTitles[i] = categoryTitle + i;
                    this.serverOperationsTaxonomies.CreateCategory(categoryTitle + (i + 1), categoryTitle + i);
                    ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + i, "Content", "AuthorName", "SourceName", new List <string> {
                        categoryTitle + i
                    }, null, null);
                }

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

                for (int i = 0; i < newsCount; i++)
                {
                    var    category = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + i);
                    ITaxon taxonomy = taxonomyManager.GetTaxon(category.Id);
                    var    items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                    for (int j = 0; j < items.Length; j++)
                    {
                        Assert.IsTrue(items[j].Fields.Title.Equals(newsTitle + i, StringComparison.CurrentCulture), "The news with this title was not found!");
                    }
                }
            }
            finally
            {
                this.serverOperationsTaxonomies.DeleteCategories(categoryTitles);
            }
        }
Exemple #19
0
        public DynamicContent CreatePressArticleItem(string title, string url)
        {
            var providerName = string.Empty;

            if (ServerOperations.MultiSite().CheckIsMultisiteMode())
            {
                providerName = "dynamicContentProvider";
            }

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
            Type pressArticleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle");

            Telerik.Sitefinity.DynamicModules.Model.DynamicContent pressArticleItem = dynamicModuleManager.CreateDataItem(pressArticleType);

            // This is how values for the properties are set
            pressArticleItem.SetValue("Title", title);
            pressArticleItem.SetValue("PublishedBy", "Some PublishedBy");
            pressArticleItem.SetValue("Guid", Guid.NewGuid());

            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
            var             tag             = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == "Tags").FirstOrDefault();

            if (tag != null)
            {
                pressArticleItem.Organizer.AddTaxa("Tags", tag.Id);
            }

            pressArticleItem.SetString("UrlName", url);
            pressArticleItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
            pressArticleItem.SetValue("PublicationDate", DateTime.Now);
            pressArticleItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published");
            dynamicModuleManager.Lifecycle.Publish(pressArticleItem);

            dynamicModuleManager.RecompileDataItemsUrls(pressArticleType);

            // You need to call SaveChanges() in order for the items to be actually persisted to data store
            dynamicModuleManager.SaveChanges();

            return(pressArticleItem);
        }
        private void migrateTags(Entry post, BlogPost blogPost, BlogsManager blogsManager)
        {
            TaxonomyManager taxonomyManager = new TaxonomyManager();
            var tax = taxonomyManager.GetTaxonomies<FlatTaxonomy>().Where(t => t.Name == "Tags").SingleOrDefault();

            foreach (Category tag in post.Categories.Where(c => c.CategoryType == CategoryType.Unknown))
            {
                var taxon = taxonomyManager.GetTaxa<FlatTaxon>().Where(t => t.Title == tag.Term).FirstOrDefault();
                if (taxon == null)
                {
                    taxon = taxonomyManager.CreateTaxon<FlatTaxon>();
                    taxon.Name = tag.Term;
                    taxon.Title = tag.Term;

                    tax.Taxa.Add(taxon);
                    taxonomyManager.SaveChanges();
                }

                blogPost.Organizer.AddTaxa("Tags", taxon.Id);
                blogsManager.SaveChanges();
            }
        }
Exemple #21
0
        private void migrateTags(Entry post, BlogPost blogPost, BlogsManager blogsManager)
        {
            TaxonomyManager taxonomyManager = new TaxonomyManager();
            var             tax             = taxonomyManager.GetTaxonomies <FlatTaxonomy>().Where(t => t.Name == "Tags").SingleOrDefault();

            foreach (Category tag in post.Categories.Where(c => c.CategoryType == CategoryType.Unknown))
            {
                var taxon = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Title == tag.Term).FirstOrDefault();
                if (taxon == null)
                {
                    taxon       = taxonomyManager.CreateTaxon <FlatTaxon>();
                    taxon.Name  = tag.Term;
                    taxon.Title = tag.Term;

                    tax.Taxa.Add(taxon);
                    taxonomyManager.SaveChanges();
                }

                blogPost.Organizer.AddTaxa("Tags", taxon.Id);
                blogsManager.SaveChanges();
            }
        }
Exemple #22
0
        /// <summary>
        /// Creates news item with tag.
        /// </summary>
        /// <param name="newsTitle">The news title.</param>
        public void AddCustomTaxonomyToNews(Guid newsItemId, string taxonomyName, IEnumerable <string> taxonNames)
        {
            var      newsManager = Telerik.Sitefinity.Modules.News.NewsManager.GetManager();
            NewsItem newsItem    = newsManager.GetNewsItem(newsItemId);

            if (newsItem == null)
            {
                throw new ItemNotFoundException(string.Format(CultureInfo.CurrentCulture, "News item with id {0} was not found.", newsItemId));
            }

            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

            foreach (var taxonName in taxonNames)
            {
                var taxon = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Title == taxonName).FirstOrDefault();
                if (taxon != null)
                {
                    newsItem.Organizer.AddTaxa(taxonomyName, taxon.Id);
                }
            }

            newsManager.SaveChanges();
        }
        private static TaxonViewModel BuildTaxaTreeBfs(
            Taxon taxon,
            Func<ITaxon, TaxonViewModel> viewModelBuilder,
            Func<IQueryable<Taxon>, IQueryable<Taxon>> sort,
            TaxonomyManager manager,
            int taxaCountLimit,
            ref int currentTaxaCount)
        {
            var queue = new Queue<TaxonData>();
            TaxonViewModel rootViewModel = null;

            queue.Enqueue(new TaxonData() { Taxon = taxon });

            while (queue.Count > 0)
            {
                var currentNode = queue.Dequeue();

                var currentViewModel = viewModelBuilder.Invoke(currentNode.Taxon);

                if (currentViewModel != null)
                {
                    // If this is the first created view model, set it to be the root one.
                    if (rootViewModel == null) rootViewModel = currentViewModel;

                    if (currentNode.LastKnownParent != null)
                    {
                        currentNode.LastKnownParent.SubTaxa.Add(currentViewModel);
                    }

                    currentTaxaCount++;
                    if (taxaCountLimit > 0 && currentTaxaCount == taxaCountLimit)
                    {
                        return rootViewModel;
                    }
                }

                // If the current taxon is included in the tree, it should be the parent of the inner taxa.
                var lastKnownParent = currentViewModel ?? currentNode.LastKnownParent;

                var subTaxa = manager.GetTaxa<Taxon>().Where(t => t.Parent.Id == currentNode.Taxon.Id);
                var sortedSubtaxa = sort.Invoke(subTaxa);

                foreach (var childTaxon in sortedSubtaxa)
                {
                    queue.Enqueue(new TaxonData()
                    {
                        LastKnownParent = lastKnownParent,
                        Taxon = childTaxon
                    });
                }
            }

            return rootViewModel;
        }
        public void CreateAlltypes()
        {
            // Set the provider name for the DynamicModuleManager here. All available providers are listed in
            // Administration -> Settings -> Advanced -> DynamicModules -> Providers
            var providerName = string.Empty;

            if (ServerOperations.MultiSite().CheckIsMultisiteMode())
            {
                providerName = "dynamicContentProvider";
            }

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
            Type           alltypesType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.AllTypesModule.Alltypes");
            DynamicContent alltypesItem = dynamicModuleManager.CreateDataItem(alltypesType);

            //// This is how values for the properties are set
            alltypesItem.SetValue("Title", "Some Title");
            alltypesItem.SetValue("LongText", "Some LongText");
            alltypesItem.SetValue("ShortText", "Some ShortText");
            //// Set the selected value
            alltypesItem.SetValue("Choices", new string[] { "1" });
            //// Set the selected value
            alltypesItem.SetValue("ChoicesRadioButtons", "2");
            //// Set the selected value
            alltypesItem.SetValue("ChoicesDropDown", "3");
            alltypesItem.SetValue("YesNo", true);
            alltypesItem.SetValue("DateTime", DateTime.Now);
            alltypesItem.SetValue("Number", 25);
            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
            var             category        = taxonomyManager.GetTaxa <HierarchicalTaxon>().Where(t => t.Taxonomy.Name == "Categories").FirstOrDefault();

            if (category != null)
            {
                alltypesItem.Organizer.AddTaxa("Category", category.Id);
            }

            var tag = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == "Tags").FirstOrDefault();

            if (tag != null)
            {
                alltypesItem.Organizer.AddTaxa("Tags", tag.Id);
            }

            Address        address        = new Address();
            CountryElement addressCountry = Config.Get <LocationsConfig>().Countries.Values.First(x => x.Name == "United States");

            address.CountryCode = addressCountry.IsoCode;
            address.StateCode   = addressCountry.StatesProvinces.Values.First().Abbreviation;
            address.City        = "Some City";
            address.Street      = "Some Street";
            address.Zip         = "12345";
            alltypesItem.SetValue("Address", address);

            alltypesItem.SetString("UrlName", "SomeUrlName");
            alltypesItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
            alltypesItem.SetValue("PublicationDate", DateTime.Now);
            alltypesItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published");
            dynamicModuleManager.Lifecycle.Publish(alltypesItem);

            // You need to call SaveChanges() in order for the items to be actually persisted to data store
            dynamicModuleManager.SaveChanges();
        }
Exemple #25
0
        public void DynamicWidgets_SelectByTagAndSortFunctionality()
        {
            int tagsCount = 3;

            Guid[] taxonId       = new Guid[tagsCount];
            string sortExpession = "Title ASC";

            string[] itemsTitles  = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls         = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };
            string[] sortedTitles = { "Angel", "Boat", "Cat" };

            var dynamicController = new DynamicContentController();

            dynamicController.Model.ContentType    = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.SortExpression = sortExpession;
            dynamicController.Model.ProviderName   = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName;

            try
            {
                for (int i = 0; i < tagsCount; i++)
                {
                    taxonId[i] = this.serverOperationsTaxonomies.CreateFlatTaxon(Telerik.Sitefinity.TestUtilities.CommonOperations.TaxonomiesConstants.TagsTaxonomyId, this.tagTitles[i]);
                }

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i <= 2)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], taxonId[0], Guid.Empty);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], taxonId[i - 2], Guid.Empty);
                    }
                }

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

                for (int i = 0; i < tagsCount; i++)
                {
                    var tag          = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Id == taxonId[i]).FirstOrDefault();
                    var modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: tag, page: 1);
                    var dynamicItems = modelItems.Items.ToList();
                    int itemsCount   = dynamicItems.Count;

                    if (i == 0)
                    {
                        for (int j = 0; j < itemsCount; j++)
                        {
                            Assert.IsTrue(dynamicItems[j].Fields.Title.Equals(sortedTitles[j], StringComparison.CurrentCulture), "The item with this title was not found!");
                        }
                    }
                    else
                    {
                        for (int j = 0; j < itemsCount; j++)
                        {
                            Assert.IsTrue(dynamicItems[j].Fields.Title.Equals(itemsTitles[i + 2], StringComparison.CurrentCulture), "The item with this title was not found!");
                        }
                    }
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteTags(this.tagTitles);
            }
        }
        public void NewsWidget_SelectByCategoryNewsFunctionalityAndLimits()
        {
            var newsController = new NewsController();

            newsController.Model.DisplayMode = ListDisplayMode.Limit;
            int itemsPerPage = 3;

            newsController.Model.ItemsPerPage = itemsPerPage;
            string categoryTitle = "Category";

            string[] newsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            Guid[]   newsId     = new Guid[newsTitles.Count()];

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var             category0       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var             category1       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < newsTitles.Count(); i++)
                {
                    if (i <= 3)
                    {
                        newsId[i] = this.serverOperationsNews.CreatePublishedNewsItem(newsTitles[i]);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category0.Id);
                    }
                    else
                    {
                        newsId[i] = this.serverOperationsNews.CreatePublishedNewsItem(newsTitles[i]);
                        this.serverOperationsNews.AssignTaxonToNewsItem(newsId[i], "Category", category1.Id);
                    }
                }

                ITaxon taxonomy = taxonomyManager.GetTaxon(category0.Id);
                var    items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                Assert.IsTrue(items.Length.Equals(3), "Number of news items is not correct");
                for (int i = 0; i <= 2; i++)
                {
                    Assert.IsTrue(items[i].Fields.Title.Equals(newsTitles[3 - i], StringComparison.CurrentCulture), "The news with this title was found!");
                }

                taxonomy = taxonomyManager.GetTaxon(category1.Id);
                items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                Assert.IsTrue(items.Length.Equals(1), "Number of news items is not correct");
                Assert.IsTrue(items[0].Fields.Title.Equals(newsTitles[4], StringComparison.CurrentCulture), "The news with this title was found!");

                newsController.Model.DisplayMode = ListDisplayMode.All;
                taxonomy = taxonomyManager.GetTaxon(category0.Id);
                items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                Assert.IsTrue(items.Length.Equals(4), "Number of news items is not correct");
                for (int i = 0; i <= 3; i++)
                {
                    Assert.IsTrue(items[i].Fields.Title.Equals(newsTitles[3 - i], StringComparison.CurrentCulture), "The news with this title was found!");
                }

                taxonomy = taxonomyManager.GetTaxon(category1.Id);
                items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                Assert.IsTrue(items.Length.Equals(1), "Number of news items is not correct");
                Assert.IsTrue(items[0].Fields.Title.Equals(newsTitles[4], StringComparison.CurrentCulture), "The news with this title was found!");
            }
            finally
            {
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
Exemple #27
0
        public void DynamicWidgets_SelectByCategoryFunctionalityAndLimits()
        {
            var dynamicController = new DynamicContentController();

            dynamicController.Model.ContentType  = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.DisplayMode  = ListDisplayMode.Limit;
            dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName;
            int limitCount = 3;

            dynamicController.Model.LimitCount = limitCount;
            string categoryTitle = "Category";

            string[] itemsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls        = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var             category0       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var             category1       = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i <= 3)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                }

                var modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount   = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(3), "Number of items is not correct");
                for (int i = 0; i <= 2; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[3 - i], StringComparison.CurrentCulture), "The items with this title was found!");
                }

                modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount   = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
                Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[4], StringComparison.CurrentCulture), "The items with this title was found!");

                dynamicController.Model.DisplayMode = ListDisplayMode.All;

                modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount   = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(4), "Number of items is not correct");
                for (int i = 0; i <= 3; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[3 - i], StringComparison.CurrentCulture), "The items with this title was found!");
                }

                modelItems   = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount   = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
                Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[4], StringComparison.CurrentCulture), "The items with this title was found!");
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
        public void CreateHotel()
        {
            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
            Type           hotelType = TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.HotelType);
            DynamicContent hotelItem = dynamicModuleManager.CreateDataItem(hotelType, HierarchicalDynamicContentTests.HotelId, dynamicModuleManager.Provider.ApplicationName);

            hotelItem.SetValue("Name", "Test Name");
            hotelItem.SetValue("Overview", "Test Overview");
            hotelItem.SetValue("Checkin", "Test Checkin");
            hotelItem.SetValue("Checkout", "Test Checkout");
            hotelItem.SetValue("FoodAndDrink", new string[] { "Option2" });
            hotelItem.SetValue("Activities", new string[] { "Option2" });
            hotelItem.SetValue("Rating", 25);

            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
            var             Tag             = taxonomyManager.GetTaxa <FlatTaxon>().Where(t => t.Taxonomy.Name == "Tags").FirstOrDefault();

            if (Tag != null)
            {
                hotelItem.Organizer.AddTaxa("Tags", Tag.Id);
            }

            Address        location        = new Address();
            CountryElement locationCountry = Config.Get <LocationsConfig>().Countries.Values.First(x => x.Name == "United States");

            location.CountryCode  = locationCountry.IsoCode;
            location.StateCode    = locationCountry.StatesProvinces.Values.First().Abbreviation;
            location.City         = "Test City";
            location.Street       = "Test Street";
            location.Zip          = "12345";
            location.Latitude     = 0.00;
            location.Longitude    = 0.00;
            location.MapZoomLevel = 8;
            hotelItem.SetValue("Location", location);

            LibrariesManager mainPictureManager = LibrariesManager.GetManager();
            var mainPictureItem = mainPictureManager.GetImages().FirstOrDefault(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master);

            if (mainPictureItem != null)
            {
                hotelItem.CreateRelation(mainPictureItem, "MainPicture");
            }

            hotelItem.SetString("UrlName", "TestUrlName");
            hotelItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
            hotelItem.SetValue("PublicationDate", DateTime.Now);

            hotelItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Draft");

            dynamicModuleManager.SaveChanges();

            var actualHotel = dynamicModuleManager.GetDataItem(hotelType, hotelItem.Id);

            Assert.IsNotNull(actualHotel);
            Assert.AreEqual(hotelItem.GetValue("Name").ToString(), actualHotel.GetValue("Name").ToString());
            Assert.AreEqual(hotelItem.GetValue("Overview").ToString(), actualHotel.GetValue("Overview").ToString());
            Assert.AreEqual(hotelItem.GetValue("Checkin").ToString(), actualHotel.GetValue("Checkin").ToString());
            Assert.AreEqual(hotelItem.GetValue("Checkout").ToString(), actualHotel.GetValue("Checkout").ToString());
            Assert.AreEqual(hotelItem.GetValue("FoodAndDrink").ToString(), actualHotel.GetValue("FoodAndDrink").ToString());
            Assert.AreEqual(hotelItem.GetValue("Activities").ToString(), actualHotel.GetValue("Activities").ToString());
            Assert.AreEqual(hotelItem.GetValue("Rating"), actualHotel.GetValue("Rating"));
            Assert.AreEqual(hotelItem.GetValue("MainPicture"), actualHotel.GetValue("MainPicture"));
            Assert.AreEqual(hotelItem.GetValue("Location"), actualHotel.GetValue("Location"));
            Assert.AreEqual(hotelItem.GetValue("UrlName").ToString(), actualHotel.GetValue("UrlName").ToString());
            Assert.AreEqual(hotelItem.GetValue("Owner"), actualHotel.GetValue("Owner"));
            Assert.AreEqual(hotelItem.GetValue("PublicationDate"), actualHotel.GetValue("PublicationDate"));
        }