示例#1
0
 /// <summary>
 /// Returns all Access Groups or only Public Access Groups
 /// </summary>
 /// <returns></returns>
 public Groups GetGroups(bool PublicOnly)
 {
     Groups GS = null;
     string sSQL = "";
     if(PublicOnly == true)
         sSQL = "SELECT * FROM tblGroup WHERE IsPublicAccess = 1";
     else
         sSQL = "SELECT * FROM tblGroup";
     DataTable DT = GetDataTable(sSQL);
     GS = new Groups();
     foreach(DataRow R in DT.Rows)
     {
         int GroupId = Convert.ToInt32(R[0]);
         Group G = GetGroup(GroupId);
         GS.Add(G);
     }
     DT.Dispose();
     return GS;
 }
示例#2
0
        /// <summary>
        /// Returns all the Groups a User is in
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        /// 
        public Groups GetGroups(int UserID)
        {
            try
            {

                string sSQL = "Select GroupId FROM tblGroupUserRel WHERE UserId = " + UserID;
                DataTable DT = GetDataTable(sSQL);

                Groups X = new Groups();
                foreach(DataRow r in DT.Rows)
                {
                    int GroupID = Convert.ToInt32(r[0]);
                    Group NG = GetGroup(GroupID);
                    X.Add(NG);
                }

                sSQL = "Select Id FROM tblGroup WHERE IsPublicAccess = 1";
                DT = GetDataTable(sSQL);
                foreach(DataRow r in DT.Rows)
                {
                    int GroupID = Convert.ToInt32(r[0]);
                    Group NG = GetGroup(GroupID);
                    X.Add(NG);
                }

                DT.Dispose();
                return X;
            }
            catch(Exception Err)
            {
                throw new ApplicationException(Err.Message);
            }
        }