コード例 #1
0
        static void Main(string[] args)
        {
            //Oyuncu Ekleme
            IGamerService      gamerService      = new GamerManager(new GamerCheckManager());
            IGamerCheckService gamerCheckService = new GamerCheckManager();
            Gamer gamer1 = new Gamer()
            {
                Id            = 1,
                FirstName     = "Melike",
                LastName      = "Işık",
                BirthYear     = 1996,
                NationalityId = "12345678910"
            };
            Gamer gamer2 = new Gamer()
            {
                Id            = 2,
                FirstName     = "Müge",
                LastName      = "Işık",
                BirthYear     = 2000,
                NationalityId = "12345678910"
            };

            gamerService.Add(gamer1);
            gamerService.Add(gamer2);


            gamerService.Delete(gamer1);  //Oyuncu Silme
            gamer2.FirstName = "Nimet Müge";
            gamerService.Update(gamer2);

            IGameService gameService = new GameManager();
            Game         game1       = new Game()
            {
                Id          = 1,
                Name        = "Grand Theft Auto 5",
                Price       = 152.10,
                Detail      = "Grand Theft Auto serisinin beşinci oyunudur. Tüm GTAV hikayesi, GTA Online ve mevcut içerik ve yükseltmelerin tümünün yanı sıra GTA Online’da kendi suç imparatorluğunu kurmanın en kısa yolu Criminal Enterprise Başlangıç Paketi de bulunuyor.",
                UnitInStock = 1,
            };

            Game game2 = new Game()
            {
                Id          = 2,
                Name        = "The Sims 4",
                Price       = 265,
                Detail      = "The Sims 4, serinin önceki oyunları gibi yaşam simülasyonu oyunudur. Oyuncular bir Sim karakteri yaratırlar ve oyunda farklı Sim kişiliklerini keşfederek oyuna yön verirler. Simler daha önceki oyunlardan farklı olarak aynı anda iki fiziksel eylemi gerçekleştirebilir. Ayrıca Simlerin modları da oyun akışını değiştirebilir. Örneğin kızgın ya da heyecanlı bir Sim, verilen bir görevi daha hızlı yapar.",
                UnitInStock = 2,
            };

            //Kampanya ekleme

            ICompaignService compaignService = new CompaignManager();
            Compaign         compaign1       = new Compaign()
            {
                Id       = 1,
                Name     = "Black Friday Compaign",
                Discount = 10,
            };

            Compaign compaign2 = new Compaign()
            {
                Id       = 2,
                Name     = "Happy New Year Compaign",
                Discount = 20,
            };

            compaignService.Add(compaign1);
            compaignService.Add(compaign2);

            gameService.ApplyCompaign(compaign1, game1);
            gameService.ApplyCompaign(compaign1, game2);

            gameService.SellGame(game1, gamer2);
            gameService.SellGame(game2, gamer2);
            gameService.SellGame(game1, gamer1);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Player player = new Player()
            {
                TcNo  = "221412",
                Ad    = "Kağan",
                Soyad = "COŞAR"
            };

            Player player2 = new Player()
            {
                TcNo  = "221412",
                Ad    = "Hatice",
                Soyad = "COŞAR"
            };

            PlayerManager playerManager = new PlayerManager();

            playerManager.Add(player);
            playerManager.Update(player2);
            playerManager.Delete(player);

            Console.WriteLine("*************");

            IUsersService[] usersService = new IUsersService[2] {
                new MySqlUserService(), new OracleUserService()
            };
            ILoggerService[] loggersService = new ILoggerService[2] {
                new MySqlUserService(), new OracleUserService()
            };

            foreach (var item in usersService)
            {
                item.CheckUser();
            }

            foreach (var item in loggersService)
            {
                item.LoggerService();
            }

            Console.WriteLine("**********");

            Compaign compaign1 = new Compaign();

            compaign1.CampaignType = "İndirim";
            compaign1.CampaignName = "Black Friday";

            Compaign compaign2 = new Compaign();

            compaign2.CampaignType = "İndirim";
            compaign2.CampaignName = "Şahane Aralık";

            ////Compaign[] compoigns = new Compaign[2] { compaign1, compaign2 };
            List <Compaign> compoigns = new List <Compaign>()
            {
                compaign1, compaign2
            };

            var compaignmanager = new CompaignManager();

            foreach (var item in compoigns)
            {
                compaignmanager.CompaignAdd(item);
                compaignmanager.CompaignDeleted(item);
                compaignmanager.CompaigUpdate(item);
            }

            Console.WriteLine("*********");

            Product product1 = new Product();

            product1.Name  = "Valaront";
            product1.Price = 200;

            Product product2 = new Product()
            {
                Name = "Cs Go", Price = 77
            };

            GameManager gameManager = new GameManager();

            gameManager.GameBuy(product1, compaign1, player);
            gameManager.GameBuy(product2, compaign2, player2);
        }