Esempio n. 1
0
        private void AddStudent_submitBtn_Click(object sender, EventArgs e)
        {
            AddStudent_warningLbl.Visible = false;
            if (AddStudent_stdID_TextBox.Text != "")
            {
                //"-2" means "wrong idStudent", "-3" means "idStudent = idTA", "-4" means "student_class relation already exists and not deleted", "-1" means "general error" and "1" means "done"

                classBase tempbase = new classBase();
                int       result   = thisPractisClass.AddStudentToClass(AddStudent_stdID_TextBox.Text);
                switch (result)
                {
                case 1:

                    selectedClassStudents = thisPractisClass.GetClassStudentList();

                    //show the students in it's GridView
                    dataGridView_StudentList.Rows.Clear();
                    if (selectedClassStudents.Count != 0)
                    {
                        dataGridView_StudentList.RowCount = selectedClassStudents.Count;
                        for (int i = 0; i < selectedClassStudents.Count; i++)
                        {
                            dataGridView_StudentList.Rows[i].Cells["StudentID"].Value   = selectedClassStudents[i].id;
                            dataGridView_StudentList.Rows[i].Cells["StudentName"].Value = selectedClassStudents[i].fullName;
                        }
                    }
                    AddStudent_stdID_TextBox.Text = "";

                    break;

                case -2:
                    AddStudent_warningLbl.Text    = "wrong idStudent";
                    AddStudent_warningLbl.Visible = true;
                    break;

                case -3:
                    AddStudent_warningLbl.Text    = "idStudent = idTA";
                    AddStudent_warningLbl.Visible = true;
                    break;

                case -4:
                    AddStudent_warningLbl.Text    = "student_class relation already exists and not deleted";
                    AddStudent_warningLbl.Visible = true;
                    break;

                case -1:
                    AddStudent_warningLbl.Text    = "general error";
                    AddStudent_warningLbl.Visible = true;
                    break;
                }
            }
            else
            {
                AddStudent_warningLbl.Text    = "Required Input";
                AddStudent_warningLbl.Visible = true;
            }
        }
Esempio n. 2
0
        private void goto_Student_Btn_Click(object sender, EventArgs e)
        {
            {
                //rename the title's of practice class page
                Tab7_nameCourseLable.Text = onGoingClassesList[rowIndexTab1].nameCourse;
                Tab7_ProfessorLable.Text  = onGoingClassesList[rowIndexTab1].fullNameProfessor;
                Tab7_TALable.Text         = onGoingClassesList[rowIndexTab1].fullNameTA;

                //make a list from practice that TA or professor uploaded
                database_practiceclass db = new database_practiceclass();
                thisPractisClass = new classPracticeClass(onGoingClassesList[rowIndexTab1].term,
                                                          onGoingClassesList[rowIndexTab1].year, onGoingClassesList[rowIndexTab1].groupNumber);

                selectedClassStudents = new List <ShowStudent>();
                selectedClassStudents = thisPractisClass.GetClassStudentList();


                //------------------------------------------------------------------------------------------------------------------------

                //show the students in it's GridView
                dataGridView_StudentList.Rows.Clear();
                if (selectedClassStudents.Count != 0)
                {
                    dataGridView_StudentList.RowCount = selectedClassStudents.Count;
                    for (int i = 0; i < selectedClassStudents.Count; i++)
                    {
                        dataGridView_StudentList.Rows[i].Cells["StudentID"].Value   = selectedClassStudents[i].id;
                        dataGridView_StudentList.Rows[i].Cells["StudentName"].Value = selectedClassStudents[i].fullName;
                    }
                }

                //go to practice class page
                tabControl1.SelectTab(tabPage7);
                iconHome.Visible = true;
            }
        }