internal static List<User> GetUsers(int RoleID)
{
List<User> colUsers = null;
User user = null;
using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
{
SqlCommand sqlCommand = new SqlCommand(SN_USER_GET_BY_ROLE_ID, sqlConnection);
sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter parameter = new SqlParameter(RoleDataMapper.PN_ROLE_ID, System.Data.SqlDbType.Int);
parameter.Direction = System.Data.ParameterDirection.Input;
parameter.Value = RoleID;
sqlCommand.Parameters.Add(parameter);
sqlCommand.Connection.Open();
using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
{
colUsers = new List<User>();
while (sqlDataReader.Read())
{
user = GetUser(colUsers, sqlDataReader);
FillFromReader(user, sqlDataReader);
}
sqlDataReader.Close();
sqlCommand.Connection.Close();
}
}
return colUsers;
}