Пример #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;
     }
 }
Пример #2
0
        private void setStockCore(SaveableStockItem item, IObjectContainer db)
        {
            SaveableStockItem old_item = getStockItemByNumberCore(item.Number, db);

            if (old_item != null)
            {
                deleteStockItemByNumberCore(item.Number, db);
            }
            db.Store(item);
        }
Пример #3
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;
 }
Пример #4
0
 public void SetItemToStock(SaveableStockItem item)
 {
     using (IObjectContainer db = Db4oEmbedded.OpenFile(DB_FILNAME))
     {
         try
         {
             setStockCore(item, db);
         }
         finally
         {
             db.Close();
         }
     }
 }
Пример #5
0
        private SimplePOS.Inventory.SaveableStockItem getStockItemByNumberCore(string number, IObjectContainer db)
        {
            SaveableStockItem query  = new SaveableStockItem(number, 0);
            IObjectSet        result = db.QueryByExample(query);

            if (result.Count > 0)
            {
                return((SaveableStockItem)result[0]);
            }
            else
            {
                return(null);
            }
        }
Пример #6
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;
        }
Пример #7
0
 public void TakeOutOfStock(string number, double quantitiy)
 {
     using (IObjectContainer db = Db4oEmbedded.OpenFile(DB_FILNAME))
     {
         try
         {
             SaveableStockItem item = getStockItemByNumberCore(number, db);
             if (item != null)
             {
                 // Wenn im Lager erfasst
                 item.Quantity -= quantitiy;
                 setStockCore(item, db);
             }
         }
         finally
         {
             db.Close();
         }
     }
 }
Пример #8
0
 public void AddItemToStock(SaveableStockItem item)
 {
     using (IObjectContainer db = Db4oEmbedded.OpenFile(DB_FILNAME))
     {
         try
         {
             SaveableStockItem old_item = getStockItemByNumberCore(item.Number, db);
             if (old_item != null)
             {
                 item.Quantity += old_item.Quantity;
                 deleteStockItemByNumberCore(item.Number, db);
             }
             db.Store(item);
         }
         finally
         {
             db.Close();
         }
     }
 }
Пример #9
0
        public List <SaveableStockItem> GetStock()
        {
            List <SaveableStockItem> retval = null;

            using (IObjectContainer db = Db4oEmbedded.OpenFile(DB_FILNAME))
            {
                try
                {
                    retval = new List <SaveableStockItem>();
                    SaveableStockItem query  = new SaveableStockItem(null, 0);
                    IObjectSet        result = db.QueryByExample(query);
                    foreach (Object item in result)
                    {
                        retval.Add((SaveableStockItem)item);
                    }
                }
                finally
                {
                    db.Close();
                }
            }
            return(retval);
        }