crearRol() публичный Метод

public crearRol ( string description, List licences, long centro ) : void
description string
licences List
centro long
Результат void
Пример #1
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);
        }
    }
Пример #2
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!
                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>");
        }
    }
Пример #3
0
 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);
 }