public static string DeleteRQMTFromSet(int RQMTSetID, string checkedRQMTIDs, bool globalDelete) { var result = WTSPage.CreateDefaultResult(); string[] ids = checkedRQMTIDs.Split('|'); for (int i = ids.Length - 1; i >= 0; i--) // we go backwards so we can re-order as we go and not delete parents before children { int id = Int32.Parse(ids[i]); if (globalDelete) { DataTable dt = RQMT.RQMT_AssociatedSets_Get(id); foreach (DataRow row in dt.Rows) { RQMT.RQMTSet_DeleteRQMT((int)row["RQMTSetID"], id, 0, true); } } else { RQMT.RQMTSet_DeleteRQMT(RQMTSetID, id, 0, true); } } result["success"] = "true"; return(WTSPage.SerializeResult(result)); }