Exemplo n.º 1
0
        static void Main(string[] args)
        {
            BankingServiceClient bsr = new BankingServiceClient();

            Console.WriteLine($"DoWork() : {bsr.DoWork()}");
            Console.WriteLine($"GetBalance(1) : {bsr.GetBalance(1)}");
            Console.WriteLine($"GetBalance(0) : {((bsr.GetBalance(0) != null) ? bsr.GetBalance(0).ToString() : "null")}");
            foreach (Account account in bsr.GetAccounts())
            {
                Console.WriteLine(
                    $"Id : {account.Id}\t" +
                    $"Date creation : {account.DateCreated}\t" +
                    $"Nom : {account.Name}\t" +
                    $"Initial Balance : {account.InitialBalance}\t" +
                    $"NB operations : {account.Operations.Count()}\n"
                    );
                foreach (Operation operation in account.Operations)
                {
                    Console.WriteLine(
                        $"Id : {operation.Id}\t" +
                        $"Date creation : {operation.DateCreated}\t" +
                        $"Amout : {operation.Amount}\t" +
                        $"Account Id : {operation.AccountId}"
                        );
                }
            }
            bsr.Close();
            Console.WriteLine("\n-------------------------------------\n");

            Service1Client s1c = new Service1Client();

            Console.WriteLine($"DoWork() : {s1c.DoWork()}");
            Console.WriteLine($"GetBalance(1) : {s1c.GetBalance(1)}");
            Console.WriteLine($"GetBalance(0) : {((s1c.GetBalance(0) != null) ? s1c.GetBalance(0).ToString() : "null")}");
            foreach (Account account in s1c.GetAccountsList())
            {
                Console.WriteLine(
                    $"Id : {account.Id}\t" +
                    $"Date creation : {account.DateCreated}\t" +
                    $"Nom : {account.Name}\t" +
                    $"Initial Balance : {account.InitialBalance}\t" +
                    $"NB operations : {account.Operations.Count()}\n"
                    );
                foreach (Operation operation in account.Operations)
                {
                    Console.WriteLine(
                        $"Id : {operation.Id}\t" +
                        $"Date creation : {operation.DateCreated}\t" +
                        $"Amout : {operation.Amount}\t" +
                        $"Account Id : {operation.AccountId}"
                        );
                }
            }
            bsr.Close();
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //var bank = new Bank("ICICI", 12)
            //{
            //    AccountRepository = new BasicAccountRepository(@"c:\temp\accounts.db")
            //};

            var bank = new BankingServiceClient();

            AddAccount(bank);
            CustomerTransaction(bank);
            bank.PrintAccountList();
        }
Exemplo n.º 3
0
        private static void AddAccount(BankingServiceClient bank)
        {
            string type = Input.Read <string>("new account type?");

            if (!string.IsNullOrEmpty(type))
            {
                var name     = Input.Read <string>("name?");
                var password = Input.Read <string>("password?");
                var balance  = Input.Read <int>("amount?", 0);

                var id = bank.OpenAccount(type, name, password, balance);
                Console.WriteLine("New Account Created :" + id);
            }
        }
Exemplo n.º 4
0
        private static void CustomerTransaction(BankingServiceClient bank)
        {
            int from = Input.Read <int>("from account?", -1);

            if (from == -1)
            {
                return;
            }
            string pass   = Input.Read <string>("password?");
            int    amount = Input.Read <int>("amount?");
            int    to     = Input.Read <int>("to?");

            try
            {
                bank.Transfer(from, amount, pass, to);
                Console.WriteLine("Transfer success");
            }catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 5
0
 public BankingClientForm()
 {
     InitializeComponent();
     client = new BankingServiceClient();
 }