예제 #1
0
        private void OutRowData(Workbook wb)
        {
            Worksheet sheet    = wb.Worksheets[wb.Worksheets.Add()];
            Cells     cells    = sheet.Cells;
            int       rowIndex = 0;
            int       colIndex = 0;

            string[] title = { "班級", "學生ID", "學號", "姓名", "應得學分", "實得學分", "比例", "及格分數" };

            foreach (DAO.ClassVO ClassObj in _ClassList)
            {
                colIndex = 0;
                foreach (string name in title)
                {
                    cells[rowIndex, colIndex++].PutValue(name);
                }
                foreach (DAO.CourseVO CourseObj in ClassObj.AllCourseListDic.Values)
                {
                    cells[rowIndex, colIndex++].PutValue(CourseObj.CourseName);
                }

                foreach (DAO.StudentVO StudentObj in ClassObj.StudentList)
                {
                    colIndex = 0;
                    rowIndex++;

                    // "班級", "學生ID", "學號", "姓名", "應得學分", "實得學分", "比例", "及格分數"
                    cells[rowIndex, colIndex++].PutValue(ClassObj.ClassName);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.StudentId);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.StudentNumber);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.StudentName);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.TotalCredit);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.GotCredit);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.CreditRate);
                    cells[rowIndex, colIndex++].PutValue(StudentObj.PassScore);
                    foreach (DAO.CourseVO CourseObj in ClassObj.AllCourseListDic.Values)
                    {
                        DAO.CourseVO StuCourseObj = Utility.FindCourse(StudentObj.CourseListDic.Values.ToList(), CourseObj.CourseId);
                        if (StuCourseObj == null)
                        {
                            cells[rowIndex, colIndex++].PutValue("");
                        }
                        else
                        {
                            cells[rowIndex, colIndex++].PutValue(StuCourseObj.CourseScore);
                        }
                    }
                }
            }
        }   // end of OutRowData
예제 #2
0
        private void OutDetailData(Cells cells, DAO.ClassVO ClassObj, DAO.StudentVO StudentObj)
        {
            if (_DetailRowIndex > _MAX_ROW_COUNT)
            {
                return;
            }

            int columnIndex = 0;

            _DetailRowIndex++;

            // 設定高度
            cells.SetRowHeightPixel(_DetailRowIndex, _Detail_Row_Height[3]);

            // 座號	姓名	學號
            SetDetailColumnValue(cells, columnIndex++, StudentObj.SeatNo, _Detail_Style_Normal);
            SetDetailColumnValue(cells, columnIndex++, StudentObj.StudentName, _Detail_Style_Normal);
            SetDetailColumnValue(cells, columnIndex++, StudentObj.StudentNumber, _Detail_Style_Normal);

            #region 輸出每一科的分數
            // 國文Ⅳ	英文Ⅳ	...
            foreach (DAO.CourseVO CourseObj in ClassObj.AllCourseListDic.Values)
            {
                DAO.CourseVO StuCourseObj = Utility.FindCourse(StudentObj.CourseListDic.Values.ToList(), CourseObj.CourseId);
                if (StuCourseObj == null)
                {
                    // 沒有修這堂課
                    SetDetailColumnValue(cells, columnIndex++, "", _Detail_Style_Normal);
                }
                else
                {
                    if (StuCourseObj.CourseScore == -1)
                    {
                        // 有這堂課, 卻沒有分數
                        SetDetailColumnValue(cells, columnIndex++, _NoScroe, _Detail_Style_Red);
                    }
                    else
                    {
                        if (StuCourseObj.IsPass == true)
                        {
                            SetDetailColumnValue(cells, columnIndex++, StuCourseObj.CourseScore, _Detail_Style_Normal);
                        }
                        else
                        {
                            SetDetailColumnValue(cells, columnIndex++, StuCourseObj.CourseScore, _Detail_Style_Red);
                        }
                    }
                }
            }
            #endregion

            // 假如印出的課程小於預設的課程數量, 就把剩下的欄位補上Style(邊框)
            for (int intI = 0; intI < (_Default_Detail_Course_Count - _Current_Course_Count); intI++)
            {
                SetDetailColumnValue(cells, columnIndex++, "", _Detail_Style_Normal);
            }

            // 及格標準	應得學分數	實得學分數	未達百分比
            SetDetailColumnValue(cells, columnIndex++, StudentObj.PassScore, _Detail_Style_Normal);
            SetDetailColumnValue(cells, columnIndex++, StudentObj.TotalCredit, _Detail_Style_Normal);
            SetDetailColumnValue(cells, columnIndex++, StudentObj.GotCredit, _Detail_Style_Normal);
            SetDetailColumnValue(cells, columnIndex++, StudentObj.CreditRate + "%", _Detail_Style_Normal);
        }