public AuctionInfo ListAuctionTwiceWithoutTransaction(String auctionId)
        {
            try
            {
                TransactionalAuctionService service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                AuctionInfo ai = service.ListAuction(auctionId);

                string sql = ai.Sql;

                service = new TransactionalAuctionService();
                service.SetPersistenceFactory(this.persistenceFactory);
                ai = service.ListAuction(auctionId);

                ai.Sql = sql + ai.Sql;

                return(ai);
            }
            catch (Exception e)
            {
                // The next operation is for Object-Relational mapping software that needs to be explicitly cleaned up.
                // Those that do not simply ignore this operation.
                if (persistentAuctions != null)
                {
                    persistentAuctions.Close();
                }
                throw new AuctionServiceException(e);
            }
        }
Ejemplo n.º 2
0
        public string PlaceBid(String auctionId, String bidId, String userId, System.Double amount, System.Double maxAmount)
        {
            string sql = "";

            try
            {
                IUser    user    = persistentAuctions.GetUser(userId);
                IAuction auction = persistentAuctions.GetAuction(auctionId);
                IBid     newBid  = persistentAuctions.CreateBid(bidId, auction, user, amount, maxAmount);

                // The next operation is for Object-Relational mapping software that needs to be explicitly cleaned up.
                // Those that do not simply ignore this operation.
                persistentAuctions.Close();

                sql = persistentAuctions.Sql;
            }
            catch (Exception e)
            {
                // The next operation is for Object-Relational mapping software that needs to be explicitly cleaned up.
                // Those that do not simply ignore this operation.
                if (persistentAuctions != null)
                {
                    persistentAuctions.Close();
                }
                throw new AuctionServiceException(e);
            }
            return(sql);
        }