private bool RemoveItemsFromRouting(List <TDCShipment> shipmentsToRemoveFromRouting) { bool success = false; try { success = RoutingController.RemoveItemsFromRouting(shipmentsToRemoveFromRouting, User.Identity.Name, RoutingHistoryId.Value); } catch (Exception e) { if (ExceptionPolicy.HandleException(e, "User Interface")) { DisplayMessage("There was a problem removing the selected Shipments."); } } if (!success) { DisplayMessage("There was a problem removing the selected Shipments."); } else { ShipmentIdsToRemoveFromRouting.Clear(); } return(success); }
protected void GridViewShipmentsToRefine_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //re-check all checked items for the page of data the user is about to view bool check = (ShipmentIdsToRemoveFromRouting.IndexOf( (int)GridViewShipmentsToRefine.DataKeys[e.Row.DataItemIndex].Value) > -1 ? true : false); GetControl <CheckBox>("CheckBoxRemove", e.Row).Checked = check; } }
protected void CheckBoxRemove_CheckedChanged(object sender, EventArgs e) { //get the checkbox CheckBox removeCheckBox = (CheckBox)sender; //get the id of the shipment line checked int id = (int)GridViewShipmentsToRefine.DataKeys[((GridViewRow)removeCheckBox.NamingContainer).RowIndex].Value; if (removeCheckBox.Checked) { ShipmentIdsToRemoveFromRouting.Add(id); } else { ShipmentIdsToRemoveFromRouting.Remove(id); } }