/// <summary> /// 主要是給匯出時用的 /// </summary> /// <param name="studentRecord"></param> /// <param name="fitnessRecord"></param> /// <param name="isExportDegree"></param> public void SetDataForExport(DAO.StudentInfo studentRecord, DAO.StudentFitnessRecord fitnessRecord, bool isExportDegree) { // 測驗日期 SetColumnValue("測驗日期", Utility.ConvertDateTimeToChineseDateTime(fitnessRecord.TestDate)); // 學校類別 SetColumnValue("學校類別", fitnessRecord.SchoolCategory); // 年級 SetColumnValue("年級", studentRecord.Class_Grade_Year); // 班級名稱 SetColumnValue("班級名稱", studentRecord.Class_Class_Name); // 班級序號 for sort SetOthersValue("班級序號", studentRecord.Class_Display_Order); // 學號/座號 SetColumnValue("學號/座號", studentRecord.Student_Student_Number); // 性別 SetColumnValue("性別", studentRecord.Student_Gender); // 身分證字號 SetColumnValue("身分證字號", studentRecord.Student_ID_Number); // 生日 SetColumnValue("生日", studentRecord.Student_Birthday); // 身高 SetColumnValue("身高", fitnessRecord.Height); // 體重 SetColumnValue("體重", fitnessRecord.Weight); // 坐姿體前彎 SetColumnValue("坐姿體前彎", fitnessRecord.SitAndReach); // 立定跳遠 SetColumnValue("立定跳遠", fitnessRecord.StandingLongJump); // 仰臥起坐 SetColumnValue("仰臥起坐", fitnessRecord.SitUp); // 心肺適能 SetColumnValue("心肺適能", fitnessRecord.Cardiorespiratory); // 姓名 for sort SetOthersValue("姓名", studentRecord.Student_Name); if (isExportDegree == true) { // 身高常模 SetColumnValue("身高常模", fitnessRecord.HeightDegree); // 體重常模 SetColumnValue("體重常模", fitnessRecord.WeightDegree); // 坐姿體前彎常模 SetColumnValue("坐姿體前彎常模", fitnessRecord.SitAndReachDegree); // 立定跳遠常模 SetColumnValue("立定跳遠常模", fitnessRecord.StandingLongJumpDegree); // 仰臥起坐常模 SetColumnValue("仰臥起坐常模", fitnessRecord.SitUpDegree); // 心肺適能常模 SetColumnValue("心肺適能常模", fitnessRecord.CardiorespiratoryDegree); } }
void _bgWork_DoWork(object sender, DoWorkEventArgs e) { _DataDict.Clear(); _MappingField.Clear(); List <string> StudentIDList = K12.Presentation.NLDPanels.Student.SelectedSource; List <DAO.StudentInfo> StudInfoList = _StudentInfoTransfer.GetStudentInfoList(StudentIDList); // 取得畫面所選學生學習歷程 Global._StudentSemesterHistoryItemDict.Clear(); foreach (SemesterHistoryRecord shr in SemesterHistory.SelectByStudentIDs(StudentIDList)) { // 依照年級、學期排序後加入 Global._StudentSemesterHistoryItemDict.Add(shr.RefStudentID, (from data in shr.SemesterHistoryItems orderby data.GradeYear, data.Semester select data).ToList()); } // 取得日常生活表現具體建議 Global._ABCard_StudentTextScoreDict = Utility.GetABCard_StudentTextScoreDict(StudentIDList); // 畢業資料 Global._ABCard_StudentGraduateDict = Utility.GetStudentGraduateDict(StudentIDList); // 異動資料 Global._ABCard_StudentUpdateRecDict = Utility.GetStudentUpdateRecDict(StudentIDList); //獎懲資料 Global._ABCard_StudentMDRecordDict = Utility.GetStudentMDRecDict(StudentIDList); // 參加社團 Global._ABCard_StudentSpecCourseDict = Utility.GetABCard_StudentSpecCourseDict(StudentIDList); // 擔任幹部 Global._ABCard_StudentTheCadreDict = Utility.GetABCard_StudentTheCadreDict(StudentIDList); // 學生領域成績與畢業成績 Global._AB_StudSemsDomainScoreDict = Utility.GetAB_StudSemsDomainScoreDict(StudentIDList); // 輔導個案會議 Global._AB_CaseMeetingRecordToABRptDataDict = Utility.ParseCaseMeetingRecordToABRptData(StudentIDList); // 輔導優先關懷 Global._AB_CareRecordToABRptDataDict = Utility.ParseCareRecordToABRptData(StudentIDList); // 輔導晤談紀錄 Global._AB_InterViewDataToABRptDataDict = Utility.ParseInterViewDataToABRptData(StudentIDList); // 學生入學照片 Global._AB_StudentFreshmanDict = Photo.SelectFreshmanPhoto(StudentIDList); // 學生畢業照片 Global._AB_StudentGraduateDict = Photo.SelectGraduatePhoto(StudentIDList); // 取得答案 Dictionary <string, List <DAO.AnswerPkey> > _AnsData = _ABCardPrintManager.GetAnswers(StudentIDList); List <string> QuetionFieldList = _ABCardPrintManager.GetMappingField(); _MappingField.AddRange(QuetionFieldList); Global._StudentNumberList.Clear(); // studID foreach (string studID in StudentIDList) { Dictionary <string, string> _ansDict = new Dictionary <string, string> (); // 處理學生基本資料、缺曠獎懲、.. DAO.StudentInfo studInfo = null; foreach (DAO.StudentInfo si in StudInfoList.Where(x => x.StudentID == studID)) { studInfo = si; } List <string> temp1 = new List <string>(); if (studInfo != null) { Dictionary <string, string> baseDict = new Dictionary <string, string>(); baseDict.Add("學校中文名稱", studInfo.SchoolName); temp1.Clear(); foreach (KeyValuePair <string, string> data in studInfo.AttendanceDict) { baseDict.Add("B_缺曠_" + data.Key, data.Value); temp1.Add(data.Key + "(" + data.Value + ")"); } if (temp1.Count > 0) { baseDict.Add("B_缺曠", string.Join(",", temp1.ToArray())); } baseDict.Add("B_入學前學校名稱", studInfo.BeforeEnrollSchoolName); baseDict.Add("B_入學年", studInfo.BeforeEnrollSchoolYear); baseDict.Add("B_出生日期", studInfo.Birthday); baseDict.Add("B_出生日期民國格式", studInfo.BirthdayTW); baseDict.Add("B_出生地", studInfo.Birthplace); baseDict.Add("B_畢業年月", studInfo.GraduationYearMonth); baseDict.Add("B_身分證號", studInfo.IDNumber); baseDict.Add("B_聯絡地址", studInfo.MailingAddress); baseDict.Add("B_聯絡電話", studInfo.MailingPhone); baseDict.Add("B_性別", studInfo.Gender); temp1.Clear(); foreach (KeyValuePair <string, string> data in studInfo.MeritDict) { baseDict.Add("B_獎懲_" + data.Key, data.Value); temp1.Add(data.Key + "(" + data.Value + ")"); } if (temp1.Count > 0) { baseDict.Add("B_獎懲", string.Join(",", temp1.ToArray())); } baseDict.Add("B_姓名", studInfo.Name); baseDict.Add("B_戶籍地址", studInfo.PermanentAddress); baseDict.Add("B_戶籍電話", studInfo.PermanentPhone); baseDict.Add("B_學號", studInfo.StudentNumber); Global._StudentNumberList.Add(studInfo.StudentNumber); baseDict.Add("GL_異動紀錄", string.Join(";", studInfo.UpdateRecordList.ToArray())); foreach (KeyValuePair <string, string> data in baseDict) { if (!_MappingField.Contains(data.Key)) { _MappingField.Add(data.Key); } _ansDict.Add(data.Key, data.Value); } } // 而外加入需要填在這合併名稱,處理在DocumentMerge // 加入學期歷程 _ansDict.Add("學習歷程", studID); _ansDict.Add("學期對照", studID); _MappingField.Add("學習歷程"); _MappingField.Add("學期對照"); // 加入導師評語與具體建議 _ansDict.Add("導師評語", studID); _ansDict.Add("具體建議", studID); _MappingField.Add("導師評語"); _MappingField.Add("具體建議"); // 加入畢業資料 _ansDict.Add("畢業資料", studID); _MappingField.Add("畢業資料"); // 加入異動資料 _ansDict.Add("異動資料", studID); _MappingField.Add("異動資料"); // 加入獎懲資料 _ansDict.Add("獎懲資料", studID); _MappingField.Add("獎懲資料"); // 加入參加社團 _ansDict.Add("參加社團", studID); _MappingField.Add("參加社團"); // 加入擔任幹部 _ansDict.Add("擔任幹部", studID); _MappingField.Add("擔任幹部"); // 加入學生領域與畢業成績 _ansDict.Add("學習領域與畢業成績", studID); _MappingField.Add("學習領域與畢業成績"); // 加入學生輔導個案會議 _ansDict.Add("輔導個案會議", studID); _MappingField.Add("輔導個案會議"); _MappingField.Add("輔導個案會議其它內容"); // 加入學生輔導優先關懷 _ansDict.Add("輔導優先關懷", studID); _MappingField.Add("輔導優先關懷"); _MappingField.Add("輔導優先關懷其它內容"); // 加入學生輔導晤談紀錄 _ansDict.Add("輔導晤談紀錄", studID); _MappingField.Add("輔導晤談紀錄"); _MappingField.Add("輔導晤談紀錄其它內容"); // 加入學生入學照片 _ansDict.Add("入學照片", studID); _MappingField.Add("入學照片"); // 加入學生畢業照片 _ansDict.Add("畢業照片", studID); _MappingField.Add("畢業照片"); if (_AnsData.ContainsKey(studID)) { // 加入測驗紀錄 _ansDict.Add("測驗紀錄", studID); _MappingField.Add("測驗紀錄"); foreach (string qField in QuetionFieldList) { foreach (DAO.AnswerPkey ap in _AnsData[studID]) { //string qqField = ap.Question.GetField(); if (ap.Question.QType == "grid") { string Idx1 = "GR_" + ap.Question.GetField(); if (!_ansDict.ContainsKey(Idx1)) { _ansDict.Add(Idx1, ap.dataElement.ToString()); if (!_MappingField.Contains(Idx1)) { _MappingField.Add(Idx1); } } int rowIdx = 1; foreach (XElement elm in ap.dataElement.Elements("Item")) { foreach (XElement elm2 in elm.Elements("Field")) { string key = ap.Question.GetField() + "_" + elm2.Attribute("key").Value + "R"; if (key == qField) { if (!_ansDict.ContainsKey(qField)) { string newField = qField + rowIdx; if (elm2.Attribute("value") == null) { _ansDict.Add(newField, ""); } else { _ansDict.Add(newField, elm2.Attribute("value").Value); } if (!_MappingField.Contains(newField)) { _MappingField.Add(newField); } } } } rowIdx++; } } else { //處理單一分割 string strVal = ""; if (ap.dataElement.Attribute("value") != null) { strVal = ap.dataElement.Attribute("value").Value; } if (ap.Question.GetField() == qField) { if (!_ansDict.ContainsKey(qField)) { _ansDict.Add(qField, strVal); } } // 處理組合在一起 if (qField.IndexOf("G") == 0) { if (ap.Question.GetFieldG() == qField) { if (strVal != "") { strVal = ap.Question.QLabel + ":" + strVal; } if (!_ansDict.ContainsKey(qField)) { _ansDict.Add(qField, strVal); } else { if (strVal != "") { _ansDict[qField] += "," + strVal; } } } } } } } } _DataDict.Add(_ansDict); } }