protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();
                int count = 0;

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        admin.eliminarPermiso(it.Text);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permisos Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Permisos.aspx.cs / acceptButton_Click()" + ")</script>");
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();
                int count = 0;

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        admin.eliminarPermiso(it.Text);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permisos Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Beispiel #3
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                List<string> persAdded = new List<string>();

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        persAdded.Add(it.Text);
                        it.Selected = false;
                    }
                }

                AdministradordeSistema admin = new AdministradordeSistema();//tmp-> deberia ser quien este logeado!
                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.crearRol(descripcion_TB.Text, persAdded, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Guardado')", true);
                LimpiarPage();
            }
        }
        catch (Exception err)
        {
            Session["Error_Msg"] = err.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                List<string> persAdded = new List<string>();

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        persAdded.Add(it.Text);
                        it.Selected = false;
                    }
                }

                AdministradordeSistema admin = new AdministradordeSistema();//tmp-> deberia ser quien este logeado!
                admin.crearRol(descripcion_TB.Text, persAdded);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Guardado')", true);
                LimpiarPage();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert(" + ex.ToString() + " --Crear_Roles.aspx.cs /  acceptButton_Click()" + ")</script>");
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            List<string> revokes = new List<string>();
            //bool flag = false;

            foreach (ListItem it in permisos_CBList.Items)
            {
                if (it.Selected == false)
                {
                    revokes.Add(it.Text);
                    //flag = true;
                }
            }

            List<string> grants = new List<string>();

            foreach (ListItem it in otrosPermisos_CBList.Items)
            {
                if (it.Selected == true)
                {
                    grants.Add(it.Text);
                    //flag = true;
                }
            }

            /*if (flag)
            {*/
                BL.Rol rl = new Rol();
                long rolId = rl.getRolID(descripciones_DDList.SelectedItem.Text);
                AdministradordeSistema admin = new AdministradordeSistema();

                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.editarRol(rolId, descripciones_DDList.SelectedItem.Text, grants, revokes, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Editado')", true);
                setCheckBoxes();
            /*}
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol No Editado')", true);
            }*/
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
 public void crearPermisoTest()
 {
     AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value
     string name = "Codig";// TODO: Initialize to an appropriate value
     string description = "Nada"; // TODO: Initialize to an appropriate value
     bool flag=true;
     try
     {
         target.crearPermiso(name, description);
     }
     catch
     {
         flag=false;
     }
     Assert.IsTrue(flag);
 }
 protected void saveButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.IsValid)
         {
             AdministradordeSistema admin = new AdministradordeSistema();
             admin.crearPermiso(nombrePermiso_TB.Text, descripcion_TB.Text);
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Guardado')",true);
             LimpiarPage();
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert(" + ex.ToString() + " --Crear_Permisos.aspx.cs / SaveButton_Click()"+")</script>");
     }
 }
 protected void saveButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.IsValid)
         {
             AdministradordeSistema admin = new AdministradordeSistema();
             admin.crearPermiso(nombrePermiso_TB.Text, descripcion_TB.Text);
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Guardado')",true);
             LimpiarPage();
         }
     }
     catch (Exception err)
     {
         Session["Error_Msg"] = err.Message;
         Response.Redirect("~/Error.aspx", true);
     }
 }
 public void crearRolTest()
 {
     AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value
     string description = "Codigo a ver que onda"; // TODO: Initialize to an appropriate value
     List<string> licences = new List<string>(); // TODO: Initialize to an appropriate value
     licences.Add("Codigo");
     licences.Add("Codi");
     bool flag = true;
     try
     {
         target.crearRol(description, licences, 1);
     }
     catch (Exception)
     {
         flag = false;
     }
     Assert.IsTrue(flag);
 }
Beispiel #10
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Roles.aspx.cs / acceptButton_Click()" + ")</script>");
        }
    }
 public void editarRolTest()
 {
     AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value
     long identity = 18; // TODO: Initialize to an appropriate value
     string description = "Algo"; // TODO: Initialize to an appropriate value
     List<string> grants = new List<string>(); // TODO: Initialize to an appropriate value
     List<string> revokes = new List<string>(); // TODO: Initialize to an appropriate value
     grants.Add("Codi");
     revokes.Add("otro1");
     bool flag = true;
     try
     {
         target.editarRol(identity, description, grants, revokes, 2);
     }
     catch(Exception)
     {
         flag = false;
     }
     Assert.IsTrue(flag);
 }
 public void eliminarRolTest()
 {
     AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value
     long identity = 18; // TODO: Initialize to an appropriate value
     bool flag=true;
     try
     {
         target.eliminarRol(identity);
     }
     catch (Exception)
     {
         flag = false;
     }
     Assert.IsTrue(flag);
 }