private void dgEquipmentOrdered_ItemCommand(object sender, GridItemCommandEventArgs e) { int InventoryID = 0; LinkButton tmpLnk = (LinkButton) e.Control; int OrderDetailID = Convert.ToInt32(tmpLnk.CommandArgument); BPOrderDetails bp = new BPOrderDetails(); BPInventory bpInventory = new BPInventory(); if (OrderID > 0 && OrderCompleted == false) { DSOrders = bp.SelectOrderDetailsByID(OrderDetailID); BEOrders.tbl_OrderDetailsRow OrderDetails = DSOrders.tbl_OrderDetails.FindByOrderDetailID(OrderDetailID); if (OrderDetails != null) { InventoryID = OrderDetails.InventoryID; OrderDetails.Delete(); BEInventory.tbl_InventoryRow Inventory; DSInventory = bpInventory.SelectInventoryByID(InventoryID); Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID); Inventory.InventoryInStock = 0; } bp.Update(DSOrders); bpInventory.Update(DSInventory); } BindDSInventory(); BindDSOrders(); //check to see if there are any items left on the order and display the '0 item' message if there aren't any. if (dgEquipmentOrdered.Items.Count == 0) { btnSubmit.MessageEnabled = true; } }
private void dgEquipmentOrdered_ItemCommand(object sender, GridItemCommandEventArgs e) { int inventoryID = 0; LinkButton tmpLnk = (LinkButton) e.Control; int OrderDetailID = Convert.ToInt32(tmpLnk.CommandArgument); BPOrderDetails bp = new BPOrderDetails(); BPInventory bpInventory = new BPInventory(); if (OrderID > 0 && OrderCompleted == false) { DSOrders = bp.SelectOrderDetailsByID(OrderDetailID); BEOrders.tbl_OrderDetailsRow OrderDetails = DSOrders.tbl_OrderDetails.FindByOrderDetailID(OrderDetailID); if (OrderDetails != null) { inventoryID = OrderDetails.InventoryID; OrderDetails.Delete(); BEInventory.tbl_InventoryRow Inventory; DSInventory = bpInventory.SelectInventoryByID(inventoryID); Inventory = DSInventory.tbl_Inventory.FindByInventoryID(inventoryID); Inventory.InventoryInStock = 1; Inventory.SetJobNumberNull(); } bp.Update(DSOrders); bpInventory.Update(DSInventory); } BindDSInventory(); BindDSOrders(); //reset or turn on warning message on submit button // if (dgEquipmentOrdered.Items.Count == 0) // { // btnSubmit.Message = "WARNING: You do not have any inventory items added to this order. Please click cancel and add some items before continuing."; // btnSubmit.MessageEnabled = true; // } // else if(!bp.HasBuyRentItemsByOrderID(OrderID)) // { // btnSubmit.MessageEnabled = false; // } }