Esempio n. 1
0
        // TAG analayse oder datenbankabfrage
        public static AbstractArticle preprocessArtikel(Window parent, ISposDb db, string number)
        {
            AbstractArticle article = null;

            switch (convertToType(number))
            {
            case AbstractArticle.ArticleType.ARTICLE:
                article = db.GetArticleByNumber(number);
                if (article == null)
                {
                    // Artikel ist nicht vorhanden --> neu anlegen
                    ArticleView window = new ArticleView(db, new RegularArticle(number));
                    window.Owner = parent;
                    window.ShowDialog();
                    article = db.GetArticleByNumber(number);
                    // wenn nichts gültiges eingegeben wird --> beenden
                    if (article == null)
                    {
                        return(null);
                    }
                }

                break;

            case AbstractArticle.ArticleType.DISCOUNT:
                int discountInCent = Discount.getAmountOfTag(number);
                if (discountInCent < 0)
                {
                    // Wenn der Tag keinen Wertenthält muss eine Nutzereingabe erfolgen
                    DiscountInputBox widow = new DiscountInputBox();
                    widow.Owner = parent;
                    int userValue = widow.ShowWithResult();
                    if (userValue > 0)
                    {
                        discountInCent = userValue;
                    }
                    else
                    {
                        // Wenn keine korrekte Eingabe erfolgt -> Ende.
                        return(null);
                    }
                }
                article = new Discount(discountInCent);

                break;
            }


            return(article);
        }
Esempio n. 2
0
 public VisibleStockItem(ISposDb db,SaveableStockItem item) : base(item.Number, item.Quantity)
 {
     SimplePOS.Article.RegularArticle article = db.GetArticleByNumber(item.Number);
     if (article != null)
     {
         this.name = article.Name;
         this.text = article.Text;
     }
 }
Esempio n. 3
0
 public VisibleStockItem(ISposDb db, SaveableStockItem item) : base(item.Number, item.Quantity)
 {
     SimplePOS.Article.RegularArticle article = db.GetArticleByNumber(item.Number);
     if (article != null)
     {
         this.name = article.Name;
         this.text = article.Text;
     }
 }
Esempio n. 4
0
        private void saveItemFromForm()
        {
            string number = textBox1.Text;

            SimplePOS.Article.AbstractArticle article = db.GetArticleByNumber(number);
            if (article == null)
            {
                // Artikel nicht vorhanden
                SimplePOS.Article.ArticleView window = new
                                                       SimplePOS.Article.ArticleView(db,
                                                                                     new SimplePOS.Article.RegularArticle(number));
                window.Owner = this;
                window.ShowDialog();
                article = db.GetArticleByNumber(number);
                // wenn nichts gültiges eingegeben wird --> beenden
                if (article == null)
                {
                    return;
                }
            }


            double quantity = 0;

            try { quantity = Double.Parse(textBox2.Text); }
            catch
            {
                MessageBox.Show("Bitte Menge eingeben.", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            SaveableStockItem item = new SaveableStockItem(number, quantity);

            if (singleShow)
            {
                curr_quantity += item.Quantity;
                item.Quantity  = curr_quantity;
                db.SetItemToStock(item);
            }
            else
            {
                db.AddItemToStock(item);
            }
            stop_stocking = false;
        }