AJH.CMS.Core.Data.PreferenceDataMapper.GetPreferences C# (CSharp) Method

GetPreferences() static private method

static private GetPreferences ( int portalID ) : List
portalID int
return List
        internal static List<AJH.CMS.Core.Entities.Preference> GetPreferences(int portalID)
        {
            List<AJH.CMS.Core.Entities.Preference> colPreferences = null;
            AJH.CMS.Core.Entities.Preference Preference = null;

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

                SqlParameter sqlParameter = null;
                sqlParameter = new SqlParameter(PN_PREFERENCE_PORTAL_ID, System.Data.SqlDbType.Int);
                sqlParameter.Direction = System.Data.ParameterDirection.Input;
                sqlParameter.Value = portalID;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlCommand.Connection.Open();
                using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
                {
                    colPreferences = new List<AJH.CMS.Core.Entities.Preference>();
                    while (sqlDataReader.Read())
                    {
                        Preference = GetPreference(colPreferences, sqlDataReader);
                        FillFromReader(Preference, sqlDataReader);
                    }

                    sqlDataReader.Close();
                    sqlCommand.Connection.Close();
                }
            }
            return colPreferences;
        }