Пример #1
0
        public virtual LinkCollection GetLinkListBySourceId(Int32 sourceId ,LinkColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("spLinkGetListBySource");

                database.AddInParameter(dbCommand, "@SourceId", DbType.Int32, sourceId);
                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);

                LinkCollection linkCollection = new LinkCollection();
                using (IDataReader reader = database.ExecuteReader(dbCommand))
                {
                    while (reader.Read())
                    {
                        Link link = CreateLinkFromReader(reader);
                        linkCollection.Add(link);
                    }
                    reader.Close();
                }
                totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords");
                return linkCollection;
            }
            catch (Exception ex)
            {
                // log this exception
                log4net.Util.LogLog.Error(ex.Message, ex);
                // wrap it and rethrow
                throw new ApplicationException(SR.DataAccessGetLinkListException, ex);
            }
        }
Пример #2
0
 public static LinkCollection GetLinkList(LinkColumns orderBy, string orderDirection)
 {            
     try
     {
         LinkDAO linkDAO = new LinkDAO();
         return linkDAO.GetLinkList(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.BusinessGetLinkListException, ex);
     }
 }        
Пример #3
0
 public static LinkCollection GetLinkListBySourceId(Int32 sourceId, LinkColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
 {
     try
     {
         LinkDAO linkDAO = new LinkDAO();
         return linkDAO.GetLinkListBySourceId(sourceId, orderBy, orderDirection, page, pageSize, out totalRecords);
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.BusinessGetLinkListException, ex);
     }
 }     
Пример #4
0
 public virtual LinkCollection GetLinkList(LinkColumns orderBy, string orderDirection)
 {            
     int totalRecords = 0;
     return GetLinkList(orderBy, orderDirection, 0, 0, out totalRecords);
 }
Пример #5
0
 public virtual LinkCollection GetLinkListBySourceId(Int32 sourceId, LinkColumns orderBy, string orderDirection)
 {
     int totalRecords = 0;
     return GetLinkListBySourceId(sourceId, orderBy, orderDirection, 0, 0, out totalRecords);
 }