protected void AddRoleMaster(int masterid) { for (int i = 0; i < ckblRole.Items.Count; i++) { if (ckblRole.Items[i].Selected && !RoleInfo.IsRoleMasters(masterid, Convert.ToInt32(ckblRole.Items[i].Value))) {//选中且rolemaster表中不存在 RoleMasterInfo role = new RoleMasterInfo(); role.MasterId = masterid; role.RoleId = Convert.ToInt32(ckblRole.Items[i].Value); role.Save(); } else if (!ckblRole.Items[i].Selected && RoleInfo.IsRoleMasters(masterid, Convert.ToInt32(ckblRole.Items[i].Value))) { RoleInfo.DelRoles(masterid, Convert.ToInt32(ckblRole.Items[i].Value)); } } }