Advertisement
Flavio1234

permissão classe1

Sep 20th, 2020
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6.  
  7. namespace Permisão
  8. {
  9.     static class Program
  10.     {
  11.         /// <summary>
  12.         /// The main entry point for the application.
  13.         /// </summary>
  14.         [STAThread]
  15.         static void Main()
  16.         {
  17.             Application.EnableVisualStyles();
  18.             Application.SetCompatibleTextRenderingDefault(false);
  19.             Application.Run(new Form1());
  20.         }
  21.  
  22.         public static bool VerificarPermissao(clUtilizador user, int opcao)
  23.         {
  24.             //verifica se o utilizador tem a permisão para acender a funcionalidade
  25.             bool resultado = true;
  26.             if (user.permissoes[opcao] == '0')
  27.                 resultado = false;
  28.  
  29.             if (!resultado)
  30.             {
  31.                 MessageBox.Show("Não tem permissão para esta funcionalidade.", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
  32.             }
  33.  
  34.  
  35.             return resultado;
  36.         }
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement