private void btnDeleteGroup_Click(object sender, EventArgs e) { List <DevExpress.XtraTreeList.Nodes.TreeListNode> nodes = treeList1.GetAllCheckedNodes(); if (nodes.Count == 0) { return; } DialogResult dr = XtraMessageBox.Show("确定删除所选分组?", GlobalValue.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Level == 0) { DataRowView drv = treeList1.GetDataRecordByNode(nodes[i]) as DataRowView; int query = NoiseDataBaseHelper.DeleteGroup(Convert.ToInt32(drv["ID"])); if (query == -1) { throw new Exception("数据入库发生错误。"); } } } GlobalValue.ClearText(groupControl2); GlobalValue.ClearText(groupControl3); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); BindTree(); GlobalValue.reReadIdList.Clear(); } }