protected void ForceClose_Click(object sender, EventArgs e) { MessageUserControl.TryRun(() => { var controller = new ReceivingController(); var closeOrder = new ForceCloseDetails(); var itemInfo = new List <ForceCloseItems>(); foreach (GridViewRow item in OrderGridView.Rows) { var itemProductID = item.FindControl("OrderDetailID") as Label; var itemOutstanding = item.FindControl("ItemQuantityOutstanding") as Label; var product = new ForceCloseItems(); product.ProductID = int.Parse(itemProductID.Text); product.QuantityOutstanding = int.Parse(itemOutstanding.Text); itemInfo.Add(product); } closeOrder.OrderID = int.Parse(OrderListDropDown.SelectedValue); closeOrder.Closed = true; closeOrder.Comment = Comments.Text; closeOrder.Items = itemInfo; controller.ForceCloseOrder(closeOrder); }, "Force Close Order", "Order has been force closed"); Response.Redirect("~/Subsystem/Receiving/Receiving"); }
protected void ForceClose_Click(object sender, EventArgs e) { int vendorid = 0; int orderid = 0; vendorid = int.Parse(VendorDDL.SelectedValue); GridViewRow orderrow = PurchaseOrderGridView.Rows[1]; orderid = int.Parse((orderrow.FindControl("OrderID") as Label).Text); var closingitems = new List <ForceClearPOCO>(); MessageUserControl.TryRun(() => { foreach (GridViewRow row in PurchaseOrderGridView.Rows) { if (int.Parse(((row.FindControl("QuantityOutstanding") as Label).Text).ToString()) > 0) { int remaining = int.Parse(((row.FindControl("QuantityOutstanding") as Label).Text).ToString()); string itemname = row.Cells[1].Text; closingitems.Add(new ForceClearPOCO() { ItemName = itemname, Remaining = remaining }); } } string reason = (CommentBox.Text).ToString(); if (string.IsNullOrEmpty(reason)) { throw new BusinessRuleException("Input Error", new List <String> { "There must be a reason when force closing." }); } else { ReceivingController sysmgr = new ReceivingController(); sysmgr.ForceCloseOrder(orderid, reason, closingitems, vendorid); } }, "Force Close", "Purchase Order has been closed."); }
protected void ForceCloseOrder_Click(object sender, EventArgs e) { MessageUserControl.TryRun(() => { // Receive any entered quantities //ReceiveOrder_Click(sender, e); var POid = Convert.ToInt32((PurchaseOrderDetailsGridView.Rows[0].FindControl("POid") as HiddenField).Value); var controller = new ReceivingController(); var closeReason = ForceCloseText.Text; if (closeReason == "") { throw new Exception("Must provide reason for force close."); } controller.ForceCloseOrder(POid, closeReason); // Hide Order Details panel and refresh Orders GridView. OrderPanel.Visible = false; OrderPanel.Enabled = false; OutstandingOrderGridView.DataBind(); }, "Success", "Order was force closed!"); }