예제 #1
0
        static void Main(string[] args)
        {
            BaseGamerManager gamerManager = new GamerManager(new MernisServiceAdapter()); // gameManager newledik ama Mernis servisi ile

            Gamer gamer1 = new Gamer()                                                    //gamer1 tanımlama
            {
                FirstName        = "Abdurrahman Görkem",
                LastName         = "ARISOY",
                BirthDate        = new DateTime(1988, 4, 9),
                NationalIdNumber = "38422550582",
                Id = 1
            };

            gamerManager.Save(gamer1);          //gamerManager kullanımı
            gamerManager.Update(gamer1);
            gamerManager.Delete(gamer1);

            Game game1 = new Game()     //game1 tanımlama
            {
                GameName        = "Clash of Clans",
                GameDescription = "Mühteşem bir oyun",
                GameId          = 1,
                GamePrice       = 25
            };

            GameManager gameManager = new GameManager();        //gameManager newledik.

            gameManager.Add(game1);
            gameManager.Update(game1);      //gameManager kullanımı
            gameManager.Delete(game1);

            Kampanya kampanya1 = new Kampanya()     //kampanya1 tanımlama
            {
                CampName     = "Büyük Kampanya",
                CampDiscount = 25,
                CampId       = 1
            };

            CampaignManager campaignManager = new CampaignManager();    //campaignManager newledik

            campaignManager.Add(kampanya1);
            campaignManager.Update(kampanya1);  //campaignManager kullanımı
            campaignManager.Delete(kampanya1);

            SalesManager salesManager = new SalesManager();     //salesManager Newledik

            salesManager.Sale(gamer1, game1);
            salesManager.CampaignSale(gamer1, game1, kampanya1);  //kullanımı

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Gamer gamer1 = new Gamer();

            gamer1.Id             = 1;
            gamer1.FirstName      = "Emre";
            gamer1.lastName       = "Kara";
            gamer1.BrithYear      = 1999;
            gamer1.IdentityNumber = 15815793818;

            GamerManager gamerManager = new GamerManager(new UserValidationManager());

            gamerManager.Add(new Gamer {
                Id = 1, BrithYear = 1999, FirstName = "Emre", lastName = "Kara", IdentityNumber = 15815793818
            });


            Game game1 = new Game();

            game1.GameName  = "forza horizon 4";
            game1.GamePrice = 200;


            GameSellServiceManager gameSellServiceManager = new GameSellServiceManager();

            gameSellServiceManager.Sell(gamer1, game1);

            Campaign campaign1 = new Campaign();

            campaign1.CampaignId   = 1;
            campaign1.CampaignName = "Black Friday";

            CampaignManager campaignManager = new CampaignManager();

            campaignManager.Add(campaign1);
        }
예제 #3
0
        public static void Main()
        {
            Console.WriteLine("Program Working\n");

            #region Manager instantiation

            var campaignManager   = new CampaignManager();
            var saleManager       = new SaleManager(campaignManager);
            var gamerManager      = new GamerManager(saleManager);
            var gameManager       = new GameManager();
            var validationManager = new ValidationManager();

            #endregion

            #region Campaign insantiation

            var lowCampaign = new Campaign
            {
                Id       = 1,
                Discount = 10,
                Title    = "%10 discount!"
            };

            var midCampaign = new Campaign
            {
                Id       = 2,
                Discount = 20,
                Title    = "%20 discount!"
            };

            var highCampaign = new Campaign
            {
                Id       = 3,
                Discount = 20,
                Title    = "%30 discount!"
            };

            #endregion

            campaignManager.NewCampaign(lowCampaign);
            campaignManager.NewCampaign(midCampaign);
            campaignManager.NewCampaign(highCampaign);

            #region Game insantiation

            var cod4 = new Game
            {
                Id    = 1,
                Name  = "Call Of Duty 4",
                Price = 100
            };
            var codBlackOps = new Game
            {
                Id    = 2,
                Name  = "Call Of Duty Black Ops",
                Price = 200
            };

            var gta5 = new Game
            {
                Id    = 3,
                Name  = "GTA 5",
                Price = 2000
            };

            #endregion

            gameManager.AddGame(gta5);
            gameManager.AddGame(cod4);
            gameManager.AddGame(codBlackOps);

            #region Gamer instantiation

            var poorGamer = new Gamer
            {
                Id             = 1, Name = "Ibrahim",
                Surname        = "Yargici",
                IdentityNumber = "12345678910",
                BirthDate      = new DateTime(2020, 5, 01),
                BoughtGames    = new List <Game>(),
                Budget         = 100,
                UsedCampaigns  = new List <Campaign> {
                    midCampaign
                }
            };

            var richGamer = new Gamer
            {
                Id             = 2, Name = "Basar",
                Surname        = "Yargici",
                IdentityNumber = "00012345670",
                BirthDate      = new DateTime(2000, 11, 01),
                BoughtGames    = new List <Game> {
                    gta5
                },
                Budget        = 400,
                UsedCampaigns = new List <Campaign>
                {
                    lowCampaign,
                    midCampaign,
                    highCampaign
                }
            };

            var hackerGamer = new Gamer
            {
                Id             = 3,
                Name           = "hacker",
                Surname        = "gamer",
                IdentityNumber = "null",
                Budget         = 9999999999999999,
                BirthDate      = new DateTime(1111, 01, 01),
                BoughtGames    = new List <Game> {
                    gta5, cod4
                },
                UsedCampaigns = new List <Campaign>()
            };

            #endregion

            // Add gamers
            gamerManager.NewGamer(poorGamer);
            gamerManager.NewGamer(richGamer);
            gamerManager.NewGamer(hackerGamer);

            // Is gamer valid
            // Console.WriteLine(validationManager.IsGamerValid(richGamer));

            // Print all gamers
            // gamerManager.AllGamers();

            // All games
            // gameManager.AllGames();

            // All games that hackerGamer has
            // gamerManager.AllGameNames(hackerGamer);

            // All conditions on buying games
            // gamerManager.BuyGame(richGamer, codBlackOps);
            //
            // gamerManager.BuyGame(poorGamer, cod4);
            //
            // gamerManager.BuyGame(hackerGamer, codBlackOps);
            //
            // gamerManager.AllGamers();


            // Delete gamer
            // gamerManager.DeleteGamer(hackerGamer);

            // Update gamer
            // gamerManager.UpdateGamer(hackerGamer);
        }
예제 #4
0
        static void Main(string[] args)
        {
            Gamer gamer1 = new Gamer();

            gamer1.GamerFirstName = "Merve";
            gamer1.GamerLastName  = "Dağlı";
            gamer1.TcNo           = "11111";

            GamerManager gamerManager = new GamerManager(new MernisManager());

            gamerManager.Add(gamer1);
            gamerManager.Update(gamer1);
            gamerManager.Delete(gamer1);
            Console.WriteLine(" ");
            Console.WriteLine(" ");
            Console.WriteLine(" ");

            Gamer gamer2 = new Gamer();

            gamer2.GamerFirstName = "Ali";
            gamer2.GamerLastName  = "Işık";
            gamer2.TcNo           = "22222";



            Store store1 = new Store();

            store1.StoreName = "OnlinePlayStore";

            Store store2 = new Store();

            store2.StoreName = "PlayStore";



            Console.WriteLine("Games: ");

            Game game1 = new Game();

            game1.GameName  = "Pes 2021 Season Update PS4";
            game1.GamePrice = 199.00;


            Game game2 = new Game();

            game2.GameName  = "GTA 5 PS4";
            game2.GamePrice = 177.00;


            Game game3 = new Game();

            game3.GameName  = "NBA 2K21 PS4";
            game3.GamePrice = 295.00;



            Game[] games1 = new Game[] { game1, game2, game3 };

            foreach (var game in games1)
            {
                Console.WriteLine("Game Name : " + game.GameName + " GamePrice : " + game.GamePrice + " TL");
            }

            Console.WriteLine(" ");
            Console.WriteLine(" ");
            Console.WriteLine(" ");
            Console.WriteLine("Campaigns:");


            Campaign campaign1 = new Campaign();

            campaign1.CampaignName     = "Campaign in honor of the Chinese New Year!";
            campaign1.CampaignDiscount = 20;
            Campaign campaign2 = new Campaign();

            campaign2.CampaignName     = "Campaign in honor of the Black Friday!";
            campaign2.CampaignDiscount = 30;
            Campaign campaign3 = new Campaign();

            campaign3.CampaignName = "This game has no campaign!";


            CampaignManager campaignManager = new CampaignManager();

            campaignManager.Add(campaign1);
            campaignManager.Add(campaign2);
            campaignManager.Add(campaign3);

            Console.WriteLine(" ");
            Console.WriteLine(" ");
            Console.WriteLine(" ");
            Console.WriteLine("Sales:");

            SalesManager salesManager = new SalesManager();

            salesManager.sales(game1, campaign1, store2, gamer1);
            salesManager.sales(game2, campaign2, store1, gamer2);
        }