public IList<Auction.Domain.Event> GetByAccount(long accountId,
                           ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.AccountId == accountId);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.GetMulti(filter, 0);
         return
             records.Select(
                 b =>
                 new Event()
                     {
                         Id = b.Id,
                         Date = b.Date,
                         Name = b.Name,
                         AccountId = b.AccountId,
                         CreatedBy = b.CreatedBy,
                         Locked = b.Locked,
                         Notes = b.Notes,
                         UpdatedBy = b.UpdatedBy
                     }).ToList();
     }
 }
        public Event Get(long Id, ref IAuctionTransaction trans)
        {
            using (var records = new AuctionEventCollection())
            {
                var filter = new PredicateExpression(AuctionEventFields.Id == Id);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter, 1);
                var b = records.ToList().FirstOrDefault();
                return new Event()
                {
                    Id = Id,
                    Date = b.Date,
                    Name = b.Name,
                    AccountId = b.AccountId,
                    CreatedBy = b.CreatedBy,
                    Locked = b.Locked,
                    Notes = b.Notes,
                    UpdatedBy = b.UpdatedBy
                };
            }
        }
 public bool EventExists(long id, ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.Id == id);
         if (trans != null)
         {
             trans.Add(records);
         }
         return records.GetDbCount(filter) > 0;
     }
 }
 public int GetCountByAccount(long accountId,
                              ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.AccountId == accountId);
         if (trans != null)
         {
             trans.Add(records);
         }
         return records.GetDbCount(filter);
     }
 }
 public void Update(ref Auction.Domain.Event auctionEvent, ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.Id == auctionEvent.Id);
         var evt = new AuctionEventEntity
         {
             AccountId = auctionEvent.Id,
             Name = auctionEvent.Name,
             Date = auctionEvent.Date,
             Locked = auctionEvent.Locked,
             Notes = auctionEvent.Notes,
             UpdatedBy = auctionEvent.UpdatedBy
         };
         if (trans != null)
         {
             trans.Add(records);
         }
         records.UpdateMulti(evt, filter);
     }
 }