Beispiel #1
0
        public void OrderArticle(int articleId, int maxExpectedPrice, int buyerId)
        {
            Article article = null;

            #region ordering article

            try
            {
                logger.Debug("Trying to find cheapest available article with id = " + articleId);
                article = dbDriver.GetArticleWithMaxExpectedPriceInInventory(articleId, maxExpectedPrice);
            }
            catch (Exception ex)
            {
                logger.Error("Could not retrieve article. Exception occured: " + ex);
            }

            #endregion

            #region selling article

            if (article == null)
            {
                logger.Info("Could not find available article with id = " + articleId);
            }
            else
            {
                logger.Info("Found article with id = " + articleId);
                SellArticle(article, buyerId);
            }
            #endregion
        }