Ejemplo n.º 1
0
        public decimal GetTotalPerTick(string ticker)
        {
            decimal total = 0;

            try
            {
                CTransaction t = new CTransaction();
                total = t.GetTotal(ticker);
            }
            catch (Exception ex)
            {
                CErrorLog err = new CErrorLog();
                err.LogError(ex.Message);
                throw ex;
            }
            return(total);
        }
Ejemplo n.º 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.tblStocks
                               join u in oDc.tblUsers on s.UserId equals u.Id
                               where u.Id == CLogin.UserLoggedIn
                               orderby s.Ticker
                               // * where s.userid == u.userId
                               select new
                {
                    s.Id,
                    custId = s.UserId,
                    s.Ticker,
                    s.CurrentPricePerShare,
                }).ToList();

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