Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            fAuth fAuth = new fAuth(fAuth.TypeLoad.Authentication);

            if (fAuth.ShowDialog() == DialogResult.OK)
            {
                if (fAuth.UserRole == null)
                {
                    return;
                }
                Application.Run(new MainForm(fAuth.UserRole, fAuth.UserId));
                //Application.Run(new MainForm("admin"));
            }
        }
Exemple #2
0
 public fUsersView(string userRole, int userId)
 {
     _userId   = userId;
     _userRole = userRole;
     if (_userRole == null || _userRole.Trim().ToLower() != "admin")
     {
         fAuth f = new fAuth(fAuth.TypeLoad.Authentication);
         if (f.ShowDialog() != DialogResult.OK)
         {
             this.Close();
         }
         else
         {
             if (f.UserRole == null || f.UserRole.Trim().ToLower() != "admin")
             {
                 MessageBox.Show($"Пользователь с ролью {f.UserRole} не может использовать данное приложение");
                 this.Close();
             }
         }
     }
     InitializeComponent();
     InitializeLVUsers();
 }