private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e) { //MainHelper.PlatformSqlMap.DeleteByWhere<rRoleFun>(" where FunID='" + checkedListBoxControl1.Items[e.Index].Value + "'"); rRoleFun md = new rRoleFun(); md.FunID = checkedListBoxControl1.Items[e.Index].Value.ToString(); md.RoleID = this.mRoleID; if (e.State == CheckState.Checked) { MainHelper.PlatformSqlMap.Create<rRoleFun>(md); } else { MainHelper.PlatformSqlMap.Delete<rRoleFun>(md); } }
private void allCheckEdit_CheckedChanged(object sender, EventArgs e) { if (uCmFunctionTree1.FocusedNode.Checked == false) { allCheckEdit.CheckState = CheckState.Unchecked; return; } for (int i = 0; i < checkedListBoxControl1.Items.Count; i++) { if (checkedListBoxControl1.Items[i].CheckState == allCheckEdit.CheckState) continue; checkedListBoxControl1.Items[i].CheckState = allCheckEdit.CheckState; rRoleFun md = new rRoleFun(); md.FunID = checkedListBoxControl1.Items[i].Value.ToString(); md.RoleID = this.mRoleID; //MainHelper.PlatformSqlMap.DeleteByWhere<rRoleFun>(" where FunID='" + checkedListBoxControl1.Items[i].Value + "'"); MainHelper.PlatformSqlMap.Delete<rRoleFun>(md); if (checkedListBoxControl1.Items[i].CheckState == CheckState.Checked) { MainHelper.PlatformSqlMap.Create<rRoleFun>(md); } } }