public Stock(string id, decimal price) { _currentSellPrice = price - 1; _state = new StableState(id, 0); Bus.RegisterHandler<SellPriceIncreasedEvent>(x=>_currentSellPrice = x.SellingPoint); }
public Stock(string id, decimal price) { _currentSellPrice = price - 1; _state = new StableState(id, 0); Bus.RegisterHandler <SellPriceIncreasedEvent>(x => _currentSellPrice = x.SellingPoint); }
public void TestDictionaryConstructor() { StockState ss = new StockState(); Dictionary <string, Stock> allStocks = ss.Deserialize("stocksWithIndicators.bin"); StockComparer sc = new StockComparer(allStocks); }
public void TestRankOfBestStocks() { StockState ss = new StockState(); Dictionary <string, Stock> allStocks = ss.Deserialize("stocksWithIndicators.bin"); //StockComparer sc = new StockComparer(allStocks); List <Stock> rank = StockComparer.RankOfBestStocks(allStocks); }
public void TestRankStocksByCompare() { StockState ss = new StockState(); Dictionary <string, Stock> allStocks = ss.Deserialize("stocksWithIndicators.bin"); List <Stock> tradedEveryDay = StockComparer.RemoveStocksNotTradedEveryday(allStocks); StockComparer sc = new StockComparer(tradedEveryDay); sc.RankStocksByCompare(); }
public void TestRemoveStocksNotTradedEveryday() { StockState ss = new StockState(); Dictionary <string, Stock> allStocks = ss.Deserialize("stocksWithIndicators.bin"); List <Stock> dailyTradedStocks = StockComparer.RemoveStocksNotTradedEveryday(allStocks); //StockComparer sc = new StockComparer(allStocks); List <Stock> rank = StockComparer.RankOfBestStocks(dailyTradedStocks); StockState sc = new StockState(rank); sc.Serialize("rankedStocks.bin"); }
public static Control showBarService() { // make a list for retrieving data from it List <SomerenModel.BarService> barServices = new List <SomerenModel.BarService>(); // linking the list to the DB connection in order to get data from it barServices = SomerenDB.DB_getBarServices(); // Making a list and editing its format ListView barServiceListView = new ListView(); barServiceListView.Height = 370; barServiceListView.Width = 370; barServiceListView.View = View.Details; barServiceListView.FullRowSelect = true; // add columns to the list view barServiceListView.Columns.Add("ID", -2, HorizontalAlignment.Left); barServiceListView.Columns.Add("Drink Name", -2, HorizontalAlignment.Left); barServiceListView.Columns.Add("Drink Price", -2, HorizontalAlignment.Left); barServiceListView.Columns.Add("Amount (In Stock)", -2, HorizontalAlignment.Left); // declare a string variable for adding new text to stock amount data string StockState; // store data to the list view foreach (SomerenModel.BarService barService in barServices) { ListViewItem entryListItem = barServiceListView.Items.Add(barService.getDrinkId().ToString()); entryListItem.SubItems.Add(barService.getDrinkName().ToString()); entryListItem.SubItems.Add(barService.getDrinkPrice().ToString()); // adding new text to stock amount data depending on its value if (barService.getStockAmount() < 10) { StockState = barService.getStockAmount() + " (Stock nearly depleted)"; } else { StockState = barService.getStockAmount() + " (Stock sufficient)"; } entryListItem.SubItems.Add(StockState.ToString()); } // return a list view return(barServiceListView); }
public void HandleTimeout(SellCommand command) { _state = _state.HandleTimeout(command); }
public void HandleTimeout(IncreaseSellingPointCommand command) { _state = _state.HandleTimeout(command); }
public void HandlePriceChange(decimal newPrice) { _state = _state.HandlePriceChanged(_currentSellPrice, newPrice); }