コード例 #1
0
        private static void BuildIntStringDictionary(
            string csv, umbraco.uQuery.UmbracoObjectType umbracoObjectType, ref Dictionary <int, string> collection)
        {
            //for each id, get content item, and add id and name to dictionary
            if (!string.IsNullOrEmpty(csv))
            {
                switch (umbracoObjectType)
                {
                case umbraco.uQuery.UmbracoObjectType.Document:
                    foreach (var node in umbraco.uQuery.GetNodesByCsv(csv))
                    {
                        collection.Add(node.Id, node.Name);
                    }

                    break;

                case umbraco.uQuery.UmbracoObjectType.Media:
                    foreach (Media media in umbraco.uQuery.GetMediaByCsv(csv))
                    {
                        collection.Add(media.Id, media.Text);
                    }

                    break;

                case umbraco.uQuery.UmbracoObjectType.Member:
                    foreach (Member member in umbraco.uQuery.GetMembersByCsv(csv))
                    {
                        collection.Add(member.Id, member.Text);
                    }

                    break;
                }
            }
        }
コード例 #2
0
        private static Dictionary <int, string> BuildIntStringDictionary(
            string csv, umbraco.uQuery.UmbracoObjectType umbracoObjectType)
        {
            Dictionary <int, string> dictionary = new Dictionary <int, string>();

            BuildIntStringDictionary(csv, umbracoObjectType, ref dictionary);

            return(dictionary);
        }