public formStudent(string id, string pass)
        {
            InitializeComponent();
            itemColor();
            //login the student
            thisStudent = temp.LoginStudent(id, pass);

            //disShow TA icon
            if (thisStudent.GetAccessLevel() == 1)
            {
                iconStudentToTa.Visible = false;
            }
            else
            {
                iconStudentToTa.Visible = true;
            }

            if (mode == false)
            {
                //in a simple student mode

                //sorted by professor name
                onGoingClassesList =
                    thisStudent.GetStudentOnGoingClassesList();

                if (onGoingClassesList.Count != 0)
                {
                    dataGridViewTab1.Rows.Clear();
                    dataGridViewTab1.RowCount = onGoingClassesList.Count;
                    for (int i = 0; i < onGoingClassesList.Count; i++)
                    {
                        dataGridViewTab1.Rows[i].Cells["Course"].Value    = onGoingClassesList[i].nameCourse;
                        dataGridViewTab1.Rows[i].Cells["TA"].Value        = onGoingClassesList[i].fullNameTA;
                        dataGridViewTab1.Rows[i].Cells["Professor"].Value = onGoingClassesList[i].fullNameProfessor;
                        dataGridViewTab1.Rows[i].Cells["Grade"].Value     = onGoingClassesList[i].grade;
                    }
                }
            }
        }
Exemple #2
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     id   = textBoxId.Text;
     pass = textBoxPassword.Text;
     if (radioButtonStudent.Checked == true)
     {
         classStudent accountStudent = null;
         accountStudent = temp.LoginStudent(id, pass);
         if (accountStudent != null)
         {
             formStudent formForStudent = new formStudent(id, pass);
             formForStudent.Show();
         }
         else
         {
             MessageBox.Show("Username or password is wrong!");
             textBoxId.Text       = "";
             textBoxPassword.Text = "";
         }
     }
     else if (radioButtonProfessor.Checked == true)
     {
         classProfessor accountProfessor = null;
         accountProfessor = temp.LoginProfessor(id, pass);
         if (accountProfessor != null)
         {
             formProfessor formForProfessor = new formProfessor(id, pass);
             //formProfessor.te
             formForProfessor.Show();
         }
         else
         {
             MessageBox.Show("Username or password is wrong!");
             textBoxId.Text       = "";
             textBoxPassword.Text = "";
         }
     }
 }