// 移除记录仪 private void btnDelRecFromGroup_Click(object sender, EventArgs e) { try { //DialogResult dr = XtraMessageBox.Show("确定移除该记录仪?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (dr == System.Windows.Forms.DialogResult.Yes) //{ List <DevExpress.XtraTreeList.Nodes.TreeListNode> nodes = treeList1.GetAllCheckedNodes(); foreach (DevExpress.XtraTreeList.Nodes.TreeListNode item in nodes) { if (item.Level == 1) { int recID = Convert.ToInt32(item.GetValue("ID")); int gID = Convert.ToInt32(item.ParentNode.GetValue("Name")); for (int i = 0; i < GlobalValue.recorderList.Count; i++) { if (GlobalValue.recorderList[i].ID == recID) { GlobalValue.recorderList[i].GroupState = 0; NoiseDataBaseHelper.UpdateRecorder(GlobalValue.recorderList[i]); break; } } int query = NoiseDataBaseHelper.DeleteOneRelation(recID, gID); if (query != -1) { } } } btnDelRecFromGroup.Enabled = false; //NoiseRecorderGroup gp = (from temp in GlobalValue.groupList // where temp.ID == gID // select temp).ToList()[0]; //gp.RecorderList = NoiseDataBaseHelper.GetRecordersByGroupId(gp.ID); GlobalValue.recorderList = NoiseDataBaseHelper.GetRecorders(); GlobalValue.groupList = NoiseDataBaseHelper.GetGroups(); BindTree(); BindListBox(); GlobalValue.reReadIdList.Clear(); //} } catch (Exception ex) { XtraMessageBox.Show("移除失败:" + ex.Message, GlobalValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }