Ejemplo n.º 1
0
        public Stock(string id, decimal price)
        {
            _currentSellPrice = price - 1;
            _state = new StableState(id, 0);

            Bus.RegisterHandler<SellPriceIncreasedEvent>(x=>_currentSellPrice = x.SellingPoint);
        }
Ejemplo n.º 2
0
        public Stock(string id, decimal price)
        {
            _currentSellPrice = price - 1;
            _state            = new StableState(id, 0);

            Bus.RegisterHandler <SellPriceIncreasedEvent>(x => _currentSellPrice = x.SellingPoint);
        }
Ejemplo n.º 3
0
        public void TestDictionaryConstructor()
        {
            StockState ss = new StockState();

            Dictionary <string, Stock> allStocks = ss.Deserialize("stocksWithIndicators.bin");

            StockComparer sc = new StockComparer(allStocks);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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");
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public void HandleTimeout(SellCommand command)
 {
     _state = _state.HandleTimeout(command);
 }
Ejemplo n.º 9
0
 public void HandleTimeout(IncreaseSellingPointCommand command)
 {
     _state = _state.HandleTimeout(command);
 }
Ejemplo n.º 10
0
 public void HandlePriceChange(decimal newPrice)
 {
     _state = _state.HandlePriceChanged(_currentSellPrice, newPrice);
 }
Ejemplo n.º 11
0
 public void HandleTimeout(SellCommand command)
 {
     _state = _state.HandleTimeout(command);
 }
Ejemplo n.º 12
0
 public void HandleTimeout(IncreaseSellingPointCommand command)
 {
     _state = _state.HandleTimeout(command);
 }
Ejemplo n.º 13
0
 public void HandlePriceChange(decimal newPrice)
 {
     _state = _state.HandlePriceChanged(_currentSellPrice, newPrice);
 }