예제 #1
0
 public void Start()
 {
     if (AuthManager.GetInstance().UserRoles.Exists((string el) => { return(el == "admin"); }))
     {
         _roles = _httpConnector.GetRoles();
         string errorMessage = _httpConnector.LastErrorMessage;
         if (errorMessage == null)
         {
             _accountForm.Roles      = _roles;
             _accountForm.DataSource = _httpConnector.GetUsers();
             errorMessage            = _httpConnector.LastErrorMessage;
             if (errorMessage == null)
             {
                 _accountForm.EnableUserView = true;
             }
         }
         if (errorMessage != null)
         {
             MessageBox.Show(errorMessage);
         }
     }
     _accountForm.SetActions(ChangePassword, AddUser, UpdateUser, DeleteUser);
     _passwordForm.FormClosing += SavePassword;
     _accountForm.ShowDialog();
 }
예제 #2
0
 /// <summary>
 /// Start kontrolera. Przygotowuje dostępne akcje w formularzu w zależności od roli użytkownika
 /// </summary>
 public void Start()
 {
     if (AuthManager.GetInstance().UserRoles.Exists((string el) => { return(el == "admin"); }))
     {
         _roles = _httpConnector.GetRoles();
         string errorMessage = _httpConnector.LastErrorMessage;
         if (errorMessage == null)
         {
             _accountForm.DataSource = _httpConnector.GetUsers();
             errorMessage            = _httpConnector.LastErrorMessage;
             if (errorMessage == null)
             {
                 _accountForm.SetActions(AddUser, UpdateUser, DeleteUser);
                 _accountForm.ShowDialog();
             }
         }
         if (errorMessage != null)
         {
             MessageBox.Show(errorMessage);
         }
     }
     else
     {
         MessageBox.Show("Brak uprawnień");
     }
 }