Esempio n. 1
0
 public void RemoveStock(Stock stock)
 {
     if (Stocks.Exists(s => s.Symbol == stock.Symbol))            //If does exist, remove stock from list.
     {
         var StockToRemove = Stocks.Find(s => s.Symbol == stock.Symbol);
         Stocks.Remove(StockToRemove);
     }
 }
Esempio n. 2
0
 public MainWindowViewModel(ITrackerBusinessLogic trackerBusinessLogic)
 {
     try
     {
         this.trackerBusinessLogic = trackerBusinessLogic;
         Stocks        = trackerBusinessLogic.GetStocks();
         TradeTypes    = trackerBusinessLogic.GetTradeTypes();
         SelectedStock = Stocks.Find(s => s.Ticker == "MSFT");
         Date          = DateTime.Today;
         GetTradePortfolio();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 3
0
        private void MockProductTrigger()
        {
            foreach (var item in ChangeTracker.Entries <Product>().Where(x => x.State != EntityState.Unchanged).ToList())
            {
                decimal delta            = 0;
                var     quantityProperty = item.Property(x => x.Price);
                switch (item.State)
                {
                case EntityState.Deleted:
                    delta = -quantityProperty.CurrentValue;
                    break;

                case EntityState.Added:
                    delta = quantityProperty.CurrentValue;
                    break;

                default:
                    delta = quantityProperty.CurrentValue - quantityProperty.OriginalValue;
                    break;
                }
                var stock = Stocks.Find(item.Entity.StockId);
                stock.TotalAmount += delta;
            }
        }
Esempio n. 4
0
 internal RonStock GetStock(string ticker)
 {
     return(Stocks.Find(stock => stock.Symbol == ticker));
 }
Esempio n. 5
0
 public static int GetPriceOfStock(string name)
 {
     return(Stocks.Find(stock => stock.Name == name).CurrentStockPrice);
 }
Esempio n. 6
0
 public StockDTO GetStock(int ID)
 {
     return(Stocks.Find(ID));
 }