public void DeleteProduct(int id, int amount) { if (product_manager.Delete(id, amount)) { var rows = dependency_table.Select(Filter(id)); if (rows.Length > 0) { rows [0].Delete(); } } }
public void DeleteProduct(int id, int amount) { if (OrderManager.Delete(id, amount)) { var rows = order_product_table.Select(Filter(id)); if (rows.Length > 0) { rows [0].Delete(); } } ReadDeps(id, amount, false); }
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); } }