示例#1
0
        //convert UserTypes to categories.
        public List <pb_Category> GetCategories()
        {
            var result = new List <pb_Category>();

            if (UserTypes == null)
            {
                return(result);
            }

            List <string> tagList = new List <string>();
            string        tag, text, str;
            int           index;

            var temp = UserTypes.Split(new[] { ',' }).ToList();

            foreach (var item in temp)
            {
                str   = item.Trim();
                index = str.IndexOf(' ');
                tag   = str.Substring(0, index);

                text = str.Substring(index, str.Length - index);
                text = text.Replace("(", "");
                text = text.Replace(")", "");

                result.Add(new pb_Category
                {
                    TagName  = tag,
                    TextName = text
                });
            }

            return(result);
        }