AJH.CMS.Core.Data.PublishDataMapper.GetPublishById C# (CSharp) Method

GetPublishById() static private method

static private GetPublishById ( int PublishID ) : Publish
PublishID int
return AJH.CMS.Core.Entities.Publish
        internal static Publish GetPublishById(int PublishID)
        {
            Publish publish = null;

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

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

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