AJH.CMS.Core.Data.UserDataMapper.GetUserById C# (CSharp) Method

GetUserById() static private method

static private GetUserById ( int UserID ) : User
UserID int
return AJH.CMS.Core.Entities.User
        internal static User GetUserById(int UserID)
        {
            User user = null;

            using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString))
            {
                SqlCommand sqlCommand = new SqlCommand(SN_USER_GET_BY_ID, sqlConnection);
                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter parameter = new SqlParameter(PN_USER_ID, System.Data.SqlDbType.Int);
                parameter.Direction = System.Data.ParameterDirection.Input;
                parameter.Value = UserID;
                sqlCommand.Parameters.Add(parameter);

                sqlCommand.Connection.Open();
                using (SqlDataReader reader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
                {
                    while (reader.Read())
                    {
                        if (user == null)
                            user = new User();
                        FillFromReader(user, reader);
                    }
                    reader.Close();
                    sqlCommand.Connection.Close();
                }
            }
            return user;
        }