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);
        }
Exemple #2
0
        public void Clear()
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);

            Account account = new Account();

            AccountSvc.GenerateJSON(account);
        }
Exemple #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);
        }
Exemple #4
0
        public Account GenerateAccount()
        {
            Factory     factory    = Factory.GetInstance();
            IAccountSvc AccountSvc =
                (IAccountSvc)factory.GetService(typeof(IAccountSvc).Name);

            Account account = AccountSvc.GenerateAccount();

            return(account);
        }
Exemple #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);
        }
Exemple #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;
 }
 public AccountController(IAccountSvc service)
 {
     this.acctService = service;
 }
 public AccountController()
 {
     acctService = new AccountSvc();
 }
Exemple #10
0
 public AccountInfoRequestConsumer(IAccountSvc svc)
 {
     _svc = svc;
 }
Exemple #11
0
 public AccountController(IAccountSvc accountSvc)
 {
     _accountSvc = accountSvc;
 }
Exemple #12
0
 public AccountController(IComponentContext componentContext, IAccountSvc accountService, IUserSvc userService, IWxSvc wxSvc)
 {
     _accountService = accountService;
     _userService    = userService;
     _wxSvc          = wxSvc;
 }
 public AccountController(IAccountSvc accountSvc, ICurrentUser currentUser)
 {
     _accountSvc  = accountSvc;
     _currentUser = currentUser;
 }
 public AccountController(IAccountSvc svc, IConfiguration cfg)
 {
     this._svc = svc;
     this.cfg  = cfg;
 }
Exemple #15
0
 public AccountPresenter(IAccountSvc _AccountSvc)
 {
     AccountSvc = _AccountSvc;
 }
 public AccountController(ILogger logger,
                          IAccountSvc accountSvc) : base(logger)
 {
     _accountSvc = accountSvc;
 }