static void Main(string[] args) { Player player1 = new Player { Id = 1, Firstname = "Serhan", Lastname = "Altuğ", BirthDate = new System.DateTime(1977, 06, 04), NationalIdentity = "27706387112" }; Player player2 = new Player { Id = 2, Firstname = "Engin", Lastname = "Demiroğ", BirthDate = new System.DateTime(1985, 01, 06), NationalIdentity = "1234567810" }; Player player3 = new Player { Id = 3, Firstname = "Zeynep", Lastname = "", BirthDate = new System.DateTime(2012, 05, 08), NationalIdentity = "1234567810" }; IPlayerManager playerManager = new PlayerManager(new MernisServiceAdapter()); playerManager.Add(player1); playerManager.Add(player2); playerManager.Add(player3); player1.NationalIdentity = "12345678910"; playerManager.Update(player1); playerManager.Delete(player2); Console.WriteLine("_____________________________________________________"); Campaign campaign1 = new Campaign { Id = 1, CampaignName = "Campaign 1 - Buy one, get one for free." }; Campaign campaign2 = new Campaign { Id = 2, CampaignName = "Campaign 2 - Save %20 in your next order." }; ICampaignManager campaignManager = new CampaignManager(); campaignManager.Add(campaign1); campaignManager.Add(campaign2); campaign2.CampaignName = "Campaign 2 (Updated) - Save %25 in your next order."; campaignManager.Update(campaign2); campaignManager.Delete(campaign1); Console.WriteLine("_____________________________________________________"); ISalesManager salesManager = new SalesManager(); salesManager.Buy(player1); //Kampanya 1 silinmişti ancak listeden kontrol etmediğimiz için bir alt satırda satışa ekleyebiliyoruz. salesManager.AddCampaign(campaign1); salesManager.AddCampaign(campaign2); salesManager.Buy(player2); }
static void Main(string[] args) { Customer customer1 = new Customer { Id = 1, FirstName = "isa", LastName = "yavuz", DateOfBirth = new DateTime(1995, 1, 1), NationalityId = "123456789" }; Game game1 = new Game { Id = 1, NameOfTheGame = "ETS2", Category = "simulator", Price = 200, ReleaseDate = new DateTime(2012, 1, 1) }; Game game2 = new Game { Id = 2, NameOfTheGame = "word of tanks", Category = "warfare", Price = 450, ReleaseDate = new DateTime(2015, 1, 1) }; Campaign campaign1 = new Campaign { Id = 1, CampingName = "İlkbahar indirimleri", Discount = 14, CampaignStartDate = new DateTime(2021, 3, 20), ExpiryTime = new DateTime(2021, 6, 21) }; CustomerManager managerDal = new CustomerManager(new CustomerValidationManager()); SalesManager salesManager1 = new SalesManager(); CampaignManager campaignManager1 = new CampaignManager(); managerDal.Add(customer1); managerDal.Delete(customer1); campaignManager1.Add(campaign1); salesManager1.Buy(customer1, game2); salesManager1.BuyCampaign(customer1, game1, campaign1); Console.ReadLine(); }
static void Main(string[] args) { ILoggerService fileLogger = new FileLogger(); ILoggerService dataBaseLogger = new DataBaseLogger(); ICheckIfRealPersonService checkIfRealPersonService = new MernisServiceAdapter(); IPersonService personManager = new PersonManager( new List <ILoggerService> { dataBaseLogger, fileLogger }, new List <ICheckIfRealPersonService> { checkIfRealPersonService } ); Game battlefield4 = new Game() { Id = 1, Name = "Battlefield 4 Premium", Price = Convert.ToDouble(450) }; Game overwatch = new Game() { Id = 2, Name = "Overwatch", Price = Convert.ToDouble(600) }; Person salih = new Person() { Id = 3, FirstName = "Mehmet", LastName = "Duruk", NaturalId = 28765512118, NickName = "TheSensei", YearOfBirth = 199826 }; personManager.Add(salih); ICampaignService newRegistrationCampaign = new NewRegistrationDiscount(); ICampaignService newYearCampaign = new NewYearDiscount(); ISalesService salesService = new SalesManager(new List <ICampaignService> { newRegistrationCampaign, newYearCampaign }); salesService.Buy(salih, battlefield4); salesService.Refund(salih, overwatch); }
static void Main(string[] args) { //classlardan instancelar olusturuluyor. PersonConcrete person = new Person() { Id = 1, FirstName = "Ertugrul", LastName = "Ozdemir", IdentityNumber = "11111111111", DateofBirth = DateTime.Now }; GameConcrete game = new Game() { Id = 1, Name = "Pubg", CategoryName = "Aksiyon", Price = 50.0 }; CampaignConcrete campaign = new Campaing() { Id = 1, Name = "Koronanin allah belasini versin indirimleri", DiscountRate = 50 }; //Yeni bir kullanici eklendi. IManager manager = new PersonManager(person, new PersonCheckManager()); manager.Add(); manager.Delete(); manager.Update(); manager.Select(); //Yeni bir kampanya eklendi. IManager manager1 = new CampaignManager(campaign); manager1.Add(); manager1.Delete(); manager1.Update(); manager1.Select(); //Kullanici Indirimsiz satin alma yapiyor. ISalesManager salesManager = new SalesManager(person, game); salesManager.Buy(); //Kullanici Indirimli satin alma yapiyor. ISalesManager salesManager2 = new SalesManager(person, game, campaign); salesManager2.Buy(); }