private ListInfo FillListInfo(IDataReader dr, bool CheckForOpenDataReader)
 {
     ListInfo objListInfo = null;
     bool canContinue = true;
     if (CheckForOpenDataReader)
     {
         canContinue = false;
         if (dr.Read())
         {
             canContinue = true;
         }
     }
     if (canContinue)
     {
         objListInfo = new ListInfo(Convert.ToString(dr["ListName"]));
         {
             objListInfo.Level = Convert.ToInt32(dr["Level"]);
             objListInfo.PortalID = Convert.ToInt32(dr["PortalID"]);
             objListInfo.DefinitionID = Convert.ToInt32(dr["DefinitionID"]);
             objListInfo.EntryCount = Convert.ToInt32(dr["EntryCount"]);
             objListInfo.ParentID = Convert.ToInt32(dr["ParentID"]);
             objListInfo.ParentKey = Convert.ToString(dr["ParentKey"]);
             objListInfo.Parent = Convert.ToString(dr["Parent"]);
             objListInfo.ParentList = Convert.ToString(dr["ParentList"]);
             objListInfo.EnableSortOrder = (Convert.ToInt32(dr["MaxSortOrder"]) > 0);
             objListInfo.SystemList = Convert.ToInt32(dr["SystemList"]) > 0;
         }
     }
     return objListInfo;
 }
        public void DeleteList(ListInfo list, bool includeChildren)
        {
            SortedList <string, ListInfo> lists = new SortedList <string, ListInfo>();

            lists.Add(list.Key, list);
            if (includeChildren)
            {
                foreach (KeyValuePair <string, ListInfo> listPair in GetListInfoDictionary(list.PortalID))
                {
                    if ((listPair.Value.ParentList.StartsWith(list.Key)))
                    {
                        lists.Add(listPair.Value.Key.Replace(":", "."), listPair.Value);
                    }
                }
            }
            for (int i = lists.Count - 1; i >= 0; i += -1)
            {
                DeleteList(lists.Values[i].Name, lists.Values[i].ParentKey);
            }
        }
 public void DeleteList(ListInfo list, bool includeChildren)
 {
     SortedList<string, ListInfo> lists = new SortedList<string, ListInfo>();
     lists.Add(list.Key, list);
     if (includeChildren)
     {
         foreach (KeyValuePair<string, ListInfo> listPair in GetListInfoDictionary(list.PortalID))
         {
             if ((listPair.Value.ParentList.StartsWith(list.Key)))
             {
                 lists.Add(listPair.Value.Key.Replace(":", "."), listPair.Value);
             }
         }
     }
     for (int i = lists.Count - 1; i >= 0; i += -1)
     {
         DeleteList(lists.Values[i].Name, lists.Values[i].ParentKey);
     }
 }