コード例 #1
0
        public formProfessor(string id, string pass)
        {
            InitializeComponent();



            //login the Professor
            thisProfessor = temp.LoginProfessor(id, pass);

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

            onGoingClassesList = thisProfessor.GetProfessorOnGoingClassesList();

            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;
                }
            }
        }
コード例 #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 = "";
         }
     }
 }