Example #1
0
        public void AddCashForBuyer(ServerBuyerDTO serverBuyerDTO)
        {
            tempBuyersOnline.FirstOrDefault(x => x.Name == serverBuyerDTO.Name &&
                                            x.Password == serverBuyerDTO.Password).Cash = serverBuyerDTO.Cash;
            Buyers temp = mapperBuyer.Map <ServerBuyerDTO, Buyers>(serverBuyerDTO);

            buyerWrapper.AddCashForBuyer(temp);
        }
Example #2
0
        public void BoughtLot(ServerBuyerDTO serverBuyerDTO, ServerLotDTO serverLotDTO)
        {
            tempBuyersOnline.FirstOrDefault(x => x.Name == serverBuyerDTO.Name &&
                                            x.Password == serverBuyerDTO.Password).
            BuyerBoughtLots.Add(serverLotDTO);
            Lots   tempLotF   = mapperLot.Map <ServerLotDTO, Lots>(serverLotDTO);
            Buyers tempBuyerF = mapperBuyer.Map <ServerBuyerDTO, Buyers>(serverBuyerDTO);

            buyerWrapper.BoughtLot(tempLotF, tempBuyerF);
        }
Example #3
0
        public void MakeBet(ServerLotDTO serverLotDTO, ServerBuyerDTO serverBuyerDTO, decimal newPrice)
        {
            tempBuyersOnline.FirstOrDefault(x => x.Name == serverBuyerDTO.Name &&
                                            x.Password == serverBuyerDTO.Password).Cash -= newPrice;

            var tempLot = templotsBuyer.FirstOrDefault(x => x.BuyerName == serverLotDTO.BuyerName);

            if (tempLot != null)
            {
                tempBuyersOnline.FirstOrDefault(x => x.Name == tempLot.BuyerName).Cash += tempLot.StartPrice;
            }

            templotsBuyer.FirstOrDefault(x => x.BuyerName == serverLotDTO.BuyerName).StartPrice = newPrice;
            templotsBuyer.FirstOrDefault(x => x.BuyerName == serverLotDTO.BuyerName).BuyerName  = serverBuyerDTO.Name;
        }
Example #4
0
        public bool ConnectionForBuyer(ServerBuyerDTO serverBuyerDTO)
        {
            Buyers temp = mapperBuyer.Map <ServerBuyerDTO, Buyers>(serverBuyerDTO);

            if (buyerWrapper.DoesItBuyerExist(temp))
            {
                if (tempBuyersOnline.FirstOrDefault(x => x.Name == serverBuyerDTO.Name &&
                                                    x.Password == serverBuyerDTO.Password) == null)
                {
                    tempBuyersOnline.Add(serverBuyerDTO);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                buyerWrapper.AddBuyer(temp);
                tempBuyersOnline.Add(serverBuyerDTO);
                return(true);
            }
        }
Example #5
0
 //передивитись на предмет дісконнекта, коли баєр уходить що робити з грошима і ставкою
 public void DisconectionForBuyer(ServerBuyerDTO serverBuyerDTO)
 {
     tempBuyersOnline.Remove(serverBuyerDTO);
 }