public virtual ApprovedStockNewCollection GetApprovedStockNewList(ApprovedStockNewColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords) { try { Database database = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = database.GetStoredProcCommand("spApprovedStockNewsGetList"); 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); ApprovedStockNewCollection approvedStockNewCollection = new ApprovedStockNewCollection(); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { ApprovedStockNew approvedStockNew = CreateApprovedStockNewFromReader(reader); approvedStockNewCollection.Add(approvedStockNew); } reader.Close(); } totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords"); return approvedStockNewCollection; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessGetApprovedStockNewListException, ex); } }
public virtual ApprovedStockNewCollection GetApprovedStockNewList(ApprovedStockNewColumns orderBy, string orderDirection) { int totalRecords = 0; return GetApprovedStockNewList(orderBy, orderDirection, 0, 0, out totalRecords); }
public static ApprovedStockNewCollection GetApprovedStockNewList(ApprovedStockNewColumns orderBy, string orderDirection) { try { ApprovedStockNewDAO approvedStockNewDAO = new ApprovedStockNewDAO(); return approvedStockNewDAO.GetApprovedStockNewList(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.BusinessGetApprovedStockNewListException, ex); } }