示例#1
0
        //interfaceleri birbirinin alternatifi olan ama kod içerikleri farklı olan durumlar için kullanırız. İmzaları aynı.
        //Yapılan işlemler loglamadır. SMS yollama, veritabanına yazma gibi şeyler loglama.
        static void Main(string[] args)
        {
            ICreditManager personalFinanceCreditManager = new PersonalFinanceCreditManager();
            ICreditManager vehicleCreditManager         = new VehicleCreditManager();
            ICreditManager housingCreditManager         = new HousingCreditManager();
            ICreditManager esnafKrediManager            = new EsnafKrediManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService fileLoggerService     = new FileLoggerService();
            ILoggerService smsLoggerService      = new SmsLoggerService();

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.BasvuruYap(esnafKrediManager, new List <ILoggerService> {
                new DatabaseLoggerService(), new SmsLoggerService()
            });

            //line 22'de parantez içinde new list oluşturmak yerine aşağıdaki alternatifi de kullanabilirsin:
            //List<ILoggerService> logger = new List<ILoggerService>() {new SmsLoggerService(), new DatabaseLoggerService() };
            //yukarıdaki kodu yazdıktan sonra line 22'deki kod aşağıdaki gibi olacak:
            //recourseManager.BasvuruYap(esnafKrediManager, loggers);

            List <ICreditManager> krediler = new List <ICreditManager>()
            {
                personalFinanceCreditManager, vehicleCreditManager
            };

            //recourseManager.KrediOnBilgilendirmesiYap(krediler);
        }
示例#2
0
        private static void Main(string[] args)
        {
            ICreditService financeCreditManager = new FinanceLoanManager();
            ICreditService vehicleLoanManager   = new VehicleLoanManager();
            ICreditService mortgageLoanManager  = new MortgageLoanManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService fileLoggerService     = new FileLoggerService();

            List <ILoggerService> loggers = new List <ILoggerService> {
                new SmsLoggerService(), new FileLoggerService()
            };                                                                                                           //new SmsLoggerService(), new FileLoggerService()


            RecourseManager recourseManager = new RecourseManager();

            recourseManager.RecourseToLoan(new MortgageLoanManager(), loggers);

            List <ICreditService> creditServices = new List <ICreditService>()
            {
                financeCreditManager, vehicleLoanManager
            };

            recourseManager.LoanPreliminaryInformation(creditServices);


            Console.ReadLine();
        }
示例#3
0
文件: Program.cs 项目: TR-Emin/Kamp
        static void Main(string[] args)
        {
            ICreditManager needCreditManager      = new NeedCreditManager();
            ICreditManager vehicleCreditManager   = new VehicleCreditManager();
            ICreditManager housingCreditManager   = new HousingCreditManager();
            ICreditManager tradesmanCreditManager = new TradesmanCreditManager();

            ILoggerService fileLoggerService     = new FileLoggerService();
            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService smsLoggerService      = new SmsLoggerService();

            List <ILoggerService> loggers = new List <ILoggerService> {
                fileLoggerService, databaseLoggerService, smsLoggerService
            };

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.DoRecourse(tradesmanCreditManager, loggers);

            List <ICreditManager> credits = new List <ICreditManager>()
            {
                needCreditManager, vehicleCreditManager
            };
            //recourseManager.CreditGivePreliminaryInformation(credits);
        }
示例#4
0
        static void Main(string[] args)
        {
            //PersonalFinanceCreditManager personalFinanceCreditManager = new PersonalFinanceCreditManager();
            //personalFinanceCreditManager.Calculate();

            //TransportCreditManager transportCreditManager = new TransportCreditManager();
            //transportCreditManager.Calculate();

            //MortageLoanManager mortageLoanManager = new MortageLoanManager();
            //mortageLoanManager.Calculate();


            // Interface lerde imlemente edildiği Clasın referans numarasını tutar.
            // Yukarıda ki kullanımda doğru  aşağıdaki kullanımda


            ICreditManager personalFinanceCreditManager = new PersonalFinanceCreditManager();
            ICreditManager transportCreditManager       = new TransportCreditManager();
            ICreditManager mortageLoanManager           = new MortageLoanManager();
            ILoggerService dataLoggerService            = new DatabaseLoggerService();
            ILoggerService filLoggerService             = new FileLoggerService();

            // şimdi çok güzel bir şekilde yapı kurduk istersek kodumuzu hiç değiştirmeden sadece class ekleyip yeni kredi türleri ve loglama işlemi yapabiliriz.
            // SOLID kurallarının O kısmı bu
            ICreditManager tradesmanLoanManager = new TradesmanLoanManager();
            ILoggerService smsLoggerService     = new SmsLoggerService();

            // ***** interfaceleri biribirinin alternatifi olan ama kod içerikleri farklı olan içerikler için kullanırız.
            // projemizde loglama yapmak istiyoruz. Loglama:Kim ne zaman hangi operasyonu çağırdı.
            // Loglarımızı bir dosyada tutabiliriz
            // loglarımızı veri tabanında tutabiliriz.
            // loglarımızı sms olarakta atabiliriz vb şeyler.
            // İstenebilir hepsi aynı şeyi loglamayı yapıyor ama farklı işlemler yani interface kullanırız.
            // bizden 1 tanesi bile istense interface kullanmamız lazım ileride değişiklik istediğini düşün
            // müşterinin interfacesiz yaparsan bütün sistemin gidebilir tekrar uğraşırsın

            List <ILoggerService> loggerServices = new List <ILoggerService>()
            {
                new DatabaseLoggerService(),
                new SmsLoggerService()
            };

            List <ICreditManager> creditManagers = new List <ICreditManager>()
            {
                new PersonalFinanceCreditManager(),
                new TransportCreditManager()
            };
            // recourseManager.KrediOnBilgilendirmesiYap(creditManagers);


            RecourseManager recourseManager = new RecourseManager();

            recourseManager.BasvuruYap(tradesmanLoanManager, loggerServices);

            // Senaryomuz şu bir müşteririmiz var bankaya kredi çekmeye gidiyor araba kredisi çekicek bankacı soruyor taşıt kredisimi istersiniz yoksa ihtiyaç kredisimi diye
            // şimdi tek kredi hesaplama yapabiliyoruz ama burda 2 tane kredi aynı anda istendi bu yüzden aşağıdki işlemi yapıyoruz.
            // 2 değil 100 de istenebilir 1000 de vb. bu yüzden herşeyi düşünerek yazılması lazım
            // aşağıdaki mantık bi liste ytanımladık içine Bizim kredilerin babası sayılan ICreditManager ı attık yani istediğimiz bütün kredileri kolaylıkla çağırabiliriz.
            // sonrada RecourseManagerda yazdığımız fonksiyonumuzu çağırdık bu fonksiyonda da parametre olarak list ICreditManager verdik böylece bütün kredileri çağırabilmemizi sağladık.
        }
示例#5
0
        static void Main(string[] args)
        {
            ICreditManager personalFinanceCreditManager = new PersonalFinanceCreditManager();
            ICreditManager transportCreditManager       = new TransportCreditManager();
            ICreditManager mortgageLoanCreditManager    = new MortgageLoanCreditManager();
            ICreditManager artisanLoanCreditManager     = new ArtisanLoanCreditManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService fileLoggerService     = new FileLoggerService();
            ILoggerService smsloggerService      = new SmsLoggerService();

            List <ILoggerService> logger = new List <ILoggerService>()
            {
                databaseLoggerService, smsloggerService
            };

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.ToApply(transportCreditManager, new List <ILoggerService> {
                fileLoggerService
            });
            Console.WriteLine("------------------------------------");
            recourseManager.ToApply(artisanLoanCreditManager, logger);

            List <ICreditManager> credits = new List <ICreditManager>()
            {
                personalFinanceCreditManager, transportCreditManager
            };

            //recourseManager.CreditPreNotification(credits);
        }
示例#6
0
文件: Program.cs 项目: kurtbar07/Kamp
        static void Main(string[] args)
        {
            /*NeedCreditManager needCreditManager = new NeedCreditManager();
             * ICreditManager needCreditManager = new NeedCreditManager();
             * needCreditManager.Calculate();
             *
             * VehicleCreditManager vehicleCreditManager = new VehicleCreditManager();
             * ICreditManager vehicleCreditManager = new VehicleCreditManager();
             * vehicleCreditManager.Calculate();
             *
             * HomeCreditManager homeCreditManager = new HomeCreditManager();
             * ICreditManager homeCreditManager = new HomeCreditManager();
             * homeCreditManager.Calculate(); */

            ICreditManager needCreditManager    = new NeedCreditManager();
            ICreditManager vehicleCreditManager = new VehicleCreditManager();
            ICreditManager homeCreditManager    = new HomeCreditManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService fileLoggerService     = new FileLoggerService();

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.DoRecourse(homeCreditManager, new DatabaseLoggerService()); // direk method içindede newlenebilir

            List <ICreditManager> credits = new List <ICreditManager>()
            {
                homeCreditManager, needCreditManager
            };
            //recourseManager.CreditPreliminaryİnformation(credits);
        }
示例#7
0
        static void Main(string[] args)
        {
            ICreditManager ihtiyacKrediManager = new PersonalFinanceCreditManager();
            ICreditManager tasitKrediManager   = new VehicleCreditManager();
            ICreditManager konutKrediManager   = new HousingCreditManager();

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.Recource(tasitKrediManager, new FileLoggerManager());

            IList <ICreditManager> creditManagers = new List <ICreditManager>()
            {
                ihtiyacKrediManager,
                konutKrediManager
            };

            recourseManager.MakeCreditPreNotification(creditManagers);
        }
示例#8
0
        static void Main(string[] args)
        {
            RequirementLoanManager requirementLoanManager = new RequirementLoanManager();
            VehicleLoanManager     vehicleLoanManager     = new VehicleLoanManager();
            MortgageLoanManager    mortgageLoanManager    = new MortgageLoanManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            ILoggerService fileLoggerService     = new FileLoggerService();

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.MakeAnApplication(mortgageLoanManager, databaseLoggerService);  //It calculates whatever loan is sent from the RecourseManager

            List <ICreditManager> credits = new List <ICreditManager>()
            {
                requirementLoanManager, vehicleLoanManager
            };
            //recourseManager.DoCreditPreinformation(credits);
        }
示例#9
0
        static void Main(string[] args)
        {
            ICrediManager needCreditManager    = new NeedCreditManager();
            ICrediManager vehicleCreditManager = new VehicleCreditManager();
            ICrediManager housingCrediManager  = new HousingCrediManager();

            IloggerService databaseLoggerService = new DatabaseLoggerService();
            IloggerService fileLoggerService     = new FileLoggerService();


            RecourseManager recourseManager = new RecourseManager();

            recourseManager.BasvuruYap(needCreditManager, databaseLoggerService);


            List <ICrediManager> krediler = new List <ICrediManager>()
            {
                needCreditManager, vehicleCreditManager
            };
            //recourseManager.KrediOnBilgilendirmesiYap(krediler);
        }
示例#10
0
        static void Main(string[] args)
        {
            ILoanManager personalFinanceLoan  = new PersonalFinanceLoan();
            ILoanManager vehicleLoanManager   = new VehicleLoanManager();
            ILoanManager housingLoanManager   = new HousingLoanManager();
            ILoanManager tradesmanLoanManager = new TradesmanLoanManager();

            ILoggerService databaseLoggerService = new DatabaseLoggerService();
            //veya 22. satir virgulden sonrasi gibi de yazabilirsin
            ILoggerService fileLoggerService = new FileLoggerService();
            ILoggerService smsLoggerService  = new SmsLoggerService();

            RecourseManager recourseManager = new RecourseManager();

            recourseManager.MakeRecourse(tradesmanLoanManager, smsLoggerService);

            List <ILoanManager> loans = new List <ILoanManager>()
            {
                personalFinanceLoan,
                vehicleLoanManager
            };

            //recourseManager.PreLoanInfo(loans);
        }