Ejemplo n.º 1
0
        //Updates the balance of the private person
        private void UpdateBalance(Object obj,  Auction.PriceArgs e)
        {
            if(e.Salesman.Person != null && this == e.Salesman.Person)
            {
                Balance += AuctionHouse.AuctionFee(e.Price);
            }

            else if (e.Buyer.Person != null && this == e.Buyer.Person)
            {
                Balance -= e.Price;
            }
        }
Ejemplo n.º 2
0
        //Updates the balance of the company
        private void UpdateBalance(Object obj, Auction.PriceArgs e)
        {
            decimal tempBalance = e.Price;

            if (e.Salesman.Company != null && this == e.Salesman.Company)
            {
                    Balance += AuctionHouse.AuctionFee(e.Price);
            }

            else if (e.Buyer.Company != null && this == e.Buyer.Company)
            {
                if (tempBalance > Balance)
                {
                    tempBalance -= Balance;
                    Balance = 0.0M;
                    Credit -= tempBalance;
                }
            }
        }
Ejemplo n.º 3
0
 //Subscribes the company to the event that updates the balance
 public void SubscribeToEvent(Auction auction)
 {
     auction.UpdateBalanceEvent += UpdateBalance;
 }
Ejemplo n.º 4
0
 //Removes the company from the event that updates the balance
 public void RemoveFromEvent(Auction auction)
 {
     auction.UpdateBalanceEvent -= UpdateBalance;
 }
Ejemplo n.º 5
0
        //Method that overloads the previous method to make a different notify method
        public int PutUpForSale(Vehicle vehicle, Seller salesman, decimal minPrice, NotifyDelegate notify)
        {
            if (!AuctionList.Any(x => x.Vehicle.Equals(vehicle)))
            {
                ++_auctionNumber;

                Auction au = new Auction(vehicle, salesman, _auctionNumber, minPrice, notify);
                AuctionList.Add(au);

                return _auctionNumber;
            }
            else
            {
                Console.WriteLine("The vehicle has already been put up for sale!");
                return AuctionList.Find(x => x.Vehicle.Equals(vehicle)).AuctionNumber;
            }
        }