Beispiel #1
0
        //primary amdin login, that will be changed later
        private void Login_Click(object sender, EventArgs e)
        {
            Connect2DB con = new Connect2DB();

            if (con.isUserRegistered(Username.Text, Password.Text))
            {
                if (con.isUserAdmin(Username.Text) == "a")
                {
                    Admin admin = new Admin();
                    admin.Show();
                    this.Hide();
                    admin.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
                }
                else if (con.isUserAdmin(Username.Text) == "u")
                {
                    Users userForm = new Users(Username.Text, Password.Text);
                    userForm.Show();
                    this.Hide();
                    userForm.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
                }
                else
                {
                    ErrorMessage.Text    = "Your registration request is treated!";
                    ErrorMessage.Visible = true;
                }
            }
            else
            {
                ErrorMessage.Text    = "Invalid email or password!";
                ErrorMessage.Visible = true;
            }
        }
Beispiel #2
0
        //primary amdin login, that will be changed later
        private void Login_Click(object sender, EventArgs e)
        {
            Connect2DB con = new Connect2DB();

            if (con.isUserRegistered(Username.Text, Password.Text))
            {
                if (con.isUserBlocked(Username.Text))
                {
                    ErrorMessage.Text    = "Your account is blocked.\nPlease contact your library.";
                    ErrorMessage.Visible = true;
                }
                else
                {
                    if (con.isUserAdmin(Username.Text) == "admin")
                    {
                        FormAdminInterface admin = new FormAdminInterface(Username.Text, Password.Text);
                        admin.Show();
                        this.Hide();
                        admin.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
                    }
                    else if (con.isUserAdmin(Username.Text) == "user")
                    {
                        FormUserInterface userForm = new FormUserInterface();
                        userForm.Show();
                        this.Hide();
                        userForm.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
                    }
                    else
                    {
                        ErrorMessage.Text    = "Your registration request is treated!";
                        ErrorMessage.Visible = true;
                    }
                }
            }
            else
            {
                ErrorMessage.Text    = "Invalid email or password!";
                ErrorMessage.Visible = true;
            }
        }