Esempio n. 1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            try
            {
                string
                    email    = textBox9.Text,
                    password = textBox8.Text;
                if (Users.HasUser(email, password))
                {
                    Hide();
                    User user = Users.GetUser(email, password);
                    Session.User  = user;
                    Session.Form1 = this;
                    if (user.UserRole == UserRole.Admin)
                    {
                        AdminPanel adminPanel = Session.AdminPanel == null ? new AdminPanel() : Session.AdminPanel;
                        adminPanel.ShowDialog();
                    }
                    if (user.UserRole == UserRole.User)

                    {
                        DashBoard dashBoard = Session.DashBoard == null ? new DashBoard() : Session.DashBoard;
                        dashBoard.ShowDialog();
                    }
                }
            }
            catch (ArgumentNullException exp)
            {
                MessageBox.Show(exp.Message);
            }
            catch (InvalidEmailException exp)
            {
                MessageBox.Show(exp.Message);
            }
            catch (InvalidPasswordException exp)
            {
                MessageBox.Show(exp.Message);
            }
            finally
            {
                EmptyTextboxes(textBox9, textBox8);
            }
        }
Esempio n. 2
0
        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            AdminPanel adminPanel = Session.AdminPanel == null ? new AdminPanel() : Session.AdminPanel;

            adminPanel.ShowDialog();
        }