Exemplo n.º 1
0
        public void ProcessPurchase(Purchase p, Account a, IList <Transaction> tt)
        {
            Factory factory = Factory.GetInstance();



            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);
            ITransactionSvc TransactionSvc =
                (ITransactionSvc)factory.GetService(typeof(ITransactionSvc).Name);

            TransactionSvc.ProcessTransaction(p, tt);



            var entry = from e in a.Entries
                        where e.Currency == p.Currency
                        select e;

            //Subtract cost
            if (entry.FirstOrDefault() != null)
            {
                entry.FirstOrDefault().Amount -= p.Cost;
            }

            //Display message if for some reason we don't have any of the currency
            else
            {
                Console.WriteLine("ERROR: CANNOT EXCHANGE CURRENCY: " + p.Currency);
            }

            AccountSvc.GenerateJSON(a);
        }
Exemplo n.º 2
0
        public void Clear()
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);

            Account account = new Account();

            AccountSvc.GenerateJSON(account);
        }
Exemplo n.º 3
0
        public IList <Transaction> GenerateTList()
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);

            IList <Transaction> tt = AccountSvc.GenerateTList();

            return(tt);
        }
Exemplo n.º 4
0
        public Account GenerateAccount()
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);

            Account account = AccountSvc.GenerateAccount();

            return(account);
        }
Exemplo n.º 5
0
        public void ProcessExchange(Exchange d, Account a, IList <Transaction> tt)
        {
            Factory factory = Factory.GetInstance();



            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);
            ITransactionSvc TransactionSvc =
                (ITransactionSvc)factory.GetService(typeof(ITransactionSvc).Name);

            TransactionSvc.ProcessTransaction(d, tt);



            var entry = from e in a.Entries
                        where e.Currency == d.OutCurr
                        select e;

            //Add to the currency if it's already there
            if (entry.FirstOrDefault() != null)
            {
                entry.FirstOrDefault().Amount += d.OutAmt;
            }
            //If the currency isn't there yet, we must add it
            else
            {
                CurrEntry c = new CurrEntry(d.OutAmt, d.OutCurr);
                a.AddCurrency(c);
            }

            var entry2 = from e2 in a.Entries
                         where e2.Currency == d.InCurr
                         select e2;

            if (entry2.FirstOrDefault() != null)
            {
                entry2.FirstOrDefault().Amount -= d.InAmt;
            }
            //Display message if for some reason we don't have any of the input currency
            else
            {
                Console.WriteLine("ERROR: CANNOT EXCHANGE CURRENCY: " + d.InCurr);
            }

            AccountSvc.GenerateJSON(a);
        }
Exemplo n.º 6
0
        public void ProcessDeposit(Deposit d, Account a, IList <Transaction> tt)
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);


            ITransactionSvc TransactionSvc =
                (ITransactionSvc)factory.GetService(typeof(ITransactionSvc).Name);


            TransactionSvc.ProcessTransaction(d, tt);



            var entry = from e in a.Entries
                        where e.Currency == d.Currency
                        select e;

            //Add to the currency if it's already there
            if (entry.FirstOrDefault() != null)
            {
                entry.FirstOrDefault().Amount += d.Amt;
            }
            //If the currency isn't there yet, we must add it
            else
            {
                CurrEntry c = new CurrEntry(d.Amt, d.Currency);
                a.AddCurrency(c);
            }

            AccountSvc.GenerateJSON(a);
            Console.WriteLine();
            Console.WriteLine(d.ToString());
            Console.WriteLine();
        }
 public NewsletterSubscribedConsumer(IAccountSvc svc)
 {
     _svc = svc;
 }
Exemplo n.º 8
0
 public AccountController(IAccountSvc service)
 {
     this.acctService = service;
 }
Exemplo n.º 9
0
 public AccountController()
 {
     acctService = new AccountSvc();
 }
Exemplo n.º 10
0
 public AccountInfoRequestConsumer(IAccountSvc svc)
 {
     _svc = svc;
 }
Exemplo n.º 11
0
 public AccountController(IAccountSvc accountSvc)
 {
     _accountSvc = accountSvc;
 }
Exemplo n.º 12
0
 public AccountController(IComponentContext componentContext, IAccountSvc accountService, IUserSvc userService, IWxSvc wxSvc)
 {
     _accountService = accountService;
     _userService    = userService;
     _wxSvc          = wxSvc;
 }
Exemplo n.º 13
0
 public AccountController(IAccountSvc accountSvc, ICurrentUser currentUser)
 {
     _accountSvc  = accountSvc;
     _currentUser = currentUser;
 }
 public AccountController(IAccountSvc svc, IConfiguration cfg)
 {
     this._svc = svc;
     this.cfg  = cfg;
 }
Exemplo n.º 15
0
 public AccountPresenter(IAccountSvc _AccountSvc)
 {
     AccountSvc = _AccountSvc;
 }
Exemplo n.º 16
0
 public AccountController(ILogger logger,
                          IAccountSvc accountSvc) : base(logger)
 {
     _accountSvc = accountSvc;
 }