Example #1
0
        public static List<Item> GetListByText(string ListText)
        {
            List<Item> list = new List<Item>();

            string[] _Items = ListText.Split(',');
            for (int i = 0; i < _Items.Length; i++)
            {
                if (_Items[i].IndexOf('|') == -1)
                    list.Add(new Item(_Items[i], _Items[i]));
                else
                {
                    string _Name = _Items[i].Split('|')[0];
                    string _Value = _Items[i].Split('|')[1];

                    list.Add(new Item(_Name, _Value));
                }
            }

            return list;
        }
Example #2
0
        public static List<Item> GetListForEdit(List<Item> list, int parent_id)
        {
            List<Item> _list = new List<Item>();

            bool _found = false;
            int level = 0;
            for (int i = 0; i < list.Count; i++)
            {
                if (_found && level < GetLevel(list[i].Name))
                    continue;

                if (!_found && list[i].Value == parent_id.ToString())
                {
                    _found = true;
                    level = GetLevel(list[i].Name);

                    continue;
                }

                _list.Add(list[i]);
            }

            return _list;
        }