Exemple #1
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;
     }
 }
Exemple #2
0
 public StockArticle(ISposDb db, SaveableStockItem item)
     : this(db)
 {
     textBox1.Text      = item.Number;
     textBox2.Text      = item.Quantity.ToString();
     curr_quantity      = item.Quantity;
     button2.Visibility = Visibility.Hidden;
     singleShow         = true;
     textBox1.IsEnabled = false;
 }
Exemple #3
0
        public void SetItemToStock(SimplePOS.Inventory.SaveableStockItem item)
        {
            mutex.WaitOne();
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand(connection))
            {
                //TODO if exist alter
                command.CommandText = "UPDATE stock SET item_quantity = " + item.Quantity + " WHERE item_id LIKE ?;";
                command.Parameters.Add(new SQLiteParameter("item_id", item.Number));
                //command.Parameters.Add(new SQLiteParameter("item_quantity", item.Quantity));
                command.ExecuteNonQuery();
            }

            connection.Close();
            mutex.Release();
        }
Exemple #4
0
        public void AddItemToStock(SimplePOS.Inventory.SaveableStockItem item)
        {
            mutex.WaitOne();
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand(connection))
            {
                //TODO if exist alter (gemensame funktion
                command.CommandText = "INSERT INTO stock (item_id, item_quantity) VALUES (?,?);";
                command.Parameters.Add(new SQLiteParameter("item_id", item.Number));
                command.Parameters.Add(new SQLiteParameter("item_quantity", item.Quantity));
                command.ExecuteNonQuery();
            }

            connection.Close();
            mutex.Release();
        }
Exemple #5
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;
        }