public virtual MessageContentSentCollection MessageContentSentGetListFilterByServiceTypeID(int ServiceTypeId, string Sender, string Receiver, DateTime FromModifiedDate,DateTime ToModifiedDate, MessageContentSentColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase("CustommerServiceConnection");
                DbCommand dbCommand = database.GetStoredProcCommand("spMessageContentSentGetListFilterByServiceTypeID");

                database.AddInParameter(dbCommand, "@ServiceTypeID", DbType.Int32, ServiceTypeId);
                database.AddInParameter(dbCommand, "@Sender", DbType.String, Sender.ToString());
                database.AddInParameter(dbCommand, "@Receiver", DbType.String, Receiver.ToString());
                database.AddInParameter(dbCommand, "@FromModifiedDate", DbType.DateTime, FromModifiedDate);
                database.AddInParameter(dbCommand, "@ToModifiedDate", DbType.DateTime, ToModifiedDate);
                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);

                MessageContentSentCollection messageContentSentCollection = new MessageContentSentCollection();
                using (IDataReader reader = database.ExecuteReader(dbCommand))
                {
                    while (reader.Read())
                    {
                        MessageContentSent messageContentSent = CreateMessageContentSentFromReader(reader);
                        messageContentSentCollection.Add(messageContentSent);
                    }
                    reader.Close();
                }
                totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords");
                return messageContentSentCollection;
            }
            catch (Exception ex)
            {
                // log this exception
                log4net.Util.LogLog.Error(ex.Message, ex);
                // wrap it and rethrow
                throw new ApplicationException(SR.DataAccessGetMessageContentSentListException, ex);
            }
        }
 public static MessageContentSentCollection GetMessageContentSentList(MessageContentSentColumns orderBy, string orderDirection)
 {            
     try
     {
         MessageContentSentDAO messageContentSentDAO = new MessageContentSentDAO();
         return messageContentSentDAO.GetMessageContentSentList(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.BusinessGetMessageContentSentListException, ex);
     }
 }        
 public virtual MessageContentSentCollection GetMessageContentSentList(MessageContentSentColumns orderBy, string orderDirection)
 {            
     int totalRecords = 0;
     return GetMessageContentSentList(orderBy, orderDirection, 0, 0, out totalRecords);
 }
 public static MessageContentSentCollection MessageContentSentGetListFilterByServiceTypeID(int ServiceTypeId, string Sender, string Receiver, DateTime fromDate,DateTime toDate, MessageContentSentColumns orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
 {
     try
     {
         MessageContentSentDAO messageContentSentDAO = new MessageContentSentDAO();
         return messageContentSentDAO.MessageContentSentGetListFilterByServiceTypeID(ServiceTypeId, Sender, Receiver, fromDate, toDate, 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.BusinessGetMessageContentSentListException, ex);
     }
 }