AJH.CMS.Core.Data.XSLTemplateDataMapper.GetXSLTemplateById C# (CSharp) Method

GetXSLTemplateById() static private method

static private GetXSLTemplateById ( int XSLTemplateID ) : XSLTemplate
XSLTemplateID int
return AJH.CMS.Core.Entities.XSLTemplate
        internal static XSLTemplate GetXSLTemplateById(int XSLTemplateID)
        {
            XSLTemplate xslTemplate = null;

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

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

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