public virtual ContentTemplateAttachementCollection GetContentTemplateAttachementList(Int32 contentTemplateId,ContentTemplateAttachementColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase("CustommerServiceConnection");
                DbCommand dbCommand = database.GetStoredProcCommand("spContentTemplateAttachementGetListByContentTemplateID");

                database.AddInParameter(dbCommand, "@ContentTemplateID", DbType.Int32, contentTemplateId);
                database.AddInParameter(dbCommand, "@OrderBy", DbType.AnsiString, orderBy.ToString());
                database.AddInParameter(dbCommand, "@OrderDirection", DbType.AnsiString, orderDirection.ToString());
                database.AddInParameter(dbCommand, "@Page", DbType.Int32, page);
                database.AddInParameter(dbCommand, "@PageSize", DbType.Int32, pageSize);
                database.AddOutParameter(dbCommand, "@TotalRecords", DbType.Int32, 4);

                ContentTemplateAttachementCollection contentTemplateAttachementCollection = new ContentTemplateAttachementCollection();
                using (IDataReader reader = database.ExecuteReader(dbCommand))
                {
                    while (reader.Read())
                    {
                        ContentTemplateAttachement contentTemplateAttachement = CreateContentTemplateAttachementFromReader(reader);
                        contentTemplateAttachementCollection.Add(contentTemplateAttachement);
                    }
                    reader.Close();
                }
                totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords");
                return contentTemplateAttachementCollection;
            }
            catch (Exception ex)
            {
                // log this exception
                log4net.Util.LogLog.Error(ex.Message, ex);
                // wrap it and rethrow
                throw new ApplicationException(SR.DataAccessGetContentTemplateAttachementListException, ex);
            }
        }
 public static ContentTemplateAttachementCollection GetContentTemplateAttachementList(ContentTemplateAttachementColumns orderBy, string orderDirection)
 {            
     try
     {
         ContentTemplateAttachementDAO contentTemplateAttachementDAO = new ContentTemplateAttachementDAO();
         return contentTemplateAttachementDAO.GetContentTemplateAttachementList(orderBy, orderDirection);
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.BusinessGetContentTemplateAttachementListException, ex);
     }
 }        
 public virtual ContentTemplateAttachementCollection GetContentTemplateAttachementList(Int32 contentTemplateId, ContentTemplateAttachementColumns orderBy, string orderDirection)
 {
     int totalRecords = 0;
     return GetContentTemplateAttachementList(contentTemplateId, orderBy, orderDirection, 0, 0, out totalRecords);
 }