示例#1
0
        private void BuildSpeciatyList_inter(SpecialtyListNode parent, List <SpecialtyListNode> list)
        {
            List <Speciaty_Info> childs = GetChildsspecialty(parent.Specialty_Id);

            foreach (Speciaty_Info m in childs)
            {
                SpecialtyListNode mn = new SpecialtyListNode();
                mn.Specialty_Id   = m.Specialty_Id;
                mn.Specialty_Name = m.Specialty_Name;

                mn.Parent_id = parent.Specialty_Id;
                mn.level     = parent.level + 1;
                parent.Childs.Add(mn.Specialty_Id);
                list.Add(mn);
                BuildSpeciatyList_inter(mn, list);
                mn.Childs.ForEach(i => parent.Childs.Add(i));
            }
        }
示例#2
0
        public List <SpecialtyListNode> BuildSpeciatyList()
        {
            Speciaty_Info     root = GetRootItem();
            SpecialtyListNode rmn  = new SpecialtyListNode();

            rmn.Specialty_Id   = root.Specialty_Id;
            rmn.Specialty_Name = root.Specialty_Name;

            rmn.level = -1;

            List <SpecialtyListNode> list = new List <SpecialtyListNode>();

            BuildSpeciatyList_inter(rmn, list);
            foreach (SpecialtyListNode mn in list)
            {
                if (mn.Parent_id == root.Specialty_Id)
                {
                    mn.Parent_id = 0;
                }
            }
            return(list);
        }