Esempio n. 1
0
    public object GetSelectedItemBelow(string nodeName, string treeViewType, string treeViewName)
    {
        List <KeyValuePair <string, string> > listItems = new List <KeyValuePair <string, string> >();

        switch (treeViewType)
        {
        case "Category":

            switch (treeViewName)
            {
            case "Doco":
                BusiBlocks.DocoBlock.Category cat = DocoManager.GetCategoryByName(nodeName, true);
                listItems.Add(new KeyValuePair <string, string>(cat.Id, cat.DisplayName));
                IList <BusiBlocks.DocoBlock.Category> docoCategories = DocoManager.GetAllCategoriesBelow(cat.Id);

                foreach (BusiBlocks.DocoBlock.Category item in docoCategories)
                {
                    listItems.Add(new KeyValuePair <string, string>(item.Id, item.DisplayName));
                }
                break;

            case "News":
                BusiBlocks.CommsBlock.News.Category         selectedNews = NewsManager.GetCategoryByName(nodeName, true);
                IList <BusiBlocks.CommsBlock.News.Category> news         = NewsManager.GetCategories(selectedNews.Id, true);

                foreach (BusiBlocks.CommsBlock.News.Category newsItem in news)
                {
                    listItems.Add(new KeyValuePair <string, string>(newsItem.Id, newsItem.Name));
                }
                break;

            default: break;
            }
            break;

        case "Region":
            BusiBlocks.SiteLayer.Region selectedRegion = SiteManager.GetRegionByName(nodeName);
            if (selectedRegion != null)
            {
                listItems.Add(new KeyValuePair <string, string>(selectedRegion.Id, selectedRegion.Name));
                IList <Region> regions = SiteManager.GetAllRegionsBelow(selectedRegion);
                foreach (Region region in regions)
                {
                    listItems.Add(new KeyValuePair <string, string>(region.Id, region.Name));
                }
            }
            break;

        default:
            break;
        }
        return(listItems);
    }
Esempio n. 2
0
    protected void AddArticleToList(IList <Article> articles, string name)
    {
        if (!string.IsNullOrEmpty(name))
        {
            BusiBlocks.DocoBlock.Category category = DocoManager.GetCategoryByName(name, true);

            if (category != null)
            {
                AddArticles(category, articles);
            }
            else// wild card scenario.
            {
                IList <BusiBlocks.DocoBlock.Category> categories = DocoManager.GetCategoryByLikeName(name, true);

                foreach (BusiBlocks.DocoBlock.Category item in categories)
                {
                    AddArticles(item, articles);
                }
            }
        }
    }
Esempio n. 3
0
    public void MoveCategory(string source, string destination, string treeViewName)
    {
        switch (treeViewName)
        {
        case "News":
            BusiBlocks.CommsBlock.News.Category destNewsCategory   = NewsManager.GetCategoryByName(destination, true);
            BusiBlocks.CommsBlock.News.Category sourceNewsCategory = NewsManager.GetCategoryByName(source, true);
            sourceNewsCategory.ParentCategory = destNewsCategory;
            NewsManager.UpdateCategory(sourceNewsCategory);
            break;

        case "Doco":
            BusiBlocks.DocoBlock.Category destDocoCategory   = DocoManager.GetCategoryByName(destination, true);
            BusiBlocks.DocoBlock.Category sourceDocoCategory = DocoManager.GetCategoryByName(source, true);
            sourceDocoCategory.ParentCategory = destDocoCategory;
            DocoManager.UpdateCategory(sourceDocoCategory);
            break;

        default:
            break;
        }
    }