コード例 #1
0
        public TeacherCoursesForm(int idUser)
        {
            InitializeComponent();

            lblFilter.Visible       = false;
            lblName.Visible         = false;
            lblGroup.Visible        = false;
            pictureFilter.Visible   = false;
            btnClearFilters.Visible = false;
            txtNameFilter.Visible   = false;
            txtGroupFilter.Visible  = false;

            BLTeachers bl = new BLTeachers();

            List <TeachersXCoursesXStudySetModel> list = new List <TeachersXCoursesXStudySetModel>();

            list = bl.GetTeacherCourses(idUser);

            gridTeacherCourses.Columns.Add("CourseId", "Curs");
            gridTeacherCourses.Columns.Add("CourseName", "Nume Curs");
            gridTeacherCourses.Columns.Add("StudySet", "Seria");
            gridTeacherCourses.Columns[0].Visible = false;

            foreach (TeachersXCoursesXStudySetModel course in list)
            {
                gridTeacherCourses.Rows.Add(course.Courses.CourseId, course.Courses.CourseName, course.StudySet);
            }

            gridTeacherCourses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
コード例 #2
0
        private void gridTeacherStudents_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row         = gridTeacherStudents.SelectedRows[0];
            int             entryId     = Convert.ToInt32(row.Cells["EntryId"].Value);
            int             partialExam = Convert.ToInt32(row.Cells["PartialExam"].Value == DBNull.Value ? 0 : row.Cells["PartialExam"].Value);
            int             finalExam   = Convert.ToInt32(row.Cells["FinalExam"].Value == DBNull.Value ? 0 : row.Cells["FinalExam"].Value);
            int             laboratory  = Convert.ToInt32(row.Cells["Laboratory"].Value == DBNull.Value ? 0 : row.Cells["Laboratory"].Value);
            int             seminary    = Convert.ToInt32(row.Cells["Seminary"].Value == DBNull.Value ? 0 : row.Cells["Seminary"].Value);
            int             bonusPoints = Convert.ToInt32(row.Cells["BonusPoints"].Value == DBNull.Value ? 0 : row.Cells["BonusPoints"].Value);
            BLTeachers      bl          = new BLTeachers();

            bl.UpdateCatalogInfo(entryId, partialExam, finalExam, laboratory, seminary, bonusPoints);

            String studentName = String.IsNullOrWhiteSpace(txtNameFilter.Text) == true ? "" : txtNameFilter.Text;
            String studyGroup  = String.IsNullOrWhiteSpace(txtGroupFilter.Text) == true ? "" : txtGroupFilter.Text;

            gridTeacherStudents.Rows.Clear();
            gridTeacherStudents.Columns.Clear();
            List <CatalogInfoModel> list = new List <CatalogInfoModel>();
            DataGridViewRow         row1 = gridTeacherCourses.SelectedRows[0];

            list = bl.GetTeacherStudents(Convert.ToInt32(row1.Cells["CourseId"].Value), row1.Cells["StudySet"].Value.ToString(), studentName, studyGroup);

            gridTeacherStudents.Columns.Add("EntryId", "EntryId");
            gridTeacherStudents.Columns.Add("StudentId", "StudentId");
            gridTeacherStudents.Columns.Add("StudyGroup", "Grupa");
            gridTeacherStudents.Columns.Add("StudentName", "Nume");
            gridTeacherStudents.Columns.Add("Laboratory", "Laborator");
            gridTeacherStudents.Columns.Add("Seminary", "Seminar");
            gridTeacherStudents.Columns.Add("PartialExam", "Examen partial");
            gridTeacherStudents.Columns.Add("FinalExam", "Examen final");
            gridTeacherStudents.Columns.Add("BonusPoints", "Puncte bonus");
            gridTeacherStudents.Columns.Add("Total", "Total");
            gridTeacherStudents.Columns.Add("LastUpdate", "Ultima actualizare");
            gridTeacherStudents.Columns[0].Visible   = false;
            gridTeacherStudents.Columns[1].Visible   = false;
            gridTeacherStudents.Columns[2].ReadOnly  = true;
            gridTeacherStudents.Columns[3].ReadOnly  = true;
            gridTeacherStudents.Columns[9].ReadOnly  = true;
            gridTeacherStudents.Columns[10].ReadOnly = true;

            foreach (CatalogInfoModel catalogInfo in list)
            {
                gridTeacherStudents.Rows.Add(catalogInfo.EntryId, catalogInfo.Student.StudentId, catalogInfo.Student.StudyGroup, catalogInfo.Student.StudentName, catalogInfo.Laboratory, catalogInfo.Seminary,
                                             catalogInfo.PartialExam, catalogInfo.FinalExam, catalogInfo.BonusPoints, catalogInfo.Total, catalogInfo.LastUpdate);
            }
            gridTeacherStudents.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
コード例 #3
0
        private void gridTeacherCourses_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            lblSelectCourse.Text    = "";
            lblFilter.Visible       = true;
            lblName.Visible         = true;
            lblGroup.Visible        = true;
            pictureFilter.Visible   = true;
            btnClearFilters.Visible = true;
            txtNameFilter.Visible   = true;
            txtGroupFilter.Visible  = true;

            gridTeacherStudents.Rows.Clear();
            gridTeacherStudents.Columns.Clear();
            DataGridViewRow         row  = gridTeacherCourses.SelectedRows[0];
            BLTeachers              bl   = new BLTeachers();
            List <CatalogInfoModel> list = new List <CatalogInfoModel>();

            list = bl.GetTeacherStudents(Convert.ToInt32(row.Cells["CourseId"].Value), row.Cells["StudySet"].Value.ToString());

            gridTeacherStudents.Columns.Add("EntryId", "EntryId");
            gridTeacherStudents.Columns.Add("StudentId", "StudentId");
            gridTeacherStudents.Columns.Add("StudyGroup", "Grupa");
            gridTeacherStudents.Columns.Add("StudentName", "Nume");
            gridTeacherStudents.Columns.Add("Laboratory", "Laborator");
            gridTeacherStudents.Columns.Add("Seminary", "Seminar");
            gridTeacherStudents.Columns.Add("PartialExam", "Examen partial");
            gridTeacherStudents.Columns.Add("FinalExam", "Examen final");
            gridTeacherStudents.Columns.Add("BonusPoints", "Puncte bonus");
            gridTeacherStudents.Columns.Add("Total", "Total");
            gridTeacherStudents.Columns.Add("LastUpdate", "Ultima actualizare");
            gridTeacherStudents.Columns[0].Visible   = false;
            gridTeacherStudents.Columns[1].Visible   = false;
            gridTeacherStudents.Columns[2].ReadOnly  = true;
            gridTeacherStudents.Columns[3].ReadOnly  = true;
            gridTeacherStudents.Columns[9].ReadOnly  = true;
            gridTeacherStudents.Columns[10].ReadOnly = true;

            foreach (CatalogInfoModel catalogInfo in list)
            {
                gridTeacherStudents.Rows.Add(catalogInfo.EntryId, catalogInfo.Student.StudentId, catalogInfo.Student.StudyGroup, catalogInfo.Student.StudentName, catalogInfo.Laboratory, catalogInfo.Seminary,
                                             catalogInfo.PartialExam, catalogInfo.FinalExam, catalogInfo.BonusPoints, catalogInfo.Total, catalogInfo.LastUpdate);
            }
            gridTeacherStudents.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }