public void AddProduct(int id, int amount) { var cycle_checker = new CycleChecker(Id); if (cycle_checker.IsCycle(id)) { return; } //TODO DialogInfo about it //TODO Check if it is not infinite loop if (Id != id) { product_manager.Add(id, amount); } }
private void ReadDeps(int id, int amount, bool addToOrder) { if (addToOrder) { full_order_manager.Add(id, amount); } else { full_order_manager.Delete(id, amount); } DataTable table = Database.ProductDependencyTable.SelectDependency(id); foreach (var child in table.Select()) { ReadDeps((int)child [1], (int)child [2] * amount, addToOrder); } }
public void AddProduct(int id, int amount) { OrderManager.Add(id, amount); ReadDeps(id, amount, true); }