Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool valid = false;
            int userNdx = -1;
            int length = UserList.Count;

            for(int i = 0; i < length; ++i)
            {
                if (UsernameText.Text == UserList[i].UserName)
                {
                    valid = true;
                    userNdx = i;
                    i = length;
                }
            }

            if (valid && (UserList[userNdx].isPassword(passwordText.Text)))
            {

                if (UserList[userNdx].Status == "faculty")
                {
                    FacultyMain fctmain = new FacultyMain(ref Courses, ref UserList, ref UserList[userNdx] );
                    fctmain.Show();
                    this.Close();
                }

                else if (UserList[userNdx].Status == "admin")
                {
                    AdminForm adm = new AdminForm(ref Courses, ref UserList, ref UserList[userNdx]);
                    adm.Show();
                    this.Close();
                }
                else
                {
                    Form3 frm3 = new Form3( ref Courses, ref UserList, ref UserList[userNdx]);
                    frm3.Show();
                    this.Close();
                }
            }
            else
            {
                UsernameText.Text = "";
                UsernameText.Focus();
                passwordText.Text = "";
                IncorrectLabel.Visible = true;
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool valid   = false;
            int  userNdx = -1;
            int  length  = UserList.Count;

            for (int i = 0; i < length; ++i)
            {
                if (UsernameText.Text == UserList[i].UserName)
                {
                    valid   = true;
                    userNdx = i;
                    i       = length;
                }
            }

            if (valid && (UserList[userNdx].isPassword(passwordText.Text)))
            {
                if (UserList[userNdx].Status == "faculty")
                {
                    FacultyMain fctmain = new FacultyMain(ref Courses, ref UserList, ref UserList[userNdx]);
                    fctmain.Show();
                    this.Close();
                }

                else if (UserList[userNdx].Status == "admin")
                {
                    AdminForm adm = new AdminForm(ref Courses, ref UserList, ref UserList[userNdx]);
                    adm.Show();
                    this.Close();
                }
                else
                {
                    Form3 frm3 = new Form3(ref Courses, ref UserList, ref UserList[userNdx]);
                    frm3.Show();
                    this.Close();
                }
            }
            else
            {
                UsernameText.Text = "";
                UsernameText.Focus();
                passwordText.Text      = "";
                IncorrectLabel.Visible = true;
            }
        }