Пример #1
0
 private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         UserCtx.Logout(ref uctx);
         InitialHideComponents();
     }
     catch (System.Security.SecurityException se)
     {
         MessageBox.Show("Permission denied " + se.Message);
     }
     catch (Exception se)
     {
         MessageBox.Show(se.Message);
     }
     label1.Text = "Not logged in";
     this.listBox1.Items.Clear();
     this.listBox2.Items.Clear();
 }
Пример #2
0
        private void zalogujToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var logging = new Login();
            var result  = logging.ShowDialog();

            if (result == DialogResult.OK)

            {
                string username = logging.ReturnValue1;            //values preserved after close
                string password = logging.ReturnValue2;

                bool loggingResult = UserCtx.Login(username, password, out _userCtx);
                ShowComponents(_userCtx);
                if (!loggingResult)
                {
                    MessageBox.Show("Błąd logowania: nieprawidłowy login lub hasło. \nSpróbuj ponownie");
                }
                if (!_userCtx.HasRoleRight(Operation.Admin))
                {
                    MessageBox.Show("Użytkownik nie posiada praw administratora");
                    UserCtx.Logout(ref _userCtx);
                }
            }
        }
Пример #3
0
 private void wylogujToolStripMenuItem_Click(object sender, EventArgs e)
 {
     UserCtx.Logout(ref _userCtx);
 }