public void AddTransaction(Transaction transaction) { if(transaction.SellingPrice < 0) transaction.SellingPrice = getMRPForInventoryItem(transaction.InventoryItem); if (transaction.SaleDate == null) transaction.SaleDate = DateTime.Now; db.Transactions.InsertOnSubmit(transaction); db.SubmitChanges(); }
public void UpdateTransaction(Transaction transaction) { Transaction transactionToUpdate = db.Transactions.Single(item => item.Id == transaction.Id); transactionToUpdate.Quantity = transaction.Quantity; transactionToUpdate.SaleDate = transaction.SaleDate; transactionToUpdate.InventoryItem = transaction.InventoryItem; if (transaction.SellingPrice < 0) transactionToUpdate.SellingPrice = getMRPForInventoryItem(transaction.InventoryItem); else transactionToUpdate.SellingPrice = transaction.SellingPrice; db.SubmitChanges(); }
partial void DeleteTransaction(Transaction instance);
private void detach_Transactions(Transaction entity) { this.SendPropertyChanging(); entity.Inventory = null; }
partial void UpdateTransaction(Transaction instance);
partial void InsertTransaction(Transaction instance);