static void Main(string[] args) { PlayerManager playerManager = new PlayerManager(); playerManager.Add(new Player() { Tc = "10808198724", Name = "İbrahim", Surname = "ALTUN", YearOfBirth = 1997 }); GameManager gameManager = new GameManager(); gameManager.Add(new Game() { Name = "GTA V", Category = "Entertainment", Price = 135 }); while (true) { Console.WriteLine("\nOptions"); Console.WriteLine("\n(PA) : Player Add " + "\n(PD) : Player Delete" + "\n(PL) : Player List" + "\n(GA) : Game Add" + "\n(GD) : Game Delete" + "\n(GL) : Game List" + "\n(CC) : Choise Campaign" + "\n(E) : Exit"); string x = Console.ReadLine(); if (x == "PA") { Console.Clear(); Console.WriteLine("Enter the Player Information you want to add..."); Console.WriteLine("Tc : "); string TcNo = Console.ReadLine(); Console.WriteLine("Name : "); string PlayerName = Console.ReadLine(); Console.WriteLine("Surname : "); string PlayerSurname = Console.ReadLine(); Console.WriteLine("Year Of Birth : "); int BirthYear = Convert.ToInt32(Console.ReadLine()); ValidateManager validateManager = new ValidateManager(); validateManager.Validate(new Person { Tc = TcNo, Name = PlayerName, Surname = PlayerSurname, YearOfBirth = BirthYear }); } else if (x == "PD") { Console.WriteLine("Enter the name of the player you want to delete: "); playerManager.Delete(Console.ReadLine()); } else if (x == "PL") { Console.Clear(); playerManager.ListPlayer(); } else if (x == "GA") { Console.WriteLine("Enter the information of the game you want to add : "); Console.WriteLine("Game Name : "); string Name = Console.ReadLine(); Console.WriteLine("Game Category : "); string Category = Console.ReadLine(); Console.WriteLine("Game Price :"); double Price = Convert.ToDouble(Console.ReadLine()); gameManager.Add(new Game() { Name = Name, Category = Category, Price = Price }); } else if (x == "GL") { Console.Clear(); gameManager.ListGame(); } else if (x == "CC") { while (true) { Console.Clear(); Console.WriteLine("Campaigns " + "\n(1) Welcome Campaign" + "\n(2) New Year Campaign " + "\n(3) Student Campaign " + "\n(4) Menü"); Console.WriteLine("--------------------------"); int x2 = Convert.ToInt32(Console.ReadLine()); if (x2 == 1) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'Welcome Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new WelcomeCampaign(); gameManager.BuyGame(name, campaignService); } else if (x2 == 2) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'New Year Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new NewYearCampaign(); gameManager.BuyGame(name, campaignService); } else if (x2 == 3) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'Student Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new StudentCampaign(); gameManager.BuyGame(name, campaignService); } else { break; } } } else { Console.WriteLine("Exiting..."); break; } } }
static void Main(string[] args) { IGamer player1 = new OldGamer() { TcNo = "1", BirthYear = 1999, GamerName = "Ezgi", GamerSurname = "Akar", MembershipYear = 2 }; IGamer player2 = new OldGamer() { TcNo = "2", BirthYear = 1985, GamerName = "Engin", GamerSurname = "Demiroğ", MembershipYear = 20 }; GamerManager playerManager = new GamerManager(); playerManager.Add(player1); playerManager.Add(player2); GameManager gameManager = new GameManager(); gameManager.Add(new Game() { GameName = "Death Stranding", GameType = "Action", GamePrice = 499, GameReleaseYear = 2018, GameReviewScore = 8.3 }); gameManager.Add(new Game() { GameName = "Days Gone", GameType = "Action,Zombie", GamePrice = 139, GameReleaseYear = 2018, GameReviewScore = 7.3 }); gameManager.Add(new Game() { GameName = "Persona 5", GameType = "JRPG", GamePrice = 99, GameReleaseYear = 2015, GameReviewScore = 9.1 }); gameManager.Add(new Game() { GameName = "Cyberpunk 2077", GameType = "RPG", GamePrice = 499, GameReleaseYear = 2020, GameReviewScore = 7.1 }); gameManager.Add(new Game() { GameName = "Witcher 3", GameType = "RPG", GamePrice = 49, GameReleaseYear = 2015, GameReviewScore = 9.3 }); while (true) { Console.WriteLine("**********MENU**********"); Console.WriteLine("1-)Oyuncu Ekle\n2-)Oyuncu Sil\n3-)Kullanıcıları Listele\n4-)Oyun Ekle\n5-)Oyun Sil\n6-)Oyunları Listele\n7-)Oyunları İnceleme Puanına Göre Listele\n8-)Oyunları Çıkış Yıllarına Göre Sırala\n9-)Kampanya Seçiniz\n10-)Çıkış"); Console.WriteLine("************************"); int choice = Convert.ToInt32(Console.ReadLine()); Console.Clear(); if (choice == 1) { Console.WriteLine("Eklemek istediğiniz kullanıcı bilgilerini giriniz"); Console.WriteLine("Tc no:"); string TcNo = Console.ReadLine(); Console.WriteLine("Ad:"); string PlayerName = Console.ReadLine(); Console.WriteLine("Soyad:"); string PlayerSurname = Console.ReadLine(); Console.WriteLine("Doğum Yılı:"); int BirthYear = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Kaç yıl kullanmayı taahhüt ediyorsunuz:"); int UndertakingYear = Convert.ToInt32(Console.ReadLine()); playerManager.Add(new NewGamer() { TcNo = TcNo, GamerName = PlayerName, GamerSurname = PlayerSurname, BirthYear = BirthYear, UndertakingYear = UndertakingYear }); } else if (choice == 2) { Console.WriteLine("Silmek istediğiniz oyuncunun Tc Numarasını giriniz:"); playerManager.Delete(Console.ReadLine()); } else if (choice == 3) { playerManager.ListPlayer(); } else if (choice == 4) { Console.WriteLine("Eklemek istediğiniz oyunun bilgilerini giriniz"); Console.WriteLine("Oyun Adı:"); string GameName = Console.ReadLine(); Console.WriteLine("Oyunun Çıkış Yılı:"); int GameReleaseYear = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Oyunun Türü:"); string GameType = Console.ReadLine(); Console.WriteLine("Oyunun Fiyatı:"); double GamePrice = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Oyunun İnceleme Puanı:"); double GameReviewScore = Convert.ToDouble(Console.ReadLine()); gameManager.Add(new Game() { GameName = GameName, GameReleaseYear = GameReleaseYear, GameType = GameType, GamePrice = GamePrice, GameReviewScore = GameReviewScore }); } else if (choice == 5) { Console.WriteLine("Silmek istediğiniz oyunun Adını giriniz:"); gameManager.Delete(Console.ReadLine()); } else if (choice == 6) { gameManager.ListGame(); } else if (choice == 7) { gameManager.SortByReviewScores(); } else if (choice == 8) { gameManager.SortByReleaseYear(); } else if (choice == 9) { while (true) { Console.WriteLine("**********KAMPANYALAR**********"); Console.WriteLine("-1-Öğrenci Kampanyası\n-2-Kara Cuma Kampanyası\n-3-Ana Menüye Dön"); Console.WriteLine("*******************************"); int choice2 = Convert.ToInt32(Console.ReadLine()); Console.Clear(); if (choice2 == 1) { gameManager.ListGame(); Console.WriteLine("Yukarıdaki oyunlardan öğrencisi kampanyası uygulamak istediğiniz oyunun adını yazınız:"); string name = Console.ReadLine(); Console.Clear(); ICampaignService campaign = new StudentCampaign(); gameManager.GetGame(name, campaign); } else if (choice2 == 2) { gameManager.ListGame(); Console.WriteLine("Yukarıdaki oyunlardan kara cuma kampanyası uygulamak istediğiniz oyunun adını yazınız:"); string name = Console.ReadLine(); Console.Clear(); ICampaignService campaign = new BlackFridayCampaign(); gameManager.GetGame(name, campaign); } else { break; } } } else { Console.WriteLine("Programdan çıkış yaptınız.\nİyi günler..."); break; } } }
static void Main(string[] args) { List <Player> players = new List <Player>(); Player person1 = new Player() { Id = 1, FirstName = "Yasin", LastName = "Özer", NationalityId = "123456789", DateOfBirth = 1998, Password = "******" }; Customer person2 = new Player() { Id = 2, FirstName = "Zeynep Nur", LastName = "Özer", NationalityId = "987654321", DateOfBirth = 2013, UserName = "******", Password = "******" }; Customer person3 = new Player() { Id = 3, FirstName = "Ali", LastName = "Soydan", NationalityId = "213546956", DateOfBirth = 1995, UserName = "******", Password = "******" }; Customer[] customers = new Customer[] { person1, person2, person3 }; PlayerManager playerManager = new PlayerManager(); playerManager.Add(person1); playerManager.Add(person2); playerManager.Add(person3); GameManager gameManager = new GameManager(); Game game1 = new Game() { Id = 1, Name = "Call of Duty", Type = "War", Version = "1.30", Price = 469, ReleaseYear = 2007 }; Game game2 = new Game() { Id = 2, Name = "Rocket League", Type = "Entertainment", Version = "1.55", Price = 0, ReleaseYear = 2016 }; Game game3 = new Game() { Id = 2, Name = "Mad Max", Type = "War", Version = "2.1", Price = 15, ReleaseYear = 2015 }; gameManager.Add(game1); gameManager.Add(game2); //studentSale ICampaignManager campaignManager1 = new StudentCampaign(); //seasonSale ICampaignManager campaignManager2 = new SeasonCampaign(); campaignManager1.Calculate(game1); campaignManager2.Calculate(game2); /* * Console MENU * * bool val = true; * while (val) * { * Console.WriteLine("-----------------------------"); * Console.WriteLine("1. Add player\n" + * "2. Delete player\n" + * "3. Update player\n" + * "4. List the players\n" + * "5. Add game\n" + * "6. Delete game\n" + * "7. Update game\n" + * "8. Release of game\n" + * "9. Sale of game\n" + * "10. Select campaign for you\n" + * "-1. Exit the menu\n"); * Console.WriteLine("-----------------------------"); * int key = Convert.ToInt32(Console.ReadLine()); * Console.Clear(); * switch (key) * { * case 1: * Console.WriteLine("Enter your username"); * string _UserName = Console.ReadLine(); * Console.WriteLine("Enter your password"); * string _Password = Console.ReadLine(); * Console.WriteLine("Enter your Nationality Id:"); * string _NationalityId = Console.ReadLine(); * Console.WriteLine("Name: "); * string _FirstName = Console.ReadLine(); * Console.WriteLine("Lastname:"); * string _LastName = Console.ReadLine(); * Console.WriteLine("Date of birth: "); * int _DateOfBirth = Convert.ToInt32(Console.ReadLine()); * playerManager.Add(new Player() { UserName = _UserName, Password = _Password, FirstName = _FirstName, LastName = _LastName, DateOfBirth = _DateOfBirth, NationalityId = _NationalityId }); * break; * case 2: * Console.WriteLine("Enter your Id for Delete"); * int _Id = Convert.ToInt32(Console.ReadLine()); * playerManager.Delete(person1, _Id); * break; * case 3: * Console.WriteLine("Enter your Id for Update"); * //int _Id = Convert.ToInt32(Console.ReadLine()); * playerManager.Update(person1); * break; * case 4: * playerManager.ShowList(customers); * break; * case 5: * gameManager.Add(game1); * * break; * case 6: * gameManager.Delete(game2); * break; * case 7: * gameManager.Update(game1); * break; * case 8: * gameManager.Release(game3); * break; * case 9: * gameManager.GameSale(game1); * break; * case 10: * Console.WriteLine("Select campaign"); * break; * case -1: * val = false; * break; * default: * Console.WriteLine("Wrong key please enter again"); * break; * } * } * */ }