private void ConstructAuction(DatabaseOfAuctions database) { AuctionBuilder.NewAuction(); AuctionBuilder.BuildNameOfAuction(); AuctionBuilder.BuildDescription(); AuctionBuilder.BuildStartPrice(); AuctionBuilder.BuildTimeOfAuction(); AuctionBuilder.BuildMinPointsOfTrust(); AuctionBuilder.BuildAuctionUser(this); database.addAuction(this.AuctionBuilder); }
public override void NextTour(AuctionBuilder actuallAuction, User winningUser) { int tmp = actuallAuction.GetAuction().TimeOfAuction - 1; actuallAuction.GetAuction().TimeOfAuction = tmp; Console.WriteLine("Zostało " + actuallAuction.GetAuction().TimeOfAuction + " Tur"); if (actuallAuction.GetAuction().TimeOfAuction == 0) { actuallAuction.GetWinner(actuallAuction, winningUser); } }
public override User CheckPointsOfTrust(User user, AuctionBuilder actuallAuction, User winningUser) { if (user.PointOfTrust > actuallAuction.GetAuction().MinPointOfTrust) { Console.WriteLine("Jesteś w aukcji o nazwie " + actuallAuction.GetAuction().NameOfAuction); Console.WriteLine("Kwota aukcji: " + actuallAuction.GetAuction().StartPrice); Console.WriteLine("Jaką kwotę chciałbyś postawić (Jeśli chcesz ominąć turę podaj kwotę 0)"); double money = Convert.ToDouble(Console.ReadLine()); if (money > actuallAuction.GetAuction().StartPrice) { actuallAuction.GetAuction().StartPrice = money; winningUser.FirstName = user.FirstName; winningUser.LastName = user.LastName; winningUser.Login = user.Login; winningUser.Mail = user.Mail; winningUser.PointOfTrust = user.PointOfTrust; } } return(winningUser); }
public static void ChooseAuction(DatabaseOfAuctions auctions, DatabaseOfUsers users) { Console.WriteLine("Wybierz numer aukcji"); int i = int.Parse(Console.ReadLine()); foreach (AuctionBuilder auction in auctions.getListOfAuction()) { Console.WriteLine(auction); } AuctionBuilder actuallAuction = auctions.getAuction(i); User winningUser = new User(); foreach (User user in users.GetListOfUsers()) { Console.WriteLine("Kolej na " + user.FirstName + "\n"); actuallAuction.CheckPointsOfTrust(user, actuallAuction, winningUser); } actuallAuction.NextTour(actuallAuction, winningUser); }
public override void NextTour(AuctionBuilder actuallAuction, User winningUser) { double tmpMoney = 0; var tmp = actuallAuction.GetAuction().TimeOfAuction - 1; if (tmpMoney != actuallAuction.GetAuction().StartPrice) { if (tmp == 0) { tmpMoney = actuallAuction.GetAuction().StartPrice; tmp = actuallAuction.GetAuction().TimeOfAuction + 1; actuallAuction.GetAuction().TimeOfAuction = tmp; Console.WriteLine("Aukcja została przedłużona"); } else { tmpMoney = actuallAuction.GetAuction().StartPrice; actuallAuction.GetAuction().TimeOfAuction = tmp; Console.WriteLine("Zostało " + actuallAuction.GetAuction().TimeOfAuction + " Tur"); } } else { if (actuallAuction.GetAuction().TimeOfAuction == 0) { actuallAuction.GetWinner(actuallAuction, winningUser); } else { tmp = actuallAuction.GetAuction().TimeOfAuction - 1; actuallAuction.GetAuction().TimeOfAuction = tmp; Console.WriteLine("Użytkownicy aukcji nie podbili ceny"); Console.WriteLine("Zostało " + actuallAuction.GetAuction().TimeOfAuction + " Tur"); } } }
public void MakeAuction(AuctionBuilder auctionBuilder, DatabaseOfAuctions database) { AuctionBuilder = auctionBuilder; ConstructAuction(database); }
public void addAuction(AuctionBuilder auction) { auctions.Add(auction); }
public override void GetWinner(AuctionBuilder actuallAuction, User winningUser) { Console.WriteLine("Aukcja zostaje zakończona" + "\n"); Console.WriteLine("Aukcje z kwotą" + actuallAuction.GetAuction().StartPrice + " wygrywa " + winningUser); }
public abstract User CheckPointsOfTrust(User user, AuctionBuilder actuallAuction, User winningUser);
public abstract void NextTour(AuctionBuilder actuallAuction, User winningUser);
public abstract void GetWinner(AuctionBuilder actuallAuction, User winningUser);