예제 #1
0
 public virtual ServiceTypeCollection GetServiceTypeList(ServiceTypeColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
 {            
     try
     {
         Database database = DatabaseFactory.CreateDatabase("CustommerServiceConnection");
         DbCommand dbCommand = database.GetStoredProcCommand("spServiceTypeGetList");
         
         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);
         
         ServiceTypeCollection serviceTypeCollection = new ServiceTypeCollection();
         using (IDataReader reader = database.ExecuteReader(dbCommand))
         {
             while (reader.Read())
             {
                 ServiceType serviceType = CreateServiceTypeFromReader(reader);
                 serviceTypeCollection.Add(serviceType);
             }
             reader.Close();
         }
         totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords");
         return serviceTypeCollection;
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.DataAccessGetServiceTypeListException, ex);
     }
 }
예제 #2
0
 public virtual ServiceTypeCollection GetServiceTypeList(ServiceTypeColumns orderBy, string orderDirection)
 {            
     int totalRecords = 0;
     return GetServiceTypeList(orderBy, orderDirection, 0, 0, out totalRecords);
 }
예제 #3
0
 public static ServiceTypeCollection GetServiceTypeList(ServiceTypeColumns orderBy, string orderDirection)
 {            
     try
     {
         ServiceTypeDAO serviceTypeDAO = new ServiceTypeDAO();
         return serviceTypeDAO.GetServiceTypeList(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.BusinessGetServiceTypeListException, ex);
     }
 }