Example #1
0
        private void btn_LogIn_Click(object sender, EventArgs e)
        {
            var CorrectPassword = businessManager.VerifyLogIn(textBoxLogin.Text, textBoxLogInAlumniPassword.Text);

            if (CorrectPassword)
            {
                MessageBox.Show("you successfully logged in");
                if (businessManager.AlumnLogIn())
                {
                    AlumniActivities alumniActivities = new AlumniActivities(businessManager);
                    alumniActivities.ShowDialog();
                }
                else
                {
                    AdminMeny adminMeny = new AdminMeny(businessManager);
                    adminMeny.ShowDialog();
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Username or password are incorrect", "Try again",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.No)
                {
                    Application.Exit();
                }
            }

            //Lisa","Karlsson","*****@*****.**","karlsson

            //Global.CurrentUser = businessManager.GetUser(textBoxLogin.Text, textBoxLogInAlumniPassword.Text);

            //if (Global.CurrentUser == null)
            //{
            //    MessageBox.Show("Try again");
            //}
            //else
            //{
            //      if(businessManager.IsEmployee(Global.CurrentUser))
            //    {
            //        this.Visible = !this.Visible;
            //        AdminMeny adminMeny = new AdminMeny();
            //        if (adminMeny.ShowDialog() == DialogResult.OK)
            //            this.Visible = !this.Visible;
            //    }
            //      if(businessManager.IsAlumnus(Global.CurrentUser))
            //    {
            //        this.Visible = !this.Visible;
            //        AlumniMeny alumniMeny = new AlumniMeny();
            //        if (alumniMeny.ShowDialog() == DialogResult.OK)
            //            this.Visible = !this.Visible;
            //    }
        }