public void Initialize()
 {
     bank = new Bank();
     klient = bank.dodajKlienta(new Klient("Jon", "Doe"));
     rachunek = bank.DodajRachunekBankowy(klient);
     bank.Wykonaj(new Wplata(rachunek, new Pieniadze(10000)));
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Bank bank = new Bank("Bank", "Auditor");
            Contractor contractor;
            string name = "Contractor";
            Random rand = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);

            // all customers will be new
            for (int i = 0; i < 5000; ++i )
            {
                contractor = new Contractor(name + i.ToString());
                contractor.makeDeal(bank, rand.Next(0, 2000000));
            }

            // some of customers will be regular fair ones, some - unfair and some - new ones
            for (int i = 0; i < 6000; ++i)
            {
                contractor = new Contractor(name + i.ToString());
                contractor.makeDeal(bank, rand.Next(0, 2000000));
            }

            // compairing results
            bank.GetStatistics();

            Console.ReadKey();
        }
Exemplo n.º 3
0
        // non-static methods
        public void makeDeal(Bank bank, int amountOfMoney)
        {
            Random rand = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
            bool isFair;

            if (amountOfMoney >= 1000000)
            {
                // if the sum is pretty big contractor wants to make an unfair deal in 10 % of cases
                if (rand.Next(1, 10) % 10 == 0)
                {
                    isFair = false;
                }
                else
                {
                    isFair = true;
                }
            }
            else
            {
                // if the sum is not so big contractor wants to make an unfair deal in 20 % of cases
                if (rand.Next(1, 10) % 5 == 0)
                {
                    isFair = false;
                }
                else
                {
                    isFair = true;
                }
            }

            bank.addDeal(new Deal(this, amountOfMoney, isFair));
        }
Exemplo n.º 4
0
 public void Initialize()
 {
     bank = new Bank();
     klientA = bank.dodajKlienta(new Klient("Jon", "Doe"));
     klientB = bank.dodajKlienta(new Klient("Tyler", "Durden"));
     rachunekA = bank.DodajRachunekBankowy(klientA);
     rachunekB = bank.DodajRachunekBankowy(klientA);
     bank.Wykonaj(new Wplata(rachunekA, new Pieniadze(10000)));
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            // Stwórz bank oraz dodaj dwóch klientów
            Bank bank = new Bank();
            Klient krystian = bank.dodajKlienta(new Klient("Krystian", "Swidurski"));
            Klient pawel = bank.dodajKlienta(new Klient("Pawel", "Sudomir"));

            bank.WyswietlKlientow();

            // Stworz rachunki bankowe
            RachunekBankowy rachunekKrystiana = bank.DodajRachunekBankowy(krystian);
            RachunekDebetowy rachunekPawla = bank.DodajRachunekDebetowy(pawel, new Pieniadze(1000));

            // Wykonaj wplaty 1000 PLN na konto Krystiana i 1500 PLN na konto Pawła
            bank.Wykonaj(new Wplata(rachunekKrystiana, new Pieniadze(100000)));
            bank.Wykonaj(new Wyplata(rachunekKrystiana, new Pieniadze(150000))); // Nie powiedzie się i nie zapisze w historii
            bank.Wykonaj(new Wplata(rachunekPawla, new Pieniadze(150000)));

            // Utworz lokate dla Krystiana i wplac na nia 20 tys
            Lokata lokataKrystiana = bank.DodajLokate(krystian, DateTime.Now, 3);
            bank.Wykonaj(new Wplata(lokataKrystiana, new Pieniadze(2000000)));
            // Rozwiaz lokate przed jej uplywe - nie naliczy odsetek
            bank.Wykonaj(new RozwiazLokate(lokataKrystiana, rachunekKrystiana, DateTime.Now.AddDays(-1)));

            // Wykonaj raport na historii banku
            SredniaKwota sredniaOperacji = new SredniaKwota(Pieniadze.Waluty.PLN);
            GeneratorRaportow.Generuj(sredniaOperacji,bank.Historia);

            /*
             Suma:  1000 zł [wpłata na konto Krystiana]
                    1500 zł [wpłata na konto Pawła]
                   20000 zł [wpłata na lokate]
                   20000 zł [wypłata z lokaty]
                   20000 zł [wpłata na rachunek Krystiana]
                 = 62500 zł
             Ilość: 5
             Wynik: 15250 zł
             */
            Console.WriteLine("Raport dla banku. " + sredniaOperacji.Wynik());

            // Wykonaj ten sam raport ale na historii Krystiana
            SredniaKwota sredniaKrystiana = new SredniaKwota(Pieniadze.Waluty.PLN);
            GeneratorRaportow.Generuj(sredniaKrystiana, krystian);
            Console.WriteLine("Raport dla Krystiana. " + sredniaKrystiana.Wynik());

            // Wykonaj nowy raport dla Krystiana
            Console.WriteLine();
            RaportZPodsumowaniem raport = new RaportZPodsumowaniem(Pieniadze.Waluty.PLN);
            GeneratorRaportow.Generuj(raport, krystian);
            Console.WriteLine(raport.Wynik());

            Console.ReadLine();
        }
Exemplo n.º 6
0
        public void PrzyjmijPrzelewy(Bank bank, PaczkaPrzelewow paczka)
        {
            paczka.ustawBank(bank);
            // Przejrzyj paczke otrzymana z banku i dodaj do odpowiednich list
            foreach (var przelew in paczka.Przelewy)
            {
                Bank bankDocelowy = okreslBank(przelew.id);
                if (bankDocelowy == null)
                    throw new NullReferenceException("Nieznany bank");

                przelewyWychodzace[bankDocelowy].Dodaj(przelew);
            }
        }
Exemplo n.º 7
0
        private static Bank LoadAccounts()
        {
            Bank bank = new Bank();

            bank.AddAccount(new MortgageAccount(new Individual("Another name"), 50000.0m, 25));
            bank.AddAccount(new DepositAccount(new Company("Company"), 7500.0m, 12));
            bank.AddAccount(new LoanAccount(new Company("'notherCompany"), 175000.0m, 22));
            bank.AddAccount(new MortgageAccount(new Individual("Poor Guy"), 30500.0m, 50));
            bank.AddAccount(new DepositAccount(new Company("McCompany"), 12450.0m, 13));
            bank.AddAccount(new LoanAccount(new Individual("Freddy"), 129.0m, 2));

            return bank;
        }
Exemplo n.º 8
0
        public PrzelewZewnetrzny(RachunekBankowy rachunek, int rachunekDocelowy, Pieniadze pieniadze, Bank bank)
        {
            this.rachunek = rachunek;
            this.rachunekDocelowy = rachunekDocelowy;
            this.bank = bank;

            p = new PrzelewanePieniadze
            {
                id = rachunekDocelowy,
                pieniadze = pieniadze
            };

            operacja = new Wyplata(rachunek, pieniadze);
        }
Exemplo n.º 9
0
        public void Initialize()
        {
            kir = new KIR();

            klient1 = new Klient("Jon", "Doe");
            klient2 = new Klient("Jan", "Nowak");

            bankA = new Bank(1); // Bank posiada rachunki zaczynajace się od 1 np. 10000 - 19999
            bankB = new Bank(5); // Bank posiada rachunki zaczynajace się od 1 np. 50000 - 59999

            rachunekA = bankA.DodajRachunekBankowy(klient1, 10001);
            rachunekB = bankB.DodajRachunekBankowy(klient2, 55555);

            bankA.Wykonaj(new Wplata(rachunekA, new Pieniadze(10000)));
            bankB.Wykonaj(new Wplata(rachunekB, new Pieniadze(20000)));
        }
Exemplo n.º 10
0
        static void Main()
        {
            IKernel kernel = new StandardKernel();

            kernel.Bind <ICurrencyConverter>().To <CurrencyConverter>();
            kernel.Bind <IPerson>().To <Person>();
            kernel.Bind <IAccount>().To <AccountVip>();

            var bank = new Bank.Bank(kernel.Get <ICurrencyConverter>());
            var card = new CreditCard(kernel.Get <IAccount>());

            //Visitor
            List <Account> accounts = new List <Account>()
            {
                new AccountVip(kernel.Get <IPerson>())
                {
                    State = 15
                },
                new AccountRegular(kernel.Get <IPerson>())
                {
                    State = 16
                }
            };

            var visitor = new AccountInfoGeneratorVisitor();

            Console.WriteLine(visitor.GetInfos(accounts));



            //Chain of responsibility
            OperationHandler handler1 = new OperationAmountHandler();
            OperationHandler handler2 = new OperationGreaterThanZeroHandler();

            handler1.SetSuccessor(handler2);

            int[] amounts = new int[] { -5, 10, 20, 20001 };

            foreach (var amount in amounts)
            {
                handler1.HandleRequest(amount);
            }

            Console.ReadKey();
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            List<Account> accounts = new List<Account>
            {
                new DepositAccount(new Individual("Petar Petrov"), 1000,0.02),
                new DepositAccount(new Company("CompanyLTD"), 15000,0.02),
                new DepositAccount(new Individual("Maria Petrova"), 1500,0.05),
                new MortgageAccount(new Company("CompanyLTD"), 50000,0.04),
                new MortgageAccount(new Individual("Maria Petrova"), 35000,0.06),
                new LoanAccount(new Company("CompanyLTD"), 7000,0.08),
                new DepositAccount(new Individual("Maria Petrova"), 1500,0.0012),
            };

            Bank Investbank = new Bank(accounts);

            MortgageAccount testPersonalAccount = new MortgageAccount(new Individual("Marcheto"), 1200, 0.02);
            Console.WriteLine(testPersonalAccount.CalculateInterest(24));
        }
Exemplo n.º 12
0
        static void Main()
        {
            Bank SGC = new Bank("Societe General Express Bank");
            SGC.AddAccount(
                new LoanAccount(new IndividualCustomer("Svetlin Nakov"), DateTime.Now, 1500, 0.4M),
                new LoanAccount(new IndividualCustomer("George Georgiev"), new DateTime(2012, 12, 30), 2500, 1M),
                new LoanAccount(new IndividualCustomer("Nikolay Kostov"), new DateTime(2011, 12, 30), 1500, 0.1M),
                new MortgageAccount(new IndividualCustomer("Doncho Minkov"), new DateTime(2012, 2, 2), 4500, 0.11M),
                new DepositAccount(new IndividualCustomer("Lyubomir Qnchev"), new DateTime(2013, 1, 1), 1500, 0.1M),
                new LoanAccount(new CompanyCustomer("Telerik crop."), DateTime.Now, 1500, 0.21M),
                new DepositAccount(new CompanyCustomer("Telerik"), new DateTime(2012, 12, 30), 2500, 0.11M),
                new LoanAccount(new CompanyCustomer("VM ware"), new DateTime(2013, 1, 1), 1500, 0.21M),
                new MortgageAccount(new CompanyCustomer("Musala soft"), new DateTime(2011, 2, 2), 4500, 0.11M),
                new LoanAccount(new CompanyCustomer("HP"), new DateTime(2003, 1, 1), 1500, 0.37M)
                );

            Console.WriteLine("Bank: " + SGC.Name);
            foreach (Account acc in SGC.Accounts)
            {
                Console.WriteLine(acc);
                Console.WriteLine("Interest = " + acc.CalculateInterest() + "%");
                Console.WriteLine(new string('-', 40));
            }
        }
Exemplo n.º 13
0
 public Ice.AsyncResult<Bank.Callback_BankManager_createAccount> begin_createAccount(Bank.PersonalData data, Bank.accountType type, _System.Collections.Generic.Dictionary<string, string> ctx__)
 {
     return begin_createAccount(data, type, ctx__, true, null, null);
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            Bank.Bank bank = new Bank.Bank();

            Console.WriteLine( bank.Login(1000, 1234));
        }
Exemplo n.º 15
0
 public Ice.AsyncResult begin_createAccount(Bank.PersonalData data, Bank.accountType type, Ice.AsyncCallback cb__, object cookie__)
 {
     return begin_createAccount(data, type, null, false, cb__, cookie__);
 }
Exemplo n.º 16
0
 public void createAccount(Bank.PersonalData data, Bank.accountType type, out string accountID, _System.Collections.Generic.Dictionary<string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("createAccount", Ice.OperationMode.Normal, context__, observer__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.startWriteParams(Ice.FormatType.DefaultFormat);
             if(data == null)
             {
                 Bank.PersonalData tmp__ = new Bank.PersonalData();
                 tmp__.write__(os__);
             }
             else
             {
                 data.write__(os__);
             }
             os__.writeEnum((int)type, 1);
             og__.endWriteParams();
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(Bank.IncorrectData)
                 {
                     throw;
                 }
                 catch(Bank.RequestRejected)
                 {
                     throw;
                 }
                 catch(Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.startReadParams();
             accountID = is__.readString();
             og__.endReadParams();
         }
         catch(Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Exemplo n.º 17
0
 public Ice.AsyncResult begin_createAccount(Bank.PersonalData data, Bank.accountType type, _System.Collections.Generic.Dictionary<string, string> ctx__, Ice.AsyncCallback cb__, object cookie__)
 {
     return begin_createAccount(data, type, ctx__, true, cb__, cookie__);
 }
Exemplo n.º 18
0
 public Ice.AsyncResult<Bank.Callback_BankManager_createAccount> begin_createAccount(Bank.PersonalData data, Bank.accountType type)
 {
     return begin_createAccount(data, type, null, false, null, null);
 }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            User    ActiveUser;
            Account ActiveAcc;
            int     CaseSwitch;
            Bank    SkokStefczyka = new Bank("Skok Stefczyka");
            Bank    ActiveBank    = SkokStefczyka;
            Admin   Patryk        = new Admin("Patryk", "Cieszyński", "pciesz", "ytrewq", SkokStefczyka);
            User    Jan           = new User("Jan", "Nowak", "jnowak123", "qwerty", SkokStefczyka);

            //Logowanie
            do
            {
                for (; ;)
                {
                    Console.WriteLine("Podaj login: "******"Podaj hasło: ");
                    string password = Console.ReadLine();
                    ActiveUser = ActiveBank.Auth(login, password);
                    if (ActiveUser != null)
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Błąd");
                    }
                }
                Console.Clear();

                //Dane kont

                Console.WriteLine("-------------------");
                Console.Write("Aktualny użytkownik: ");
                ActiveUser.GetSurname();
                ActiveUser.ListBankRecords();

                //Wybieranie rachunku
                do
                {
                    if (ActiveUser.GetAccNumbers() > 1)
                    {
                        for (; ;)
                        {
                            Console.WriteLine("Który rachunek chcesz modyfikować?");
                            if (Int32.TryParse(Console.ReadLine(), out int AccountNumber))
                            {
                                AccountNumber -= 1;
                                if (AccountNumber >= 0 && AccountNumber < ActiveUser.GetAccNumbers())
                                {
                                    ActiveAcc = ActiveUser.GetAcc(AccountNumber);
                                    break;
                                }
                                else
                                {
                                    Console.WriteLine("Rachunek nie istnieje");
                                }
                            }
                            else
                            {
                                Console.WriteLine("To nawet nie jest liczba!");
                            }
                        }
                    }
                    else
                    {
                        ActiveAcc = ActiveUser.GetAcc(0);
                    }


                    //Wybieranie opcji

                    do
                    {
                        Console.Clear();
                        Console.WriteLine("-------------------");
                        Console.Write("Aktualny użytkownik: ");
                        ActiveUser.GetSurname();
                        ActiveUser.ListBankRecords();

                        Console.WriteLine("1. Wpłać");
                        Console.WriteLine("2. Wypłać");
                        Console.WriteLine("3. Sprawdź historię");
                        Console.WriteLine("4. Weź kredyt");
                        Console.WriteLine("5. Spłać kredyt");
                        Console.WriteLine("6. Przelew na inne konto");
                        Console.WriteLine("7. Dodaj nowy rachunek");
                        Console.WriteLine("8. Wyloguj");
                        if (ActiveUser.GetAccNumbers() > 1)
                        {
                            Console.WriteLine("9. Zmień rachunek");
                        }

                        if (ActiveUser is Admin)
                        {
                            Console.WriteLine("-------------------");
                            Console.WriteLine("Panel admina!!!");
                            Console.WriteLine("-------------------");
                            Console.WriteLine("-1. Zablokuj czyjeś konto");
                            Console.WriteLine("-2. Dodaj konto");
                            Console.WriteLine("-3. Usuń konto");
                            Console.WriteLine("-4. Generuj podsumowanie");
                            Console.WriteLine("-5. Sprwadź czyjąć historię");
                            Console.WriteLine("-6. Sprawdź dłużników");
                        }
                        if (Int32.TryParse(Console.ReadLine(), out CaseSwitch))
                        {
                            switch (CaseSwitch)
                            {
                            case 1:
                                Console.WriteLine("Jaką kwotę chcesz wpłacić?");
                                ActiveAcc.Deposit(Convert.ToDecimal(Console.ReadLine()));
                                break;

                            case 2:
                                Console.WriteLine("Jaką kwotę chcesz wypłacić?");
                                ActiveAcc.Withdraw(Convert.ToDecimal(Console.ReadLine()));
                                break;

                            case 3:
                                ActiveAcc.CheckHistory();
                                break;

                            case 4:
                                Console.WriteLine("Jaką kwotę pieniędzy chcesz pożyczyć?");
                                ActiveAcc.TakeCredit(Convert.ToDecimal(Console.ReadLine()));
                                break;

                            case 5:
                                Console.WriteLine("Jaką kwotę pieniędzy chcesz spłacić?");
                                ActiveAcc.PayCredit(Convert.ToDecimal(Console.ReadLine()));
                                break;

                            case 6:
                                Console.WriteLine("Podaj ID konta na które chcesz przelać pieniądze");
                                int id;
                                if (Int32.TryParse(Console.ReadLine(), out id))
                                {
                                    Console.WriteLine("Podaj kwotę");
                                    decimal cash = Convert.ToDecimal(Console.ReadLine());
                                    ActiveAcc.Transfer(id, cash, ActiveBank);
                                }
                                else
                                {
                                    Console.WriteLine("To nawet nie jest liczba!");
                                }
                                break;

                            case 7:
                                Console.WriteLine("Otwieram nowy rachunek");
                                ActiveUser.NewAccount(ActiveBank);
                                break;

                            case 8:
                                break;

                            case 9:
                                break;

                            case -1:
                                if (ActiveUser is Admin)
                                {
                                    Console.WriteLine("Podaj login osoby którą chcesz zablokować:/n");
                                    ActiveBank.Block(Console.ReadLine());
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            case -2:
                                if (ActiveUser is Admin)
                                {
                                    ActiveBank.AddAccount();
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            case -3:
                                if (ActiveUser is Admin)
                                {
                                    Console.WriteLine("Podaj login osoby którą chcesz zablokować:/n");
                                    ActiveBank.DelAccount(Console.ReadLine());
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            case -4:
                                if (ActiveUser is Admin)
                                {
                                    ActiveBank.GenerateBankSummary();
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            case -5:
                                if (ActiveUser is Admin)
                                {
                                    Console.WriteLine("Podaj login osoby której historie chcesz zobaczyć");
                                    ActiveBank.CheckUserHistory(Console.ReadLine());
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            case -6:
                                if (ActiveUser is Admin)
                                {
                                    ActiveBank.CheckDebtorsList();
                                }
                                else
                                {
                                    Console.WriteLine("Nie masz uprawnień");
                                }
                                break;

                            default:
                                Console.WriteLine("Nieprawidłowa opcja");
                                break;
                            }
                            Console.WriteLine("\nNaciśnij klawisz aby przejść dalej \n");
                            Console.ReadKey();
                        }
                    } while (CaseSwitch != 9 && CaseSwitch != 8);
                } while (CaseSwitch != 8);
            } while (true);
        }
Exemplo n.º 20
0
 public abstract void createAccount(Bank.PersonalData data, Bank.accountType type, out string accountID, Ice.Current current__);
Exemplo n.º 21
0
 private void removeAccount_completed__(Ice.AsyncResult r__, Bank.Callback_BankManager_removeAccount cb__, Ice.ExceptionCallback excb__)
 {
     try
     {
         end_removeAccount(r__);
     }
     catch(Ice.Exception ex__)
     {
         if(excb__ != null)
         {
             excb__(ex__);
         }
         return;
     }
     if(cb__ != null)
     {
         cb__();
     }
 }
 public Deposit(Bank bank, Customer customer)
 {
     _bank     = bank;
     _customer = customer;
 }
Exemplo n.º 23
0
 public void createAccount(Bank.PersonalData data, Bank.accountType type, out string accountID)
 {
     createAccount(data, type, out accountID, Ice.ObjectImpl.defaultCurrent);
 }
Exemplo n.º 24
0
 public void calculateLoan(int amount, Bank.currency curr, int period, out int totalCost, out float interestRate)
 {
     calculateLoan(amount, curr, period, out totalCost, out interestRate, Ice.ObjectImpl.defaultCurrent);
 }
Exemplo n.º 25
0
 public void createAccount(Bank.PersonalData data, Bank.accountType type, out string accountID, _System.Collections.Generic.Dictionary<string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
 {
     Ice.Current current__ = new Ice.Current();
     initCurrent__(ref current__, "createAccount", Ice.OperationMode.Normal, context__);
     string accountIDHolder__ = null;
     Ice.UserException userException__ = null;
     IceInternal.Direct.RunDelegate run__ = delegate(Ice.Object obj__)
     {
         BankManager servant__ = null;
         try
         {
             servant__ = (BankManager)obj__;
         }
         catch(_System.InvalidCastException)
         {
             throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);
         }
         try
         {
             servant__.createAccount(data, type, out accountIDHolder__, current__);
             return Ice.DispatchStatus.DispatchOK;
         }
         catch(Ice.UserException ex__)
         {
             userException__ = ex__;
             return Ice.DispatchStatus.DispatchUserException;
         }
     };
     IceInternal.Direct direct__ = null;
     try
     {
         direct__ = new IceInternal.Direct(current__, run__);
         try
         {
             Ice.DispatchStatus status__ = direct__.getServant().collocDispatch__(direct__);
             if(status__ == Ice.DispatchStatus.DispatchUserException)
             {
                 throw userException__;
             }
             _System.Diagnostics.Debug.Assert(status__ == Ice.DispatchStatus.DispatchOK);
         }
         finally
         {
             direct__.destroy();
         }
     }
     catch(Bank.IncorrectData)
     {
         throw;
     }
     catch(Bank.RequestRejected)
     {
         throw;
     }
     catch(Ice.SystemException)
     {
         throw;
     }
     catch(_System.Exception ex__)
     {
         IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
     }
     accountID = accountIDHolder__;
 }
Exemplo n.º 26
0
 public void calculateLoan(int amount, Bank.currency curr, int period, out int totalCost, out float interestRate, _System.Collections.Generic.Dictionary<string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
 {
     Ice.Current current__ = new Ice.Current();
     initCurrent__(ref current__, "calculateLoan", Ice.OperationMode.Normal, context__);
     int totalCostHolder__ = 0;
     float interestRateHolder__ = 0.0f;
     Ice.UserException userException__ = null;
     IceInternal.Direct.RunDelegate run__ = delegate(Ice.Object obj__)
     {
         PremiumAccount servant__ = null;
         try
         {
             servant__ = (PremiumAccount)obj__;
         }
         catch(_System.InvalidCastException)
         {
             throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);
         }
         try
         {
             servant__.calculateLoan(amount, curr, period, out totalCostHolder__, out interestRateHolder__, current__);
             return Ice.DispatchStatus.DispatchOK;
         }
         catch(Ice.UserException ex__)
         {
             userException__ = ex__;
             return Ice.DispatchStatus.DispatchUserException;
         }
     };
     IceInternal.Direct direct__ = null;
     try
     {
         direct__ = new IceInternal.Direct(current__, run__);
         try
         {
             Ice.DispatchStatus status__ = direct__.getServant().collocDispatch__(direct__);
             if(status__ == Ice.DispatchStatus.DispatchUserException)
             {
                 throw userException__;
             }
             _System.Diagnostics.Debug.Assert(status__ == Ice.DispatchStatus.DispatchOK);
         }
         finally
         {
             direct__.destroy();
         }
     }
     catch(Bank.IncorrectData)
     {
         throw;
     }
     catch(Ice.SystemException)
     {
         throw;
     }
     catch(_System.Exception ex__)
     {
         IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
     }
     totalCost = totalCostHolder__;
     interestRate = interestRateHolder__;
 }
Exemplo n.º 27
0
 public void RejestrujBank(Bank bank)
 {
     bank.DodajKomisje(this);
     banki.Add(bank.Kod, bank);
     przelewyWychodzace.Add(bank, new PaczkaPrzelewow());
 }
Exemplo n.º 28
0
 private void createAccount_completed__(Ice.AsyncResult r__, Bank.Callback_BankManager_createAccount cb__, Ice.ExceptionCallback excb__)
 {
     string accountID;
     try
     {
         end_createAccount(out accountID, r__);
     }
     catch(Ice.Exception ex__)
     {
         if(excb__ != null)
         {
             excb__(ex__);
         }
         return;
     }
     if(cb__ != null)
     {
         cb__(accountID);
     }
 }
Exemplo n.º 29
0
 public void wysllijPaczke(Bank bank, PaczkaPrzelewow paczka)
 {
     bank.OdbierzPrzelewy(paczka);
 }
Exemplo n.º 30
0
 private Ice.AsyncResult<Bank.Callback_BankManager_createAccount> begin_createAccount(Bank.PersonalData data, Bank.accountType type, _System.Collections.Generic.Dictionary<string, string> ctx__, bool explicitContext__, Ice.AsyncCallback cb__, object cookie__)
 {
     checkAsyncTwowayOnly__(__createAccount_name);
     IceInternal.TwowayOutgoingAsync<Bank.Callback_BankManager_createAccount> result__ =  new IceInternal.TwowayOutgoingAsync<Bank.Callback_BankManager_createAccount>(this, __createAccount_name, createAccount_completed__, cookie__);
     if(cb__ != null)
     {
         result__.whenCompletedWithAsyncCallback(cb__);
     }
     try
     {
         result__.prepare__(__createAccount_name, Ice.OperationMode.Normal, ctx__, explicitContext__);
         IceInternal.BasicStream os__ = result__.startWriteParams__(Ice.FormatType.DefaultFormat);
         if(data == null)
         {
             Bank.PersonalData tmp__ = new Bank.PersonalData();
             tmp__.write__(os__);
         }
         else
         {
             data.write__(os__);
         }
         os__.writeEnum((int)type, 1);
         result__.endWriteParams__();
         result__.send__(true);
     }
     catch(Ice.LocalException ex__)
     {
         result__.exceptionAsync__(ex__);
     }
     return result__;
 }
Exemplo n.º 31
0
 private static void ShowAccountsBiggerSum(Bank bank)
 {
     SortDes(bank);
     Show(bank, 3);
 }
Exemplo n.º 32
0
 public void ustawBank(Bank bank)
 {
     this.bank = bank;
 }
Exemplo n.º 33
0
 public abstract void calculateLoan(int amount, Bank.currency curr, int period, out int totalCost, out float interestRate, Ice.Current current__);
Exemplo n.º 34
0
 public void calculateLoan(int amount, Bank.currency curr, int period, out int totalCost, out float interestRate, _System.Collections.Generic.Dictionary<string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("calculateLoan", Ice.OperationMode.Normal, context__, observer__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.startWriteParams(Ice.FormatType.DefaultFormat);
             os__.writeInt(amount);
             os__.writeEnum((int)curr, 3);
             os__.writeInt(period);
             og__.endWriteParams();
         }
         catch(Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if(!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch(Bank.IncorrectData)
                 {
                     throw;
                 }
                 catch(Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.startReadParams();
             totalCost = is__.readInt();
             interestRate = is__.readFloat();
             og__.endReadParams();
         }
         catch(Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }