static void Main(string[] args) { ILoggerService fileLogger = new FileLoggerService(); ILoggerService databaseLogger = new DatabaseLoggerService(); IValidateService mernisValidateService = new MernisValidateService(); IEntityService userManager = new UserManager(new List <ILoggerService> { databaseLogger, fileLogger }, new List <IValidateService> { mernisValidateService }); IEntity batuhan = new User { NickName = "Likeafear", NationalityId = "12345678901", Name = "Batuhan ", LastName = "Tengilimoğlu", YearOfBirth = 1998, Balance = 1000 }; IEntity oguzhan = new User { NickName = "Aeston", NationalityId = "12345678902", Name = "Oğuzhan ", LastName = "Tengilimoğlu", YearOfBirth = 1992, Balance = 5000 }; IEntity ugur = new User { NickName = "Halfrime", NationalityId = "12345678903", Name = "Uğur ", LastName = "Yağbasan", YearOfBirth = 1998, Balance = 800 }; Console.WriteLine("\n***kullanıcı ekleme silme güncelleme***"); userManager.Add(batuhan); userManager.Delete(oguzhan); userManager.Update(ugur); IEntity gow = new Game() { Id = 1, Name = "God Of War", Price = 199.90, Publisher = "Sony Interactive Entertainment" }; IEntity rdr2 = new Game() { Id = 2, Name = "Red Dead Redemption 2", Price = 300, Publisher = "Rockstar Games" }; IEntity lof2 = new Game() { Id = 3, Name = "Last Of Us Pt2", Price = 369.90, Publisher = "Sony Interactive Entertainment" }; IEntity steam_platform = new Platform() { Name = " Steam Platformunda" }; IEntity epicGames_platform = new Platform() { Name = " Epic Games Platformunda" }; Console.WriteLine("\n***Oyuncu tarafından oyun ekleme silme güncelleme***"); IEntityService gameManager = new GameManager(new List <ILoggerService> { databaseLogger }); gameManager.Add(gow); gameManager.Delete(rdr2); gameManager.Update(lof2); ISaleService cadilarBayramiIndirimi = new HalloweenSaleManager(); ISaleService gunlukIndirimler = new DailySaleManager(); ISaleService yazIndirimi = new SummerSaleManager(); IPlatformService steam = new SteamPlatformManager(new List <ISaleService> { }); IPlatformService epic_games = new EpicGamesPlatformManager(new List <ISaleService> { yazIndirimi, gunlukIndirimler, cadilarBayramiIndirimi }); Console.WriteLine("\n***Satın alma ve iade etme***"); steam.Buy(batuhan, gow); steam.Refund(oguzhan, rdr2); epic_games.Buy(ugur, rdr2); epic_games.Refund(batuhan, lof2); Console.WriteLine("\n***Platform indirimleri***"); cadilarBayramiIndirimi.Sale(gow, steam_platform); gunlukIndirimler.Sale(rdr2, epicGames_platform); yazIndirimi.Sale(lof2, steam_platform); Console.WriteLine("\n***indirimde satın alma***"); steam.BuyFromSale(steam_platform, batuhan, gow); epic_games.BuyFromSale(epicGames_platform, ugur, rdr2); steam.BuyFromSale(steam_platform, oguzhan, lof2); }
static void Main(string[] args) { ILoggerService fileLogger = new FileLoggerService(); ILoggerService databaseLogger = new DatabaseLoggerService(); IValidateService mernisValidateService = new MernisValidateService(); IEntityService playerManager = new PlayerManager(new List <ILoggerService> { databaseLogger, fileLogger }, new List <IValidateService> { mernisValidateService }); Person enginHoca = new Player() { NationalityNumber = "00000000000", Name = "Engin", LastName = "Demiroğ", YearOfBirth = 1985, Balance = 4000 }; Person poyraz = new Player() { NationalityNumber = "11111111111", Name = "Poyraz", LastName = "Aktaş", YearOfBirth = 2000, Balance = 1500 }; Person ayaz = new Player() { NationalityNumber = "22222222222", Name = "A", LastName = "Aktaş", YearOfBirth = 2003, Balance = 99999 }; Person mert = new Player() { NationalityNumber = "33333333333", Name = "Mert", LastName = "Özcan", YearOfBirth = 2000, Balance = 2200 }; playerManager.Add(enginHoca); playerManager.Add(poyraz); playerManager.Add(ayaz); playerManager.Add(mert); IEntity gta5 = new Game() { Id = 1, Name = "GTA 5", Publisher = "Rockstar Games", UnitPrice = 140.50 }; IEntity wow = new Game() { Id = 2, Name = "World of Warcraft", Publisher = "Blizzard", UnitPrice = 2000 }; IEntity cyberpunk = new Game() { Id = 3, Name = "Cyberpunk 2077", Publisher = "CD Projekt Red ", UnitPrice = 239.99 }; IEntityService gameManager = new GameManager(new List <ILoggerService> { databaseLogger }); gameManager.Add(gta5); gameManager.Add(wow); gameManager.Add(cyberpunk); ISalesService yaz_indirimi = new SummerSalesManager(); ISalesService karaCuma_indirimi = new BlackFridaySalesManager(); ISalesService yilbasi_indirimi = new NewYearSalesManager(); ISalesService haftasonu_indirimi = new WeekendSalesManager(); IPlatformService steam = new SteamPlatformManager(new List <ISalesService> { }); IPlatformService epic_games = new EpicGamesPlatformManager(new List <ISalesService> { karaCuma_indirimi, haftasonu_indirimi }); steam.BuyGame(poyraz, gta5); epic_games.BuyGame(enginHoca, cyberpunk); steam.ToRefund(poyraz, gta5); epic_games.BuyGame(poyraz, gta5); }
public static void Main(string[] args) { ILoggerService logger = null; IAlgorithm algorithm = null; //Read file Console.WriteLine("Please provide a file name:"); var fileName = Console.ReadLine(); if (String.IsNullOrEmpty(fileName)) { Console.WriteLine("Please provide a file name."); return; } if (!File.Exists(fileName)) { Console.WriteLine($"File {fileName} is not found."); Console.ReadKey(); return; } var(rules, facts, goal) = ReadFromFile(fileName); //Choose output method Console.WriteLine("Please choose output method by typing:"); Console.WriteLine("1. Console"); Console.WriteLine("2. File"); var outputSelection = Convert.ToChar(Console.ReadLine()); if (outputSelection != '1' && outputSelection != '2') { Console.WriteLine($"{outputSelection} is not a valid output method. Please try again."); Console.ReadKey(); return; } switch (outputSelection) { case '1': logger = new ConsoleLoggerService(); break; case '2': Console.WriteLine("Please provide output file name:"); var outputFileName = Console.ReadLine(); if (String.IsNullOrEmpty(outputFileName)) { Console.WriteLine("Please provide a file name."); return; } logger = new FileLoggerService(outputFileName); break; } //Choose algorithm Console.WriteLine("Please choose the algorithm:"); Console.WriteLine("1. Forwards chaining"); Console.WriteLine("2. Backwards chaining"); var algorithmSelection = Convert.ToChar(Console.ReadLine()); if (algorithmSelection != '1' && algorithmSelection != '2') { Console.WriteLine($"{algorithmSelection} is not a algorithm. Please try again."); Console.ReadKey(); return; } switch (algorithmSelection) { case '1': algorithm = new ForwardsChainingAlgorithm(rules, facts, goal, logger); break; case '2': algorithm = new BackwardsChainingAlgorithm(rules, facts, goal, logger); break; } //Execute algorithm.Execute(); algorithm.Dispose(); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }