Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (loginhandler.Authenticate(tbox_Username.Text, tbox_Password.Text))
            {
                User authenticateduser = loginhandler.GetUser(tbox_Username.Text);

                // ^ Above user is logged in, put Form code below inside this if-statement

                // Client
                if (authenticateduser is Client)
                {
                    Form_MainClient MainScreen = new Form_MainClient(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
                // Volunteer
                if (authenticateduser is Volunteer)
                {
                    Form_MainVolunteer MainScreen = new Form_MainVolunteer(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
                // Admin
                if (authenticateduser is Admin)
                {
                    Form_MainAdmin MainScreen = new Form_MainAdmin(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (loginhandler.Authenticate(tbox_Username.Text, tbox_Password.Text))
            {
                User authenticateduser = loginhandler.GetUser(tbox_Username.Text);

                // ^ Above user is logged in, put Form code below inside this if-statement

                // Client
                if (authenticateduser is Client)
                {
                    Form_MainClient MainScreen = new Form_MainClient(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
                // Volunteer
                if (authenticateduser is Volunteer)
                {
                    Form_MainVolunteer MainScreen = new Form_MainVolunteer(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
                // Admin
                if (authenticateduser is Admin)
                {
                    Form_MainAdmin MainScreen = new Form_MainAdmin(authenticateduser);
                    this.Hide();
                    tbox_Password.Text = string.Empty;
                    tbox_Username.Text = string.Empty;
                    MainScreen.ShowDialog();
                    this.Show();
                }
            }
        }