コード例 #1
0
        private void AddClass_submitButt_Click(object sender, EventArgs e)
        {
            addClass_warningLbl.Visible = false;
            if (AddClass_TATextbox.Text != "" && AddClass_courseTextbox.Text != "")
            {
                classBase tempbase = new classBase();
                int       result   = tempbase.AddNewPracticeClass(AddClass_courseTextbox.Text, AddClass_courseTextbox.Text, tempbase.get_numberyear(), tempbase.get_term());

                switch (result)
                {
                case 1:

                    if (buttonTab1Archve.Text != "Archive")
                    {
                        dataGridViewTab1.Rows.Clear();
                        List <ShowClass> onGoingClassesList = new List <ShowClass>();
                        onGoingClassesList = thisProfessor.GetProfessorOnGoingClassesList();
                        if (onGoingClassesList.Count != 0)
                        {
                            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;
                            }
                        }
                    }

                    break;

                case -2:
                    AddStudent_warningLbl.Text    = "access violation";
                    AddStudent_warningLbl.Visible = true;
                    break;

                case -3:
                    AddStudent_warningLbl.Text    = "wrong course";
                    AddStudent_warningLbl.Visible = true;
                    break;

                case -4:
                    AddStudent_warningLbl.Text    = "wrong idTA";
                    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;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
        private void buttonTab3SaveNewPassword_Click(object sender, EventArgs e)
        {
            //Change the password for student
            classBase baseItem = new classBase();

            if (labelTab3TitleCurrentPassword.Text == labelTab3RepeatNewPassword.Text)
            {
                if (baseItem.EditUser("", "", labelTab3NewPass.Text) == 1)
                {
                    MessageBox.Show("You changed the password successfuly.");
                }
                else
                {
                    MessageBox.Show("Somthing is false. try agin later.");
                }
            }
        }
コード例 #4
0
        private void buttonTab3SaveNewPassword_Click(object sender, EventArgs e)
        {
            //Change the password for student
            classBase baseItem = new classBase();

            if (bunifuMaterialTextboxTab3NewPassword.Text == bunifuMaterialTextboxTab3RepeatNewPassword.Text)
            {
                if (baseItem.EditUser("", "", bunifuMaterialTextboxTab3NewPassword.Text) == 1)
                {
                    MessageBox.Show("You changed the password successfuly.");
                }
                else
                {
                    MessageBox.Show("Somthing is false. try agin later.");
                }
            }
            else
            {
                MessageBox.Show("Please enter correct information.");
            }
        }
コード例 #5
0
        private void labelTab2NameCourse_Click(object sender, EventArgs e)
        {
            //disply resourses of course
            classBase           baseItem           = new classBase();
            List <ShowResource> thisCourseResource = new List <ShowResource>();

            thisCourseResource = baseItem.GetCourseResourcesList(thisPractisClass.getIDCourse());
            dataGridViewTab4.Rows.Clear();
            if (thisCourseResource.Count != 0)
            {
                dataGridViewTab4.RowCount = thisCourseResource.Count;
                for (int i = 0; i < thisCourseResource.Count; i++)
                {
                    dataGridViewTab4.Rows[i].Cells[0].Value = thisCourseResource[i].numberResource;
                    dataGridViewTab4.Rows[i].Cells[1].Value = thisCourseResource[i].nameResource;
                    dataGridViewTab4.Rows[i].Cells[2].Value = thisCourseResource[i].linkResource;
                }
            }
            labelTab4nameCourse.Text = labelTab2NameCourse.Text;

            tabControl1.SelectTab(tabPage4);
        }