Example #1
0
        private void FillGrid()
        {
            long      course     = (comboCourse.SelectedIndex == 0) ? 0:_listSchoolCourses[comboCourse.SelectedIndex - 1].SchoolCourseNum;
            long      instructor = (comboInstructor.SelectedIndex == 0) ? 0:_listInstructor[comboInstructor.SelectedIndex - 1].ProvNum;
            DataTable table      = Evaluations.GetFilteredList(DateTime.Parse(textDateStart.Text), DateTime.Parse(textDateEnd.Text), textLastName.Text, textFirstName.Text, PIn.Long(textProvNum.Text), course, instructor);

            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableEvaluations", "Date"), 70, HorizontalAlignment.Center);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Title"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Instructor"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "ProvNum"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Last Name"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "First Name"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Course"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Grade"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableEvaluations", "Grading Scale"), 90);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(DateTime.Parse(table.Rows[i]["DateEval"].ToString()).ToShortDateString());
                row.Cells.Add(table.Rows[i]["EvalTitle"].ToString());
                row.Cells.Add(table.Rows[i]["InstructNum"].ToString());
                row.Cells.Add(table.Rows[i]["StudentNum"].ToString());
                row.Cells.Add(table.Rows[i]["LName"].ToString());
                row.Cells.Add(table.Rows[i]["FName"].ToString());
                row.Cells.Add(table.Rows[i]["CourseID"].ToString());
                row.Cells.Add(table.Rows[i]["OverallgradeShowing"].ToString());
                row.Cells.Add(table.Rows[i]["Description"].ToString());
                row.Tag = table.Rows[i]["EvaluationNum"].ToString();              //To keep the correct reference to the Evaluation even when filtering the list.
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void FillStudents()
        {
            List <long> schoolCourseNums   = new List <long>();
            List <long> instructorProvNums = new List <long>();

            for (int i = 0; i < gridCourses.SelectedIndices.Length; i++)
            {
                int index = gridCourses.SelectedIndices[i];
                schoolCourseNums.Add(PIn.Long(gridCourses.Rows[index].Tag.ToString()));
            }
            for (int i = 0; i < gridInstructors.SelectedIndices.Length; i++)
            {
                int index = gridInstructors.SelectedIndices[i];
                instructorProvNums.Add(PIn.Long(gridInstructors.Rows[index].Tag.ToString()));
            }
            DataTable table = Evaluations.GetFilteredList(schoolCourseNums, instructorProvNums);

            gridStudents.BeginUpdate();
            gridStudents.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("FormEvaluationReport - Students", "ProvNum"), 60);

            gridStudents.Columns.Add(col);
            col = new ODGridColumn(Lan.g("FormEvaluationReport - Students", "Last Name"), 90);
            gridStudents.Columns.Add(col);
            col = new ODGridColumn(Lan.g("FormEvaluationReport - Students", "First Name"), 90);
            gridStudents.Columns.Add(col);
            gridStudents.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["StudentNum"].ToString());
                row.Cells.Add(table.Rows[i]["LName"].ToString());
                row.Cells.Add(table.Rows[i]["FName"].ToString());
                row.Tag = table.Rows[i]["StudentNum"].ToString();
                gridStudents.Rows.Add(row);
            }
            gridStudents.EndUpdate();
        }