Exemple #1
0
        public double GetTotalPerTick(string symbol)
        {
            double total = 0;

            try
            {
                CCryptoTran t = new CCryptoTran();
                total = t.GetTotal(symbol);
            }
            catch (Exception ex)
            {
                CErrorLog err = new CErrorLog();
                err.LogError(ex.Message);
                throw ex;
            }
            return(total);
        }
Exemple #2
0
        public void Load()
        {
            try
            {
                //we will need to pass in the userID here to be able to limit the user to only see their list of stocks. see below *

                WealthDataContext oDc = new WealthDataContext();

                var results = (from s in oDc.tblCryptos
                               join u in oDc.tblUsers on s.UserId equals u.Id
                               where u.Id == CLogin.UserLoggedIn
                               orderby s.Symbol
                               // * where s.userid == u.userId
                               select new
                {
                    s.Id,
                    custId = s.UserId,
                    s.Symbol,
                    s.CurrentPrice,
                }).ToList();

                foreach (var stock in results)
                {
                    CCrypto     oStock = new CCrypto();
                    CCryptoTran t      = new CCryptoTran();
                    oStock.TotalPerTick = t.GetTotal(stock.Symbol);
                    oStock.TotalShares  = t.GetTotalShares(stock.Symbol);
                    oStock.Id           = stock.Id;
                    oStock.Ticker       = stock.Symbol;
                    oStock.Price        = GetPrice(stock.Symbol);
                    Add(oStock);
                }
            }
            catch (Exception ex)
            {
                CErrorLog err = new CErrorLog();
                err.LogError(ex.Message);
                throw ex;
            }
        }