/// <summary> /// Returns all Users currently in the System /// </summary> /// <returns></returns> public Users ALLUsers() { try { Users X = new Users(); string sSQL = "Select * FROM tblUser WHERE Name != 'System Administrator' AND " + " Name != 'Nobody'" + " ORDER BY Name"; DataTable DT = GetDataTable(sSQL); foreach(DataRow R in DT.Rows) { User U = null; FillUser(ref U,R); X.Add(U); } DT.Dispose(); return X; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
internal Users ReturnUsersInHierarchy(int SectionID,Users gUsers) { string sSQL = "Select UserId FROM tblUserSectionRel WHERE SectionId = " + SectionID; DataTable DT = GetDataTable(sSQL); Users US = new Users(); int[] UO = GetUnassignedObjects(); foreach(DataRow R in DT.Rows) { int UserId = Convert.ToInt32(R[0]); User NewUser = GetUser(UserId); US.Add(NewUser); Sections NSections = GetUsersOwnedSections(NewUser.ID,SectionID); if(NSections != null) { foreach(Section S in NSections) { Users NUsers = ReturnUsersInHierarchy(S.mvarID,gUsers); foreach(User CheckMe in NUsers) { foreach(User AgainstMe in gUsers) { if(CheckMe.mvarID == AgainstMe.mvarID) { goto SkipMe; } } if(UO[0] != CheckMe.ID) gUsers.Add(CheckMe); SkipMe:{} } } } } if(US.Count > 0) { foreach(User CheckMe in US) { foreach(User AgainstMe in gUsers) { if(CheckMe.mvarID == AgainstMe.mvarID) { goto SkipMeToo; } } gUsers.Add(CheckMe); SkipMeToo:{} } } DT.Dispose(); return gUsers; }
/// <summary> /// Searches this sections Hierarchy for all Users /// </summary> /// <param name="SectionID"></param> /// <returns> /// Returns a collection of unique Users found /// </returns> internal Users ReturnUsersInHierarchy(int SectionID) { Users gUsers = new Users(); gUsers = ReturnUsersInHierarchy(SectionID,gUsers); return gUsers; }
/// <summary> /// Returns all the Users in a particular Users Hierarchy /// </summary> /// <param name="UserId"></param> /// <param name="ALLUsers"></param> /// <param name="ALLSections"></param> /// <returns></returns> internal Users ReturnAllHierarchyMembers(int UserId) { Users ALLMYUSERS = new Users(); Sections PrimarySections = GetUsersOwnedSections(UserId); int[] UO = GetUnassignedObjects(); foreach(Section S in PrimarySections) { Users NUsers = ReturnUsersInHierarchy(S.mvarID,ALLMYUSERS); foreach(User CheckMe in NUsers) { foreach(User AgainstMe in ALLMYUSERS) { if(CheckMe.mvarID == AgainstMe.mvarID) { goto SkipMe; } } if(UO[0] != CheckMe.ID) // Make certain Nobody never ever shows up. { ALLMYUSERS.Add(CheckMe); } //ALLMYUSERS.Add(CheckMe); SkipMe:{} } } //ALLMYUSERS.Sort(); return ALLMYUSERS; }
/// <summary> /// Returns all Users currently in the Group /// </summary> /// <param name="GroupId"></param> /// <returns></returns> internal Users All_Users(int GroupId) { try { Users X = new Users(); string sSQL = "SELECT tblGroupUserRel.UserId,tblUser.Name FROM tblGroupUserRel left outer join tblUser ON " + "tblUser.Id = tblGroupUserRel.UserId WHERE GroupId = " + GroupId + " ORDER BY tblUser.Name"; DataTable DT = GetDataTable(sSQL); foreach(DataRow r in DT.Rows) { int UserID = Convert.ToInt32(r[0]); User U = GetUser(UserID); X.Add(U); } DT.Dispose(); return X; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
/// <summary> /// Returns all Users currently in this Section /// </summary> /// <returns></returns> internal Users ALLUsers(int SectionID) { try { Users X = new Users(); string sSQL = "SELECT usr.UserId,u.Name FROM tblUserSectionRel usr " + " left outer join tblUser u ON u.Id = usr.UserId " + "WHERE usr.SectionId = " + SectionID + "ORDER BY u.Name"; DataTable DT = GetDataTable(sSQL); foreach(DataRow r in DT.Rows) { int UserID = Convert.ToInt32(r[0]); User U = GetUser(UserID); U.mvarCurrentSectionID = SectionID; X.Add(U); } DT.Dispose(); return X; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }