private void setCheckBoxes() { try { BL.Rol rl = new Rol(); List<string> pers = rl.getRolPermisos(descripciones_DDList.SelectedItem.Text); permisos_CBList.DataSource = pers; permisos_CBList.DataBind(); foreach (ListItem it in permisos_CBList.Items) it.Selected = true; BL.Permiso per = new Permiso(); List<string> otherPers = new List<string>(); List<string> allPers = per.getPermisosID(); foreach (string pr in allPers) { bool flag = false; foreach (string myper in pers) { if (pr == myper) { flag = true; break; } } if (!flag) otherPers.Add(pr); } otrosPermisos_CBList.DataSource = otherPers; otrosPermisos_CBList.DataBind(); long c_id = rl.getCentroID(descripciones_DDList.SelectedItem.Text); BL.Centro c = new BL.Centro(); string c_lugar = c.getLugar(c_id); centros.SelectedValue = c_lugar; /*for (int i = 0; i < centros.Items.Count; i++) { if (centros.Items[i].Text == c_lugar) { centros.Items[i].Selected = true; break; } }*/ } catch (Exception ex) { Session["Error_Msg"] = ex.Message; Response.Redirect("~/Error.aspx", true); } }
private void setCheckBoxes() { try { BL.Rol rl = new Rol(); List<string> pers = rl.getRolPermisos(descripciones_DDList.SelectedItem.Text); permisos_CBList.DataSource = pers; permisos_CBList.DataBind(); foreach (ListItem it in permisos_CBList.Items) it.Selected = true; BL.Permiso per = new Permiso(); List<string> otherPers = new List<string>(); List<string> allPers = per.getPermisosID(); foreach (string pr in allPers) { bool flag = false; foreach (string myper in pers) { if (pr == myper) { flag = true; break; } } if (!flag) otherPers.Add(pr); } otrosPermisos_CBList.DataSource = otherPers; otrosPermisos_CBList.DataBind(); } catch (Exception ex) { Session["Error_Msg"] = ex.Message; Response.Redirect("~/Error.aspx", true); } }