Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (PermListSelec.Items.Count <= 0)
            {
                Notification.Show("Necesitas seleccionar los permisos para este rol.", AlertType.warm);
                return;
            }
            if (txtRolName.Text == "")
            {
                Notification.Show("El nombre del rol es necesario", AlertType.warm);
                return;
            }

            Rol r = new Rol();

            r.nombre_rol = txtRolName.Text;
            int        id_rol   = rc.store(r);
            List <int> id_perms = new List <int>();

            foreach (String item in PermListSelec.Items)
            {
                id_perms.Add(int.Parse(item.Split(':')[0].Substring(1)));
            }
            rc.store_RolPermiso(id_perms, id_rol);
            Notification.Show("Rol creado con exito", AlertType.ok);
        }