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; } }
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); }
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; }
public void SetItemToStock(SaveableStockItem item) { using (IObjectContainer db = Db4oEmbedded.OpenFile(DB_FILNAME)) { try { setStockCore(item, db); } finally { db.Close(); } } }
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); } }
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; }
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(); } } }
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(); } } }
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); }