예제 #1
0
        static void Main(string[] args)
        {
            CustomerManager customerManager = new CustomerManager(new UserValidationManager());

            customerManager.Add(new Customer
            {
                FirstName      = "Muharrem",
                LastName       = "Candan",
                DateOfBirth    = 2001,
                Id             = 1,
                IdentityNumber = 123123123
            });

            Customer customer = new Customer();

            customer.FirstName      = "Muharrem";
            customer.LastName       = "Candan";
            customer.Id             = 1;
            customer.IdentityNumber = 123123123;

            Games game = new Games();

            game.Id    = 1;
            game.Name  = "The Last Day Of The World";
            game.Price = 125;

            Campaign campaign = new Campaign();

            campaign.CampaignId    = 1;
            campaign.CampaignName  = "Christmas Campaign";
            campaign.CampaignPrice = 50;

            Console.WriteLine("Dear " + customer.FirstName + " , you got  " + campaign.CampaignName + ", you have %" + campaign.CampaignPrice + " discount at this game " + game.Name);

            CampaignManger campaignManger = new CampaignManger();

            campaignManger.Add(campaign);

            GamesManager gamesManager = new GamesManager();

            gamesManager.Add(game);
        }
예제 #2
0
        static void Main(string[] args)
        {
            CustomerManager customerManager = new CustomerManager(new CustomerCheckManager());
            Customer        customer1       = new Customer {
                Id = 1, FirstName = "Yakup", LastName = "Sayın", DateOfBirth = new DateTime(1990, 1, 10)
            };

            customerManager.Add(customer1);
            customerManager.Update(customer1);
            customerManager.Delete(customer1);

            Console.WriteLine();

            GamesManager gameManager = new GamesManager();
            Game         game1       = new Game {
                Name = "Grand Theft Auto V", Studio = "Rockstar Games", Price = 60
            };

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

            Console.WriteLine();

            Campaign campaign1 = new Campaign {
                Name = "PROMO30", Discount = 30
            };
            CampaignManager campaignManager = new CampaignManager();

            campaignManager.Add(campaign1);
            campaignManager.Update(campaign1);
            campaignManager.Delete(campaign1);

            Console.WriteLine();

            SalesManager salesManager = new SalesManager();

            salesManager.Sell(customer1, game1, campaign1);
        }
예제 #3
0
        private static Game GetOrAddGame(DateTime date, Team team1, Team team2)
        {
            var manager = new GamesManager();
            var game    = manager.GetByTeamsAndDate(team1, team2, date) ?? manager.GetByTeamsAndDate(team2, team1, date);

            if (game == null)
            {
                // Check if game exists but one of the team names is different
                game = manager.GetByHomeTeamAndDate(team1, date);
                if (game != null)
                {
                    SetPossibleNameIfNeeded(game.AwayTeamId, team2);
                }
                else
                {
                    game = manager.GetByAwayTeamAndDate(team2, date);
                    if (game != null)
                    {
                        SetPossibleNameIfNeeded(game.HomeTeamId, team1);
                    }
                    else
                    {
                        game = new Game()
                        {
                            HomeTeamId     = team1.Id,
                            AwayTeamId     = team2.Id,
                            Date           = date,
                            GameSiteRatios = new List <GameSiteRatio>()
                        };
                        manager.Add(game);
                    }
                }
            }

            return(game);
        }