Example #1
0
        static void Main(string[] args)
        {
            Customer customer = new Customer()
            {
                Identity = "28861499108", DateOfBirth = 1985, FirstName = "Engin", LastName = "Demiroğ"
            };
            CustomerManager customerManager = new CustomerManager(new ServiceAdapter());

            customerManager.Save(customer);
            customerManager.Update(customer);
            customerManager.Delete(customer);

            Game game = new Game()
            {
                Name = "Pacman", Price = 50
            };
            Discount discount = new Discount()
            {
                Name = "new year", Rate = 20
            };
            Discount discount1 = new Discount()
            {
                Name = "cyber monday", Rate = 10
            };
            DiscountManager discountManager = new DiscountManager();

            discountManager.AddNewDiscount(discount1);
            GameSalesManagement gameSalesManagement = new GameSalesManagement();

            gameSalesManagement.Sales(customer, game, discount);
        }
Example #2
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");

            Register reg1 = new Register();

            reg1.Id        = 1;
            reg1.Tc        = "12345";
            reg1.Ad        = "kubilay";
            reg1.Soyad     = "arslan";
            reg1.DogumYili = 2000;
            RegisterManager regMan1 = new RegisterManager();

            regMan1.Add(reg1);
            regMan1.Update(reg1);

            Game game1 = new Game();

            game1.Id      = 1;
            game1.Ad      = "GTA V";
            game1.Fiyat   = 100;
            game1.Indirim = 0;

            Game game2 = new Game();

            game2.Id      = 2;
            game2.Ad      = "CS:GO";
            game2.Fiyat   = 50;
            game2.Indirim = 0;


            GameManager gameMan1 = new GameManager();

            gameMan1.Add(game1);

            DiscountManager discountMan1 = new DiscountManager();

            discountMan1.Add(game1);

            gameMan1.Delete(game1);
            discountMan1.Delete(game1);

            gameMan1.Add(game2);
            discountMan1.Add(game2);
        }
Example #3
0
        static void Main(string[] args)
        {
            List <Discount> discounts = new List <Discount>()
            {
                new Discount {
                    DiscountID = 1, DiscountRate = 20, EndDate = 30
                },
                new Discount {
                    DiscountID = 2, DiscountRate = 25, EndDate = 15
                },
                new Discount {
                    DiscountID = 3, DiscountRate = 5, EndDate = 30
                },
                new Discount {
                    DiscountID = 4, DiscountRate = 50, EndDate = 2
                }
            };
            DiscountManager discountManager = new DiscountManager();

            foreach (var discount in discounts)
            {
                discountManager.Add(discount);
            }
            discountManager.Delete(discounts[1]);
            discountManager.Update(discounts[3]);

            Gamer gamer = new Gamer()
            {
                GamerID   = 1,
                Identity  = "123456789",
                FirstName = "Talip",
                LastName  = "BULUNDU",
                BirthYear = 1900
            };
            GamerManager gamerManager = new GamerManager(new MernisServiceAdapter());

            gamerManager.Add(gamer);

            List <Game> games = new List <Game>()
            {
                new Game {
                    GameID = 1, GameName = "Game1", Company = "GameCompany1", Price = 25
                },
                new Game {
                    GameID = 2, GameName = "Game2", Company = "GameCompany2", Price = 30
                },
                new Game {
                    GameID = 3, GameName = "Game3", Company = "GameCompany3", Price = 35
                },
                new Game {
                    GameID = 4, GameName = "Game4", Company = "GameCompany4", Price = 40
                },
                new Game {
                    GameID = 5, GameName = "Game5", Company = "GameCompany5", Price = 45
                },
            };
            GameManager gameManager = new GameManager();

            foreach (var game in games)
            {
                gameManager.Add(game);
            }

            List <Order> orders = new List <Order>()
            {
                new Order(discounts[1].DiscountRate, games[1].Price)
                {
                    OrderID = 1, GameId = 2, GamerId = 1, Game = games[2], Gamer = gamer
                },
                new Order(discounts[2].DiscountRate, games[2].Price)
                {
                    OrderID = 2, GameId = 2, GamerId = 1, Game = games[2], Gamer = gamer
                },
                new Order(discounts[3].DiscountRate, games[4].Price)
                {
                    OrderID = 3, GameId = 4, GamerId = 1, Game = games[4], Gamer = gamer
                },
            };
            OrderManager orderManager = new OrderManager();

            foreach (var order in orders)
            {
                orderManager.Add(order);
            }
            orderManager.Delete(orders[1]);

            Console.ReadKey();
        }