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")); } }
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(); }