コード例 #1
0
        private void Login_btn_Click(object sender, EventArgs e)
        {
            string username = User_name_text.Text;
            string password = Password_txt.Text;
            string message, user;
            string message2 = "verified";

            user = ob.getUser(username);

            if (user.Equals("User Not Found"))
            {
                label2.Text = user;
            }
            else
            {
                usertype = ob.userType();
                message  = ob.passwordVerification(password);
                if (message2.Equals(message))
                {
                    if (usertype.Equals("Student"))
                    {
                        this.Hide();
                        StudentF objSF = new StudentF();
                        objSF.start(user, usertype);
                        objSF.ShowDialog();
                        this.Close();
                    }
                    else if (usertype.Equals("Teacher"))
                    {
                        this.Hide();
                        TeacherF objTF = new TeacherF();
                        objTF.start(user, usertype);
                        objTF.ShowDialog();
                        this.Close();
                    }
                    else if (usertype.Equals("Staff"))
                    {
                        this.Hide();
                        StaffF objSTF = new StaffF();
                        objSTF.start(user, usertype);
                        objSTF.ShowDialog();
                        this.Close();
                    }
                    else if (usertype.Equals("Admin"))
                    {
                        this.Hide();
                        AdminF obAF = new AdminF();
                        obAF.start(user, usertype);
                        obAF.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    label2.Text = message;
                }
            }
        }
コード例 #2
0
        private void button5_Click_1(object sender, EventArgs e)
        {
            string userid   = textBox8.Text;
            string usertype = temp.getUsertype(userid);

            if (usertype.Equals("Student"))
            {
                StudentF objSF = new StudentF();
                objSF.start(userid, usertype);
                objSF.ShowDialog();
            }
            else if (usertype.Equals("Teacher"))
            {
                TeacherF objTF = new TeacherF();
                objTF.start(userid, usertype);
                objTF.ShowDialog();
            }
            else if (usertype.Equals("Staff"))
            {
                StaffF objSTF = new StaffF();
                objSTF.start(userid, usertype);
                objSTF.ShowDialog();
            }
        }