//methods public classPracticeClass(bool term, short numberYearFromStart, short groupNumber) { //set basic data this.database = new database_practiceclass(); this.term = term; this.numberYearFromStart = numberYearFromStart; this.groupNumber = groupNumber; //get other basic data from database var temp = from practiceClass in database.viewlistclass where ( practiceClass.numberYearFromStart == this.numberYearFromStart && practiceClass.termPracticeClass == this.term && practiceClass.groupeNumberPracticeClass == this.groupNumber ) select new { nameCourse = practiceClass.nameCourse, //idCourse = practiceClass.idCourse, fullNameTA = practiceClass.tafn + " " + practiceClass.taln, idTA = practiceClass.idTA, fullNameProfessor = practiceClass.prffn + " " + practiceClass.pfln, idProfessor = practiceClass.idProfessor, }; //this.idCourse = temp.First().idCourse; this.nameCourse = temp.First().nameCourse.ToString(); this.idProfessor = temp.First().idProfessor; this.fullNameProfessor = temp.First().fullNameProfessor; this.idTA = temp.First().idTA; this.fullNameTA = temp.First().fullNameTA; this.idCourse = this.database.table_course.Where(course => course.nameCourse == this.nameCourse).First().idCourse; }
private void dataGridViewTab1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) { if (labelTab1Title.Text != "Archive") { rowIndexTab1 = dataGridViewTab1.CurrentRow.Index; labelTab1Title.Text = rowIndexTab1.ToString(); { //rename the title's of practice class page labelTab2NameCourse.Text = onGoingClassesList[rowIndexTab1].nameCourse; labelTab2NameProfessor.Text = onGoingClassesList[rowIndexTab1].fullNameProfessor; labelTab2NameTa.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); selectedClassPractice = new List <ShowPractice>(); selectedClassPractice = thisPractisClass.GetClassPracticeList(); //show the practice in it's GridView dataGridViewTab2Practice.Rows.Clear(); if (selectedClassPractice.Count != 0) { dataGridViewTab2Practice.RowCount = selectedClassPractice.Count; for (int i = 0; i < selectedClassPractice.Count; i++) { dataGridViewTab2Practice.Rows[i].Cells["Tab2NumberPractice"].Value = selectedClassPractice[i].number; dataGridViewTab2Practice.Rows[i].Cells["Tab2PartPractice"].Value = selectedClassPractice[i].part; //dataGridViewTab2Practice.Rows[i].Cells["tab2GradePractice"].Value = selectedClassPractice[i].; dataGridViewTab2Practice.Rows[i].Cells["tab2UploadPractice"].Value = global::PracticeClass.Properties.Resources.Icon_feather_upload_2x; dataGridViewTab2Practice.Rows[i].Cells["tab2DownloadPractice"].Value = global::PracticeClass.Properties.Resources.Icon_feather_download_2x; } } //make data grid view for quiz selectedClassQuiz = thisPractisClass.GetClassQuizList(); dataGridViewTab2Quiz.Rows.Clear(); if (selectedClassPractice.Count != 0) { dataGridViewTab2Quiz.RowCount = selectedClassQuiz.Count; for (int i = 0; i < selectedClassPractice.Count; i++) { dataGridViewTab2Quiz.Rows[i].Cells["Tab2NumberPractice"].Value = selectedClassQuiz[i].number; dataGridViewTab2Quiz.Rows[i].Cells["Tab2PartPractice"].Value = selectedClassQuiz[i].date; // dataGridViewTab2Quiz.Rows[i].Cells["tab2UploadPractice"].Value = selectedClassQuiz[i].; } } //go to practice class page tabControl1.SelectTab(tabPage2); iconHome.Visible = true; } } }
///Class Methods public classBase() { database = new database_practiceclass(); //test basic data //set basic App Datas //term=this.database.table_systemDatas.termNow; term = true; //numberYearFromStart= this.database.table_systemDatas.numberYearNow; numberYearFromStart = 98; }
//methods public classStudent(string newID, database_practiceclass newDatabase, bool newIsTA, short newNumberYearFromStart, bool newTerm) { //set values on creat this.id = newID; this.accessLevel = newIsTA ? 2 : 1; this.database = newDatabase; this.numberYearFromStart = newNumberYearFromStart; this.term = newTerm; var firstAndLastName = from strudent in database.table_user where (strudent.idUser == this.id) select new { firstName = strudent.firstNameUser, lastName = strudent.lastNameUser }; this.firstName = firstAndLastName.First().firstName; this.lastName = firstAndLastName.First().lastName; }
//methods public classProfessor(string newID, database_practiceclass newDatabase, bool newIsPrimeProfessor, short newNumberYearFromStart, bool newTerm) { //set values on creat this.id = newID; this.accessLevel = newIsPrimeProfessor ? 4 : 3; this.database = newDatabase; this.numberYearFromStart = newNumberYearFromStart; this.term = newTerm; var firstAndLastName = from professor in database.table_user where (professor.idUser == this.id) select new { firstName = professor.firstNameUser, lastName = professor.lastNameUser }; this.firstName = firstAndLastName.First().firstName; this.lastName = firstAndLastName.First().lastName; }
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; } }