private void FillScore()
        {
            dataGridViewX1.Rows.Clear();


            List <ESLScore> eslScoreList = new List <ESLScore>();

            foreach (ESLScore scoreItem in _scoreDict[_targetSubjectName])
            {
                if (scoreItem.Assessment == _targetAssessmentName)
                {
                    DataGridViewRow row = new DataGridViewRow();

                    row.CreateCells(dataGridViewX1);

                    K12.Data.SCAttendRecord scar = _scaList.Find(sca => sca.RefStudentID == scoreItem.RefStudentID && sca.RefCourseID == scoreItem.RefCourseID);

                    row.Cells[0].Value = scar.Student.Class != null ? scar.Student.Class.Name : "";   // 學生班級
                    row.Cells[1].Value = scar.Student != null ? "" + scar.Student.SeatNo : "";        // 學生座號
                    row.Cells[2].Value = scar.Student != null ? "" + scar.Student.Name : "";          // 學生姓名
                    row.Cells[3].Value = scar.Student != null ? "" + scar.Student.StudentNumber : ""; // 學生學號
                    row.Cells[4].Value = scoreItem.RefTeacherName;                                    // 本項目老師姓名
                    row.Cells[5].Value = scoreItem.HasValue ? scoreItem.Value : "";                   // 本項目分數

                    row.Tag = scoreItem.RefStudentID;                                                 // row tag 用studentID 就夠

                    dataGridViewX1.Rows.Add(row);
                }
            }

            // 依   學號 排序 (同Web 的成績輸入介面)
            dataGridViewX1.Sort(ColStudentNumber, ListSortDirection.Ascending);
        }
Beispiel #2
0
        private void SelectAssessmentSetup(K12.Data.SCAttendRecord scar)
        {
            string   xmlStr  = "<root>" + scar.Course.AssessmentSetup.Description + "</root>";
            XElement elmRoot = XElement.Parse(xmlStr);

            string id = scar.RefStudentID + "_" + scar.RefCourseID;

            //解析讀下來的 descriptiony 資料,打包成物件群 最後交給 ParseDBxmlToNodeUI() 處理
            if (elmRoot != null)
            {
                if (elmRoot.Element("ESLTemplate") != null)
                {
                    foreach (XElement ele_term in elmRoot.Element("ESLTemplate").Elements("Term"))
                    {
                        if (ele_term.Attribute("Name").Value == "mid-Term")
                        {
                            if (!scoreDict[id].ContainsKey("M_W"))
                            {
                                scoreDict[id].Add("M_W", "" + ele_term.Attribute("Weight").Value);
                            }
                        }

                        if (ele_term.Attribute("Name").Value == "final-Term")
                        {
                            if (!scoreDict[id].ContainsKey("F_W"))
                            {
                                scoreDict[id].Add("F_W", "" + ele_term.Attribute("Weight").Value);
                            }


                            foreach (XElement ele_subject in ele_term.Elements("Subject"))
                            {
                                string string1 = "";


                                switch ("" + ele_subject.Attribute("Name").Value)
                                {
                                case "Language Art(FET)":
                                    string1 = "LA_FET_";
                                    break;

                                case "Language Art(CET)":
                                    string1 = "LA_CET_";
                                    break;

                                case "Science":
                                    string1 = "SC_FET_";
                                    break;

                                default:
                                    break;
                                }

                                foreach (XElement ele_assessment in ele_subject.Elements("Assessment"))
                                {
                                    string string2 = "";

                                    switch ("" + ele_assessment.Attribute("Name").Value)
                                    {
                                    case "In-Class Score":
                                        string2 = "IN_W";
                                        break;

                                    case "Reading Project":
                                        string2 = "RAP_W";
                                        break;

                                    case "Language Arts Exam":
                                        string2 = "MLAE_W";
                                        break;

                                    case "Grammar Exam":
                                        string2 = "MGE_W";
                                        break;

                                    case "Project":
                                        string2 = "SA_W";
                                        break;

                                    default:
                                        break;
                                    }

                                    if (!scoreDict[id].ContainsKey(string1 + string2))
                                    {
                                        scoreDict[id].Add(string1 + string2, "" + ele_assessment.Attribute("Weight").Value);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }