Exemple #1
0
        /// <summary>
        /// 根据用户,获取树形结构的分组列表
        /// </summary>
        public List <ContactGroupNodeInfo> GetTree(string creator)
        {
            string condition = !string.IsNullOrEmpty(creator) ? string.Format("AND Creator='{0}'", creator) : "";
            List <ContactGroupNodeInfo> nodeList = new List <ContactGroupNodeInfo>();
            string sql = string.Format("Select * From {0} Where 1=1 {1} Order By PID, HandNo ", tableName, condition);

            DataTable dt = base.SqlTable(sql);

            DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}' ", -1));
            for (int i = 0; i < dataRows.Length; i++)
            {
                string id = dataRows[i]["ID"].ToString();
                ContactGroupNodeInfo nodeInfo = GetNode(id, dt);
                nodeList.Add(nodeInfo);
            }

            return(nodeList);
        }