public void Add(Player player)
        {
            if (_playerCheckService.CheckIfRealPerson(player))
            {
                base.Add(player);
            }

            else
            {
                throw new Exception("Not a valid person!");
            }
        }
Exemple #2
0
 public void Save(Player player)
 {
     if (_mernisServiceAdapter.CheckIfRealPerson(player))
     {
         Console.WriteLine("oyuncu eklendi"); players.Add(player);
     }
     else
     {
         throw new Exception("Not a valid person");
     }
     Console.ReadLine();
 }
        //public IResult Update(int id)
        //{
        //    User user = _userDal.Get(u => u.Id == id);
        //    _userDal.Update(user);
        //    return new SuccessResult(Messages.Updated(user));
        //}

        IResult CheckIfRealPerson(User user)
        {
            MernisServiceAdapter mernisServiceAdapter = new MernisServiceAdapter();

            if (!mernisServiceAdapter.CheckIfRealPerson(user))
            {
                return(new ErrorResult(Messages.NotRealPerson));
            }
            return(new SuccessResult());
        }
        private static void MernisAdapterTest()
        {
            User user = new User()
            {
                FirstName = "Cengiz", LastName = "Kılıç", NationalId = "25684908800", DateOfBirth = new DateTime(1985, 7, 8), /*Password = "******",*/ Email = "*****@*****.**"
            };
            MernisServiceAdapter mernisServiceAdapter = new MernisServiceAdapter();
            var resaultt = mernisServiceAdapter.CheckIfRealPerson(user);

            Console.WriteLine(resaultt);
        }
 public void Add(Customer customer)
 {
     if (_mernisServiceAdapter.CheckIfRealPerson(customer) == true)
     {
         Console.WriteLine("Kayıt olma işlemi tamamlandı");
     }
     else
     {
         Console.WriteLine("Eksik veya hatalı işlem yaptınız");
     }
 }
Exemple #6
0
 public void Buy(Game game, Campaign campaign, Player player)
 {
     if (_mernisServiceAdapter.CheckIfRealPerson(player))
     {
         foreach (var item in _campaignManager.campaigns)
         {
             foreach (var item2 in games)
             {
                 if (campaign.Id == item.Id && game.Name == item2.Name)
                 {
                     Console.WriteLine(player.FirstName + " isimli oyuncu için " + game.Name + " oyununu satın aldınız \n" +
                                       "Ödemeniz kampanya dahilinde " + (item2.Price - (item2.Price * item.DiscountRate)) + " TL");
                 }
             }
         }
     }
     else
     {
         throw new Exception("Not a valid person");
     }
 }
Exemple #7
0
        static void Main(string[] args)
        {
            GamePlayer player1 = new GamePlayer {
                NationalityId = "2222222222", FirstName = "Uğur", LastName = "Çivgin", DateOfBirth = 1994
            };
            GamePlayer player2 = new GamePlayer {
                NationalityId = "3333333333", FirstName = "sait", LastName = "Çivgin", DateOfBirth = 2010
            };

            Game game1 = new Game {
                GameName = "Hitman", GamePrice = 1500
            };
            Game game2 = new Game {
                GameName = "Soldier", GamePrice = 200
            };

            GameManager gameManager = new GameManager();

            gameManager.Add(game1);
            gameManager.Delete(game1);
            gameManager.Update(game1);

            GamePlayerManager gamePlayerManager = new GamePlayerManager();

            gamePlayerManager.Ekle(player1);
            gamePlayerManager.Delete(player1);
            gamePlayerManager.Update(player1);

            CampignManeger campignManeger = new CampignManeger();

            campignManeger.CalculateSale(game1);
            campignManeger.SaleInformation(game1);

            MernisServiceAdapter mernisServiceAdapter = new MernisServiceAdapter();

            mernisServiceAdapter.CheckIfRealPerson(player1);
        }
        static void Main(string[] args)
        {
            #region Information Etries
            Console.WriteLine("Nationality ID :");
            string nationalityID = Console.ReadLine();

            Console.WriteLine("Name:");
            string name = Console.ReadLine();

            Console.WriteLine("Last Name:");
            string lastName = Console.ReadLine();

            Console.WriteLine("Date of Birth:");
            DateTime dateofBirth = Convert.ToDateTime(Console.ReadLine());
            #endregion

            #region Customer Control Service

            Customer confirmedCustomer = new Customer
            {
                CustomerIdentityKey = nationalityID,
                CustomerName        = name.ToUpper(),
                CustomerLastName    = lastName.ToUpper(),
                DateofBirth         = dateofBirth
            };

            // KPSWebService
            IPersonCheckService checkService = new MernisServiceAdapter();
            checkService.CheckIfRealPerson(confirmedCustomer);

            // Manual Control
            //ICustomerCheckService checkService = new CustomerCheckService();
            //checkService.CustomerCheck(confirmedCustomer);

            #endregion

            #region Added Entities
            // Products
            Product product1 = new Product {
                ProductID = 1, ProductName = "Football Manager 2021", ProductUnitPrice = 24
            };
            Product product2 = new Product {
                ProductID = 2, ProductName = "FIFA 21", ProductUnitPrice = 44
            };
            Product product3 = new Product {
                ProductID = 3, ProductName = "Raccoon City Edition", ProductUnitPrice = 34
            };

            // Campaigns
            Campaign campaign1 = new Campaign {
                CampaignID = 10, CampaignName = "FIFA 21", LowerLimit = 0, DiscountRate = 0.3
            };
            Campaign campaign2 = new Campaign {
                CampaignID = 11, CampaignName = "Raccoon City Edition", LowerLimit = 0, DiscountRate = 0.12
            };
            Campaign campaign3 = new Campaign {
                CampaignID = 12, CampaignName = "November Discounts", LowerLimit = 200, DiscountRate = 0.3
            };

            //Customers / Gamers
            Customer customer1 = new Customer {
                CustomerID = 101, CustomerIdentityKey = "1111111", CustomerName = "Mehmet", CustomerLastName = "Akın", DateofBirth = new DateTime(2001, 1, 6)
            };
            Customer customer2 = new Customer {
                CustomerID = 102, CustomerIdentityKey = "2222222", CustomerName = "Zeynep", CustomerLastName = "Eren", DateofBirth = new DateTime(1997, 11, 26)
            };
            Customer customer3 = new Customer {
                CustomerID = 103, CustomerIdentityKey = "1111111", CustomerName = "Mehmet", CustomerLastName = "Akın", DateofBirth = new DateTime(1992, 5, 17)
            };
            #endregion

            #region Create Managers
            SalesManager    salesManager    = new SalesManager();
            CustomerManager customerManager = new CustomerManager();
            ProductManager  productManager  = new ProductManager();
            CampaignManager campaignManager = new CampaignManager();
            #endregion


            List <Product> productList = new List <Product> {
                product1, product2, product3
            };
            productManager.GetAll(productList);
            //salesManager.DiscountCalculate(product2, campaign3);
            //salesManager.DiscountCalculate(productList, campaign3);
            //customerManager.Add(customer3);
            //campaignManager.Update(campaign1);
            //productManager.Delete(product1);
        }