Exemplo n.º 1
0
        // 載入 Log
        private void SetLoadDataToLog()
        {
            try
            {
                prlp.ClearCache();

                string sy = "", ss = "", key = "";
                if (_course.SchoolYear.HasValue)
                {
                    sy = _course.SchoolYear.Value.ToString();
                }
                if (_course.Semester.HasValue)
                {
                    ss = _course.Semester.Value.ToString();
                }

                key = sy + "學年度第" + ss + "學期" + "學號:" + _student.StudentNumber + " 姓名:" + _student.Name + " " + _course.Name;


                foreach (DataGridViewRow dgvr in dgv.Rows)
                {
                    if (dgvr.IsNewRow)
                    {
                        continue;
                    }

                    string strExamName = "", strScore = "", strEffort = "", strText = "";

                    if (dgvr.Cells[chExamName.Index].Value == null)
                    {
                        continue;
                    }

                    strExamName = dgvr.Cells[chExamName.Index].Value.ToString();

                    if (dgvr.Cells[chScore.Index].Value != null)
                    {
                        strScore = dgvr.Cells[chScore.Index].Value.ToString();
                    }

                    if (dgvr.Cells[chEffort.Index].Value != null)
                    {
                        strEffort = dgvr.Cells[chEffort.Index].Value.ToString();
                    }

                    if (dgvr.Cells[chText.Index].Value != null)
                    {
                        strText = dgvr.Cells[chText.Index].Value.ToString();
                    }

                    prlp.SetBeforeSaveText(key + strExamName + "分數評量", strScore);
                    prlp.SetBeforeSaveText(key + strExamName + "努力程度", strEffort);
                    prlp.SetBeforeSaveText(key + strExamName + "文字描述", strText);
                }
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show("Log發生錯誤.");
            }
        }