public static CustomList<UserGroup> GetAllUser() { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<UserGroup> UsersCollection = new CustomList<UserGroup>(); IDataReader reader = null; String sql = string.Format("Select * From [User]"); try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { UserGroup newUsers = new UserGroup(); newUsers.SetDataForUserGroup(reader); UsersCollection.Add(newUsers); } return UsersCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public static CustomList<UserGroup> GetAllUserGroup(string groupCode) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<UserGroup> UserGroupCollection = new CustomList<UserGroup>(); String sql = "Select *from UserGroup where GroupCode='" + groupCode + "'"; IDataReader reader = null; ; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { UserGroup newUserGroup = new UserGroup(); newUserGroup.SetData(reader); UserGroupCollection.Add(newUserGroup); } reader.Close(); return UserGroupCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }