protected void Page_Load(object sender, EventArgs e) { //Lista de permisos que el usuario logueado tiene List<String> listaPermisos = (List<String>)Session["Permisos_usuario"]; bool encontroPermiso = false; foreach (String strPermiso in listaPermisos) { //Iteramos los permisos del usuario para comprobar que puede utilizar esta pagina if (strPermiso.Equals("pCrearRole")) { encontroPermiso = true; break; } } if (!encontroPermiso) { //Si no tiene permiso redireccionamos //Response.Write("<script>alert('Usted no posee permisos suficientes para accesar a este recurso')</script>"); Response.Redirect("NoAccess.aspx"); } try { if (!this.IsPostBack) { BL.Permiso per = new Permiso(); permisos_CBList.DataSource = per.getPermisosID(); permisos_CBList.DataBind(); Security sec = new Security(); centros.DataSource = sec.getCentros(); centros.DataBind(); } } catch (Exception ex) { Session["Error_Msg"] = ex.Message; Response.Redirect("~/Error.aspx", true); } }
protected void Page_Load(object sender, EventArgs e) { //Lista de permisos que el usuario logueado tiene List<String> listaPermisos = (List<String>)Session["Permisos_usuario"]; bool encontroPermiso = false; foreach (String strPermiso in listaPermisos) { //Iteramos los permisos del usuario para comprobar que puede utilizar esta pagina if (strPermiso.Equals("pCrearRoles")) { encontroPermiso = true; break; } } if (!encontroPermiso) { //Si no tiene permiso redireccionamos Response.Redirect("Default.aspx"); } try { if (!this.IsPostBack) { BL.Permiso per = new Permiso(); permisos_CBList.DataSource = per.getPermisosID(); permisos_CBList.DataBind(); } } catch (Exception ex) { Response.Write("<script>alert(" + ex.ToString() + " --Crear_Roles.aspx.cs / Page_Load()" + ")</script>"); } }
private void setCheckBoxes() { try { BL.Permiso per = new Permiso(); permisos_CBList.DataSource = per.getPermisosID(); permisos_CBList.DataBind(); } 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(); 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.Permiso per = new Permiso(); permisos_CBList.DataSource = per.getPermisosID(); permisos_CBList.DataBind(); } catch (Exception ex) { Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Permisos.aspx.cs / setCheckBoxes()" + ")</script>"); } }
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); } }