Пример #1
0
        private void DeQuy(ref ArrayList arr, int ParentId,string strAdd)
        {
            Services ctl = new Services(myConn);
            DataTable root = ctl.GetByParent(ParentId);
            foreach (DataRow r in root.Rows)
            {

                BusinessLogic.ServicesInfo obj = new BusinessLogic.ServicesInfo();
                obj.ID = int.Parse(r["ID"].ToString());
                obj.ParentId = int.Parse(r["ParentId"].ToString());
                obj.Name = strAdd + r["Name"].ToString();
                obj.Image = r["Image"].ToString();
                obj.ParentName = r["ParentName"].ToString();
                obj.CONTENT = r["CONTENT"].ToString();
                arr.Add(obj);
                DeQuy(ref arr, obj.ID, strAdd + "+-");
            }
        }
Пример #2
0
 /// <summary>
 /// Load danh sách dịch vụ cha
 /// </summary>
 private void BindParentServices()
 {
     Services ctl = new Services(myConn);
     ArrayList arr = new ArrayList();
     DataTable root = ctl.GetByParent(0);
     foreach (DataRow r in root.Rows)
     {
         BusinessLogic.ServicesInfo obj = new BusinessLogic.ServicesInfo();
         obj.ID = int.Parse(r["ID"].ToString());
         obj.ParentId = int.Parse(r["ParentId"].ToString());
         obj.Name = r["Name"].ToString();
         obj.Image = r["Image"].ToString();
         obj.ParentName = r["ParentName"].ToString();
         obj.CONTENT = r["CONTENT"].ToString();
         arr.Add(obj);
         DeQuy(ref arr, obj.ID,"+-");
     }
     ddlServiceParent.DataSource = arr;
     ddlServiceParent.DataBind();
     ddlServiceParent.Items.Insert(0, new ListItem("-----", "0"));
 }