/// <summary> /// Adds the comment from learner to the list. /// </summary> /// <remarks>When a new comment is added via the GUI, we need to add it to the list in the GUI and a string</remarks> /// <param name="comment">Comment.</param> public void AddCommentFromLearnerToList(StudentRecord.CommentsFromLearner comment) { string stringCommentsFromLearnerList = ""; string timeStamp = comment.timeStamp.ToString(); string location = comment.location; string text = comment.comment; stringCommentsFromLearnerList += timeStamp + " :: " + location + "\n" + text + "\n\n"; GameObject.Find ("LearnerCommentList").GetComponent<Text> ().text += stringCommentsFromLearnerList; }
internal StudentRecordEditor(StudentRecord student) { Student = student; Status = student.Status; SeatNo = student.SeatNo; Name = student.Name; StudentNumber = student.StudentNumber; Gender = student.Gender; IDNumber = student.IDNumber; Birthday = student.Birthday; //OverrideDepartmentID = student.OverrideDepartmentID; RefClassID = student.RefClassID; OverrideProgramPlanID = student.OverrideProgramPlanID; OverrideScoreCalcRuleID = student.OverrideScoreCalcRuleID; Nationality = student.Nationality; }
/// <summary> /// Initialise the specified objective. /// </summary> /// <param name="newIndex">New index.</param> /// <param name="newData">New data of the objective.</param> public void Initialise(int newIndex, StudentRecord.Objectives newData) { isInitialising = true; // Set the isInitialising flag to true (stops the updating of the Objective while the data is loading index = newIndex; data = newData; objectiveIndexGO.GetComponent<Text> ().text = index.ToString (); // Set the text of the Objective Index GUI Element objectiveIDGO.GetComponent<Text> ().text = newData.id; // Set the text of the Objective ID GUI Element objectiveDescriptionGO.GetComponent<Text> ().text = newData.description; // Set the text of the Objective Description GUI Element objectiveScoreMinGO.GetComponent<InputField> ().text = newData.score.min.ToString(); // Set the text of the Min Score GUI Element objectiveScoreMaxGO.GetComponent<InputField> ().text = newData.score.max.ToString(); // Set the text of the Max Score GUI Element objectiveScoreRawGO.GetComponent<InputField> ().text = newData.score.raw.ToString(); // Set the text of the Raw Score GUI Element objectiveProgressMeasureGO.GetComponent<Slider> ().value = newData.progressMeasure; // Set the text of the Progress Measure GUI Element switch(newData.successStatus) { // Set the correct Success Status toggle case StudentRecord.SuccessStatusType.passed: objectiveSuccessPassedGO.GetComponent<Toggle>().isOn = true; break; case StudentRecord.SuccessStatusType.failed: objectiveSuccessFailedGO.GetComponent<Toggle>().isOn = true; break; case StudentRecord.SuccessStatusType.unknown: objectiveSuccessUnknownGO.GetComponent<Toggle>().isOn = true; break; } switch(newData.completionStatus) { // Set the correct Completion Status toggle case StudentRecord.CompletionStatusType.completed: objectiveCompletedGO.GetComponent<Toggle>().isOn = true; break; case StudentRecord.CompletionStatusType.incomplete: objectiveIncompleteGO.GetComponent<Toggle>().isOn = true; break; case StudentRecord.CompletionStatusType.not_attempted: objectiveNotAttemptedGO.GetComponent<Toggle>().isOn = true; break; case StudentRecord.CompletionStatusType.unknown: objectiveUnknownGO.GetComponent<Toggle>().isOn = true; break; } ResizeParent (); // I could not get the Content Size Fitter working correctly on the PanelObjectivesList GUI element, calculated manually isInitialising = false; // Initialise complete, update reactivated. }
public void CheckPrerequisites_StudyListWithMultipleFailedPrerequisites_Exception() { List <StudyUnit> studyList = generateStudyListWithoutPrerequisites(); List <string> preReqs; // start adding in prerequisites which are below passing mark preReqs = new List <string>(); preReqs.Add("UECS1102"); // above passing mark preReqs.Add("UECS1101"); // below passing mark studyList[4].prerequisites = preReqs; // add as prerequisites to UECS1202 preReqs = new List <string>(); preReqs.Add("UECS1301"); // below passing mark preReqs.Add("UECS1302"); // below passing mark studyList[9].prerequisites = preReqs; // add as prerequisites to UECS2101 StudentRecord studRecord = generateStudentRecordWithSampleTrimesters(); studRecord.CheckPrerequisites(studyList); }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") return; StudentRecord studRec = new StudentRecord(); studRec.Name = txtName.Text; string StudentID = Student.Insert(studRec); // 新的 log 機制待寫 // 這是舊的:PermRecLogProcess prlp = new PermRecLogProcess(); //prlp.SaveLog("學籍.學生", "新增學生", "新增學生姓名:" + txtName.Text); if (chkInputData.Checked == true) { if (StudentID != "") { K12.Presentation.NLDPanels.Student.PopupDetailPane(StudentID); } } this.Close(); }
public FrmFitnessRecord(DAO.StudentFitnessRecord rec, accessType actType) { InitializeComponent(); _studRec = Student.SelectByID(rec.StudentID); _fitnessRec = rec; _actType = actType; _LogTransfer = new Log.LogTransfer(); if (_actType == accessType.Edit) { this.Text = _FrmTitleEdit; //修改模式無法變更學年度 this.integerInput1.Enabled = false; } else { this.Text = _FrmTitleAdd; } }
//studentRecords資料排序 private int studentRecordsSort(StudentRecord x, StudentRecord y) { string xx = _ClassDic[x.RefClassID].GradeYear.ToString().PadLeft(1, '0'); xx += _ClassDic[x.RefClassID].DisplayOrder.PadLeft(3, '0'); xx += _ClassDic[x.RefClassID].Name.PadLeft(20, '0'); xx += x.SeatNo.ToString().PadLeft(3, '0'); xx += x.StudentNumber.PadLeft(20, '0'); xx += x.Name.PadLeft(10, '0'); string yy = _ClassDic[y.RefClassID].GradeYear.ToString().PadLeft(1, '0'); yy += _ClassDic[y.RefClassID].DisplayOrder.PadLeft(3, '0'); yy += _ClassDic[y.RefClassID].Name.PadLeft(20, '0'); yy += y.SeatNo.ToString().PadLeft(3, '0'); yy += y.StudentNumber.PadLeft(20, '0'); yy += y.Name.PadLeft(10, '0'); return(xx.CompareTo(yy)); }
public string GetDescriptionDelegate(string primaryKey) { Student.RemoveByIDs(new string[] { primaryKey }); StudentRecord stu = Student.SelectByID(primaryKey); if (stu.Class == null) { return(string.Format("{0} {1}", stu.Name, stu.StudentNumber)); } else { if (stu.SeatNo == null) { return(string.Format("{0} {1} {2}", stu.Class.Name, stu.Name, stu.StudentNumber)); } else { return(string.Format("{0}({1}) {2} {3}", stu.Class.Name, stu.SeatNo, stu.Name, stu.StudentNumber)); } } }
public static ProgramPlanRecord GetProgramPlanRecord(this StudentRecord studentRec) { string id = ""; if (studentRec != null) { if (string.IsNullOrEmpty(studentRec.OverrideProgramPlanID)) { if (studentRec.Class != null) { return(studentRec.Class.GetProgramPlanRecord()); } } else { id = studentRec.OverrideProgramPlanID; } } return(ProgramPlan.Instance.Items[id]); }
/// <summary> /// 由學生系統編號取得學生額外資料字典 學生學號:學生Record /// </summary> private Dictionary <string, StudentRecord_Ext> GetStudExt(List <string> StudentIDList, Dictionary <string, StudentRecord> StudentIDDic) { Dictionary <string, StudentRecord_Ext> dic = new Dictionary <string, StudentRecord_Ext>(); List <StudentRecord_Ext> records = tool._A.Select <StudentRecord_Ext>(string.Format("ref_student_id in ('{0}')", string.Join("','", StudentIDList))); foreach (StudentRecord_Ext each in records) { if (StudentIDDic.ContainsKey(each.RefStudentID)) { //學生 StudentRecord stud = StudentIDDic[each.RefStudentID]; if (!dic.ContainsKey(stud.StudentNumber)) { dic.Add(stud.StudentNumber, each); } } } return(dic); }
public ChangeDeptProcess(string id) { InitializeComponent(); // 取得一般狀態學生學號 _StudNumDictCheck = utility.GetStudentNumberStatus1(); updateRecordInfo1.SetDefaultValue(id); updateRecordInfo2.SetDefaultValue(id); _StudentRec = _AccessHelper.StudentHelper.GetStudents(id)[0]; string currentDept = _StudentRec.Department + ( ( "" + _StudentRec.Fields["SubDepartment"] ) == "" ? "" : ":" + _StudentRec.Fields["SubDepartment"] ); //textBoxX1.Text = _StudentRec.StudentNumber; DSResponse dsrsp = SmartSchool.Feature.Basic.Config.GetDepartment(); foreach ( XmlNode node in dsrsp.GetContent().GetElements("Department") ) { _DeptIDList.Add(node.SelectSingleNode("Name").InnerText.Replace(":", ":"), node.SelectSingleNode("@ID").InnerText); if ( node.SelectSingleNode("Name").InnerText.Replace(":", ":") != currentDept ) cboDept.Items.Add(node.SelectSingleNode("Name").InnerText.Replace(":", ":")); } cboClass.DataSource = new List<ClassRecord>(); ; cboClass.SelectedItem = null; CheckOnTextChanged(null, null); }
public static ScoreCalcRuleRecord GetScoreCalcRuleRecord(this StudentRecord studentRec) { string id = ""; if (studentRec != null) { if (string.IsNullOrEmpty(studentRec.OverrideScoreCalcRuleID)) { if (studentRec.Class != null) { return(studentRec.Class.GetScoreCalcRuleRecord()); } } else { id = studentRec.OverrideScoreCalcRuleID; } } return(ScoreCalcRule.Instance.Items[id]); }
public void CheckPrerequisites_StudyListCombinationNonExistentAndFailedPrerequisites_Exception() { List <StudyUnit> studyList = generateStudyListWithoutPrerequisites(); List <string> preReqs; // start adding in combination of fulfilled prerequisites, those below passing mark and those non-existent preReqs = new List <string>(); preReqs.Add("UECS5555"); // non existent preReqs.Add("UECS1101"); // below passing mark studyList[4].prerequisites = preReqs; // add as prerequisites to UECS1202 preReqs = new List <string>(); preReqs.Add("UECS1301"); // below passing mark preReqs.Add("UECS1303"); // normal met preReqs.Add("UECS8888"); // non existent studyList[9].prerequisites = preReqs; // add as prerequisites to UECS2101 StudentRecord studRecord = generateStudentRecordWithSampleTrimesters(); studRecord.CheckPrerequisites(studyList); }
public void SetupPresentation() { if (_initialize) { return; } _classScoreCalsRuleField.GetVariable += delegate(object sender, GetVariableEventArgs e) { ScoreCalcRuleRecord record = Class.Instance.Items[e.Key].GetScoreCalcRuleRecord(); if (record != null) { e.Value = record.Name; } else { e.Value = ""; } }; Class.Instance.AddListPaneField(_classScoreCalsRuleField); _studentScoreCalsRuleField.GetVariable += delegate(object sender, GetVariableEventArgs e) { StudentRecord stu = Student.Instance.Items[e.Key]; ScoreCalcRuleRecord record = stu.GetScoreCalcRuleRecord(); if (record != null) { e.Value = string.IsNullOrEmpty(stu.OverrideScoreCalcRuleID) ? record.Name : "(指定)" + record.Name; } else { e.Value = ""; } }; Student.Instance.AddListPaneField(_studentScoreCalsRuleField); AddAssignScoreCalcRuleButtons(); _initialize = true; }
public ChangeDeptProcess(string id) { InitializeComponent(); updateRecordInfo1.SetDefaultValue(id); updateRecordInfo2.SetDefaultValue(id); _StudentRec = _AccessHelper.StudentHelper.GetStudents(id)[0]; string currentDept = _StudentRec.Department + (("" + _StudentRec.Fields["SubDepartment"]) == "" ? "" : ":" + _StudentRec.Fields["SubDepartment"]); //textBoxX1.Text = _StudentRec.StudentNumber; DSResponse dsrsp = SmartSchool.Feature.Basic.Config.GetDepartment(); foreach (XmlNode node in dsrsp.GetContent().GetElements("Department")) { _DeptIDList.Add(node.SelectSingleNode("Name").InnerText.Replace(":", ":"), node.SelectSingleNode("@ID").InnerText); if (node.SelectSingleNode("Name").InnerText.Replace(":", ":") != currentDept) { cboDept.Items.Add(node.SelectSingleNode("Name").InnerText.Replace(":", ":")); } } cboClass.DataSource = new List <ClassRecord>();; cboClass.SelectedItem = null; CheckOnTextChanged(null, null); }
public StudInterviewDataForm(DAO.UDT_CounselStudentInterviewRecordDef StudInterviewRecord, AccessType accType) { InitializeComponent(); _StudInterviewRecord = StudInterviewRecord; _UDTTransfer = new DAO.UDTTransfer(); _TeacherIDNameDict = new Dictionary <int, string>(); _TeacherNameIDDict = new Dictionary <string, int>(); _accessType = accType; _LogTransfer = new DAO.LogTransfer(); //if (accType == AccessType.Insert) //{ // _StudInterviewRecord.AuthorID = FISCA.Authentication.DSAServices.UserAccount; // _StudInterviewRecord.isPublic = true; //} _TeacherRecList = new List <TeacherRecord>(); _studRec = Student.SelectByID(StudInterviewRecord.StudentID.ToString()); _TeacherIDNameDict = Utility.GetCounselTeacherIDNameDict(StudInterviewRecord.StudentID.ToString()); _TeacherNameIDDict = Utility.GetCounselTeacherNameIDDict(StudInterviewRecord.StudentID.ToString()); LoadDefaultData(); LoadDataToForm(); }
private void AddAddend(StudentRecord student) { // 檢查是否要加入 bool CheckAdd = true; foreach (ListViewItem lvi in lvStudents.Items) { AttendInfo ai = lvi as AttendInfo; // 表示學生已經加入 if (ai.RefStudentID == student.ID) { CheckAdd = false; break; } } if (CheckAdd) { AttendInfo newItem = new AttendInfo(student); CourseRecord info = Course.Instance.Items[RunningID]; //GraduationPlanSubject subject = student.GraduationPlanInfo.GetSubjectInfo( // info.Subject, // info.SubjectLevel // ); //if (subject.Required == "必修") // newItem.IsRequired = "必"; //if (subject.Required == "選修") // newItem.IsRequired = "選"; //newItem.RequiredBy = subject.RequiredBy; lvStudents.Items.Add(newItem); newItem.EnsureVisible(); OnValueChanged("IsDirty", "True"); label2.Text = lvStudents.Items.Count.ToString(); } }
/// <summary> /// 從資料庫中查詢該身分證號的學生,如果不存在則回傳 Null。 /// </summary> private Tuple <StudentRecord, AddressRecord> QueryByIDNumber(string idNumber) { //除了刪除狀況的學生。 string cmd = "select id,name,id_number,status from student where id_number='{0}' and status !=256"; cmd = string.Format(cmd, idNumber); DataTable dt = Query.Select(cmd); if (dt.Rows.Count > 0) { string StudentID = dt.Rows[0]["id"] + ""; StudentRecord vSRecord = Student.SelectByID(StudentID); AddressRecord vARecord = Address.SelectByStudentID(StudentID); return(new Tuple <StudentRecord, AddressRecord>(vSRecord, vARecord)); } else { return(new Tuple <StudentRecord, AddressRecord>(null, null)); } }
public void CheckPrerequisites_StudyListWithMultiplePrerequisitesMet_NoException() { List <StudyUnit> studyList = generateStudyListWithoutPrerequisites(); List <string> preReqs; // start adding in prerequisites that will be be met preReqs = new List <string>(); preReqs.Add("UECS1102"); preReqs.Add("UECS1103"); studyList[4].prerequisites = preReqs; // add as prerequisites to UECS1202 preReqs = new List <string>(); preReqs.Add("UECS1201"); studyList[6].prerequisites = preReqs; // add as prerequisites to UECS1301 preReqs = new List <string>(); preReqs.Add("UECS1303"); studyList[9].prerequisites = preReqs; // add as prerequisites to UECS2101 StudentRecord studRecord = generateStudentRecordWithSampleTrimesters(); studRecord.CheckPrerequisites(studyList); }
public void SetMessage(StudentRecord stu, List <string> messages) { bool first = true; foreach (string msg in messages) { string s = ""; if (first) { if (stu.Class != null) { s += stu.Class.Name; if (stu.SeatNo != "") { s += "(" + stu.SeatNo + "號)"; } s += " "; } if (stu.StudentNumber != "") { s += stu.StudentNumber + " "; } if (s == "") { s += "學生:"; } s += stu.Name; dgv.Rows.Add(s, msg); first = false; } else { dgv.Rows.Add("", msg); } } toolStripStatusLabel1.Text = "總計" + dgv.Rows.Count + "個錯誤。"; }
private void ChangeSelection() { _dirty = false; if (!_initialized) { return; } List <ActivityRecordItem> arItems = ActivityRecordDAL.GetActivityRecordItems(cboSchoolYear.Text, cboSemester.Text, "班級幹部", cboClass.Text); dgEditor.Rows.Clear(); foreach (MappingItem item in _mappingItems) { for (int i = 0; i < item.Count; i++) { int rowIndex = dgEditor.Rows.Add(); DataGridViewRow row = dgEditor.Rows[rowIndex]; row.Cells[colItem.Index].Value = item.Item; } } foreach (ActivityRecordItem ari in arItems) { StudentRecord student = Student.Instance[ari.StudentID]; foreach (DataGridViewRow row in dgEditor.Rows) { if (row.Cells[colItem.Name].Value.ToString() == ari.Item && row.Tag == null && student != null) { FillStudentRow(row, student); break; } } } }
private void Save() { List <ActivityRecordItem> list = new List <ActivityRecordItem>(); if (!string.IsNullOrEmpty(errorProvider1.GetError(cboSemester)) || !string.IsNullOrEmpty(errorProvider1.GetError(cboSchoolYear))) { MessageBoxEx.Show("資料有誤, 請修正後再行儲存!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (DataGridViewRow row in dgEditor.Rows) { if (!string.IsNullOrEmpty(row.ErrorText)) { MessageBoxEx.Show("資料有誤, 請修正後再行儲存!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } StudentRecord student = row.Tag as StudentRecord; if (student != null) { ActivityRecordItem item = new ActivityRecordItem(); item.StudentID = student.ID; item.SchoolYear = cboSchoolYear.Text; item.Semester = cboSemester.Text; item.Item = row.Cells[colItem.Name].Value.ToString(); item.Type = "學校幹部"; item.Unit = string.Empty; list.Add(item); } } ActivityRecordDAL.SaveSchoolLeader(cboSchoolYear.Text, cboSemester.Text, list.ToArray()); _dirty = false; }
public AttendInfo(StudentRecord newStudent) { _identity = -1; _name = newStudent.Name; _is_required = ""; _requiredby = ""; if (newStudent.Class != null) { _class = JHSchool.Class.Instance.Items[newStudent.Class.ID].Name; _gradeyear = JHSchool.Class.Instance.Items[newStudent.Class.ID].GradeYear; } _snum = newStudent.StudentNumber; _seatno = newStudent.SeatNo; _ref_studentid = newStudent.ID; Text = Class; CreateSubItem(); _is_dirty = false; foreach (ListViewSubItem each in SubItems) { each.ForeColor = Color.Blue; } }
public void VerifyTrimesterOrder_CompleteTrimestersSequence_NoException() { StudentRecord studRecord = new StudentRecord("ahmad", "12345", Gender.male, "*****@*****.**", "012-44444", "SE", 120); TrimesterPerformance tpf = new TrimesterPerformance(2014, TrimesterMonths.JAN, Trimesters.Y1T1); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2014, TrimesterMonths.MAY, Trimesters.Y1T2); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2014, TrimesterMonths.OCT, Trimesters.Y1T3); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2015, TrimesterMonths.JAN, Trimesters.Y2T1); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2015, TrimesterMonths.MAY, Trimesters.Y2T2); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2015, TrimesterMonths.OCT, Trimesters.Y2T3); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2016, TrimesterMonths.JAN, Trimesters.Y3T1); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2016, TrimesterMonths.MAY, Trimesters.Y3T2); studRecord.AddTrimesterPerformance(tpf); tpf = new TrimesterPerformance(2016, TrimesterMonths.OCT, Trimesters.Y3T3); studRecord.AddTrimesterPerformance(tpf); studRecord.VerifyTrimesterOrder(); }
void item_Click(object sender, EventArgs e) { StudentRecord stud = null; ButtonItem bt = sender as ButtonItem; if (bt != null) { stud = bt.Tag as StudentRecord; } if (stud != null && _TeacherEntityID.HasValue) { int sid = int.Parse(stud.ID); if (!_StudDict.ContainsKey(sid)) { List <DAO.UDT_CounselStudent_ListDef> dataList = new List <DAO.UDT_CounselStudent_ListDef>(); DAO.UDT_CounselStudent_ListDef data = new DAO.UDT_CounselStudent_ListDef(); data.StudentID = sid; data.TeacherTagID = _TeacherEntityID.Value; dataList.Add(data); _UDTTransfer.InsertCounselStudentList(dataList); _BGRun(); } } }
private void StudentTmperatureForm_Load(object sender, EventArgs e) { //查詢分類 DataTable dt = tool._Q.Select(@"select category from $body_temperature.student_tmperature group by category "); List <string> list = new List <string>(); foreach (DataRow row in dt.Rows) { string category = "" + row["category"]; list.Add(category); } cbCategory.Items.AddRange(list.ToArray()); //查詢地點 dt = tool._Q.Select(@"select location from $body_temperature.student_tmperature group by location "); list = new List <string>(); foreach (DataRow row in dt.Rows) { string location = "" + row["location"]; list.Add(location); } cbLocation.Items.AddRange(list.ToArray()); if (_state == tool.BodyState.Student) { student = K12.Data.Student.SelectByID(_ref_id.ToString()); lbHelp.Text = string.Format("班級「{0}」座號「{1}」姓名「{2}」", student.RefClassID != "" ? student.Class.Name : "", student.SeatNo.HasValue ? student.SeatNo.Value.ToString() : "", student.Name); } else { teacher = K12.Data.Teacher.SelectByID(_ref_id.ToString()); lbHelp.Text = string.Format("姓名「{0}」暱稱「{1}」", teacher.Name, teacher.Nickname); } }
private void TaggingWorker_DoWork(object sender, DoWorkEventArgs e) { CurrentTags = SelectTags(PrimaryKey); //以下還要改寫。 string desc = GetDescriptionDelegate(PrimaryKey); Invoke(new Action(() => { DescriptionLabel.Text = desc; })); if (!StatusVisible) { return; //不顯示就不要讀資料了。 } Student.RemoveByIDs(new string[] { PrimaryKey }); StudentRecord stu = Student.SelectByID(PrimaryKey); Invoke(new Action(() => { DisplayStatus(stu); })); }
private void Save(string schoolyear, string semester) { List <ActivityRecordItem> list = new List <ActivityRecordItem>(); foreach (DataGridViewRow row in dgEditor.Rows) { StudentRecord student = row.Tag as StudentRecord; if (student != null) { ActivityRecordItem item = new ActivityRecordItem(); item.StudentID = student.ID; item.SchoolYear = schoolyear; item.Semester = semester; item.Item = row.Cells[colItem.Name].Value.ToString(); item.Type = "競賽項目"; list.Add(item); } } ActivityRecordDAL.SaveRacing(schoolyear, semester, list.ToArray()); _dirty = false; }
public void AddSubject(StudentRecord student, SemesterSubjectScoreInfo info) { Dictionary <string, string> aInfo = new Dictionary <string, string>(); aInfo.Add("學號", student.StudentNumber); aInfo.Add("班級", (student.RefClass != null) ? student.RefClass.ClassName : ""); aInfo.Add("座號", student.SeatNo); aInfo.Add("科別", student.Department); aInfo.Add("姓名", student.StudentName); aInfo.Add("科目", info.Subject); aInfo.Add("科目級別", info.Level); aInfo.Add("學年度", info.SchoolYear.ToString()); aInfo.Add("學期", info.Semester.ToString()); aInfo.Add("學分數", info.CreditDec().ToString()); aInfo.Add("成績年級", info.GradeYear.ToString()); aInfo.Add("必選修", info.Require ? "必修" : "選修"); aInfo.Add("校部訂", info.Detail.HasAttribute("修課校部訂") ? info.Detail.GetAttribute("修課校部訂") : ""); aInfo.Add("原始成績", info.Detail.HasAttribute("原始成績") ? info.Detail.GetAttribute("原始成績") : ""); // aInfo.Add("補考標準", info.Detail.HasAttribute("補考標準") ? info.Detail.GetAttribute("補考標準") : ""); aInfo.Add("補考標準", info.Detail.HasAttribute("修課補考標準") ? info.Detail.GetAttribute("修課補考標準") : ""); aInfo.Add("補考成績", info.Detail.HasAttribute("補考成績") ? info.Detail.GetAttribute("補考成績") : ""); // Dictionary<int, decimal> std = student.Fields["及格標準"] as Dictionary<int, decimal>; // aInfo.Add("及格標準", std[info.GradeYear].ToString()); aInfo.Add("及格標準", info.Detail.HasAttribute("修課及格標準") ? info.Detail.GetAttribute("修課及格標準") : ""); aInfo.Add("授課教師", info.Detail.HasAttribute("授課教師") ? info.Detail.GetAttribute("授課教師") : ""); aInfo.Add("取得學分", ""); subjectInfo.Add(aInfo); }
//依學號排序副程式 static int CompareSNum(StudentRecord a, StudentRecord b) { return a.StudentNumber.CompareTo(b.StudentNumber); }
/// <summary> /// Update an existing Comment from Learner /// </summary> /// <remarks> /// Calls SetValue on scorm.js. for each element in the CommentsFromLearner. Launches a seperate thread for the work. /// This is the target function of the <see cref="UpdateCommentFromLearner"/> function call. /// </remarks> /// <param name="i">The index.</param> /// <param name="comment">Comment.</param> private static void CallUpdateCommentFromLearner(int i, StudentRecord.CommentsFromLearner comment) { try { if(!CheckThread())return; WaitForInitialize(); string identifier; string strValue; comment.timeStamp = DateTime.Now; //Set timestamp to Now //All other properties must be set by the caller //Set the Comment Values identifier = "cmi.comments_from_learner."+i+".comment"; strValue = comment.comment; scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.comments_from_learner."+i+".location"; strValue = comment.location; scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.comments_from_learner."+i+".timestamp"; strValue = String.Format("{0:s}", comment.timeStamp); scormAPIWrapper.SetValue(identifier,strValue); studentRecord.commentsFromLearner[i] = comment; } catch(System.Exception e) { UnityEngine.Application.ExternalCall("DebugPrint", "***CallUpdateCommentFromLearner***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source ); } }
/// <summary> /// Sets the exit. /// </summary> /// <param name="value">The StudentRecord.ExitType value.</param> /// <c> /// Usage:\n /// ScormManager.SetExit(StudentRecord.ExitType.suspend); /// </c> public static void SetExit(StudentRecord.ExitType value) { string identifier = "cmi.exit"; string strValue = CustomTypeToString(value); SetValue (identifier, strValue); }
/// <summary> /// Adds to the interactions. /// </summary> /// <param name="interaction">Interaction (StudentRecord.LearnerInteractionRecord).</param> /// <c> /// Usage:\n /// StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord();\n /// newRecord.type = StudentRecord.InteractionType.other;\n /// newRecord.timeStamp = DateTime.Now;\n /// newRecord.weighting = 0.5f;\n /// newRecord.response = "true";\n /// newRecord.latency = 12f;\n /// newRecord.description = "Is this easy to use?";\n /// newRecord.result = StudentRecord.ResultType.correct;\n /// newRecord.estimate = 1f; //Not used\n /// \n /// ScormManager.AddInteraction (newRecord);\n /// </c> public static void AddInteraction(StudentRecord.LearnerInteractionRecord interaction) { System.Threading.Thread thread = new System.Threading.Thread (() => CallAddInteraction (interaction)); thread.Start (); }
/// <summary> /// Updates the objective. /// </summary> /// <param name="index">Integer Index.</param> /// <param name="objective">StudentRecord.Objectives objective.</param> /// <c> /// Usage:\n /// StudentRecord.Objectives newRecord = new StudentRecord.Objectives();\n /// StudentRecord.LearnerScore newScore = new StudentRecord.LearnerScore ();\n /// newScore.scaled = 0.8f;\n /// newScore.raw = 80f;\n /// newScore.max = 100f;\n /// newScore.min = 0f;\n /// newRecord.score = newScore;\n /// newRecord.successStatus = StudentRecord.SuccessStatusType.passed;\n /// newRecord.completionStatus = StudentRecord.CompletionStatusType.completed;\n /// newRecord.progressMeasure = 1f;\n /// newRecord.description = "The description of this objective";\n /// ScormManager.UpdateObjective(1, newRecord); /// </c> public static void UpdateObjective(int index, StudentRecord.Objectives objective) { System.Threading.Thread thread = new System.Threading.Thread (() => CallUpdateObjective (index, objective)); thread.Start (); }
/// <summary> /// Loads the student record. /// </summary> /// <remarks>This is called on initialise and loads the SCORM data into the StudentRecord object. <see cref="Initialize_imp"/></remarks> /// <returns>The StudentRecord student record object.</returns> private static StudentRecord LoadStudentRecord() { studentRecord = new StudentRecord(); studentRecord.version = scormAPIWrapper.GetValue ("cmi._version"); //Comments From Learner int commentsFromLearnerCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_learner._count")); studentRecord.commentsFromLearner = new List<StudentRecord.CommentsFromLearner>(); if (commentsFromLearnerCount != 0) { for (int i = 0; i < commentsFromLearnerCount; i++) { string comment = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".comment"); string location = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".location"); DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".timestamp") ); StudentRecord.CommentsFromLearner newRecord = new StudentRecord.CommentsFromLearner(); newRecord.comment = comment; newRecord.location = location; newRecord.timeStamp = timestamp; studentRecord.commentsFromLearner.Add(newRecord); } } //Comments From LMS int commentsFromLMSCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_lms._count")); studentRecord.commentsFromLMS = new List<StudentRecord.CommentsFromLMS>(); if (commentsFromLMSCount != 0) { for (int i = 0; i < commentsFromLMSCount; i++) { string comment = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".comment"); string location = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".location"); DateTime timeStamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".timestamp") ); StudentRecord.CommentsFromLMS newRecord = new StudentRecord.CommentsFromLMS(); newRecord.comment = comment; newRecord.location = location; newRecord.timeStamp = timeStamp; studentRecord.commentsFromLMS.Add(newRecord); } } studentRecord.completionStatus = StringToCompletionStatusType (scormAPIWrapper.GetValue ("cmi.completion_status")); studentRecord.completionThreshold = ParseFloat(scormAPIWrapper.GetValue ("cmi.completion_threshold")); studentRecord.credit = StringToCreditType (scormAPIWrapper.GetValue ("cmi.credit")); studentRecord.entry = StringToEntryType (scormAPIWrapper.GetValue ("cmi.entry")); //Interactions int interactionCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions._count")); studentRecord.interactions = new List<StudentRecord.LearnerInteractionRecord>(); if (interactionCount != 0) { for (int i = 0; i < interactionCount; i++) { string id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".id"); StudentRecord.InteractionType type = StringToInteractionType( scormAPIWrapper.GetValue ("cmi.interactions."+i+".type") ); DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.interactions."+i+".timestamp") ); float weighting = ParseFloat( scormAPIWrapper.GetValue ("cmi.interactions."+i+".weighting") ); string response = scormAPIWrapper.GetValue ("cmi.interactions."+i+".learner_response"); float latency = timeIntervalToSeconds ( scormAPIWrapper.GetValue ("cmi.interactions."+i+".latency") ); string description = scormAPIWrapper.GetValue ("cmi.interactions."+i+".description"); float estimate = 0; StudentRecord.ResultType result = StringToResultType(scormAPIWrapper.GetValue ("cmi.interactions."+i+".result"), out estimate); StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord(); newRecord.id = id; newRecord.type = type; newRecord.timeStamp = timestamp; newRecord.weighting = weighting; newRecord.response = response; newRecord.latency = latency; newRecord.description = description; newRecord.result = result; newRecord.estimate = estimate; int interactionObjectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives._count")); newRecord.objectives = new List<StudentRecord.LearnerInteractionObjective>(); if(interactionObjectivesCount != 0) { for (int x = 0; x < interactionObjectivesCount; x++) { StudentRecord.LearnerInteractionObjective newObjective = new StudentRecord.LearnerInteractionObjective(); newObjective.id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives."+x+".id"); newRecord.objectives.Add(newObjective); } } int correctResponsesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses._count")); newRecord.correctResponses = new List<StudentRecord.LearnerInteractionCorrectResponse>(); if(correctResponsesCount != 0) { for (int x = 0; x < correctResponsesCount; x++) { StudentRecord.LearnerInteractionCorrectResponse newCorrectResponse = new StudentRecord.LearnerInteractionCorrectResponse(); newCorrectResponse.pattern = scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses."+x+".pattern"); newRecord.correctResponses.Add(newCorrectResponse); } } studentRecord.interactions.Add(newRecord); } } studentRecord.launchData = scormAPIWrapper.GetValue ("cmi.launch_data"); studentRecord.learnerID = scormAPIWrapper.GetValue ("cmi.learner_id"); studentRecord.learnerName = scormAPIWrapper.GetValue ("cmi.learner_name"); //learner_preference StudentRecord.LearnerPreference learnerPreference = new StudentRecord.LearnerPreference (); learnerPreference.audioLevel = ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_level")); learnerPreference.langauge = scormAPIWrapper.GetValue ("cmi.learner_preference.language"); learnerPreference.deliverySpeed = ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.delivery_speed")); learnerPreference.audioCaptioning = ParseInt (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_captioning")); studentRecord.learnerPreference = learnerPreference; studentRecord.location = scormAPIWrapper.GetValue ("cmi.location"); //Objectives int objectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.objectives._count")); studentRecord.objectives = new List<StudentRecord.Objectives> (); if (objectivesCount != 0) { for (int i = 0; i < objectivesCount; i++) { string id = scormAPIWrapper.GetValue ("cmi.objectives."+i+".id"); StudentRecord.LearnerScore objectivesScore = new StudentRecord.LearnerScore(); objectivesScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.scaled")); objectivesScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.raw")); objectivesScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.max")); objectivesScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.min")); StudentRecord.SuccessStatusType successStatus = StringToSuccessStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".success_status")); StudentRecord.CompletionStatusType completionStatus = StringToCompletionStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".completion_status")); float progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".progress_measure")); string description = scormAPIWrapper.GetValue ("cmi.objectives."+i+".description"); StudentRecord.Objectives newRecord = new StudentRecord.Objectives(); newRecord.id = id; newRecord.score = objectivesScore; newRecord.successStatus = successStatus; newRecord.completionStatus = completionStatus; newRecord.progressMeasure = progressMeasure; newRecord.description = description; studentRecord.objectives.Add(newRecord); } } studentRecord.maxTimeAllowed = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.max_time_allowed")); studentRecord.mode = StringToModeType (scormAPIWrapper.GetValue ("cmi.mode")); studentRecord.progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.progress_measure")); studentRecord.scaledPassingScore = ParseFloat(scormAPIWrapper.GetValue ("cmi.scaled_passing_score")); //Score studentRecord.learnerScore = new StudentRecord.LearnerScore (); studentRecord.learnerScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.scaled")); studentRecord.learnerScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.raw")); studentRecord.learnerScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.max")); studentRecord.learnerScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.min")); studentRecord.successStatus = StringToSuccessStatusType (scormAPIWrapper.GetValue ("cmi.success_status")); studentRecord.suspendData = scormAPIWrapper.GetValue ("cmi.suspend_data"); studentRecord.timeLimitAction = StringToTimeLimitActionType (scormAPIWrapper.GetValue ("cmi.time_limit_action")); studentRecord.totalTime = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.total_time")); return studentRecord; }
private void btnRefresh_Click(object sender, EventArgs e) { #region 更新資料 _startDate = dateTimeInput1.Text; _endDate = dateTimeInput2.Text; _txtReason = txtReason.Text.Trim(); btnRefresh.Enabled = false; //關掉開關 DelRowRecordList.Clear(); if (cbRange.SelectedIndex == 0) { #region 班級座號 KeyValuePair<string, ClassRecord> item = (KeyValuePair<string, ClassRecord>)cbClass.SelectedItem; List<StudentRecord> stulist = item.Value.Students; StudentRecord SeleteStud = new StudentRecord(); foreach (StudentRecord stud in stulist) { if (stud.SeatNo == null) { continue; } if ("" + stud.SeatNo == txtSeatNo.Text) { SeleteStud = stud; break; } } if (SeleteStud.ID == null) { FISCA.Presentation.Controls.MsgBox.Show("查無此座號,請重新輸入"); btnRefresh.Enabled = true; Waiting = false; txtSeatNo.SelectAll(); return; } else { List<StudentRecord> NowList = new List<StudentRecord>(); NowList.Add(SeleteStud); _loader.RunWorkerAsync(NowList); } #endregion } else if (cbRange.SelectedIndex == 1) { #region 學號 StudentRecord SeleteStud = new StudentRecord(); foreach (StudentRecord stud in Students) { if (stud.StudentNumber == txtClass.Text) { SeleteStud = stud; break; } } if (SeleteStud.ID == null) { FISCA.Presentation.Controls.MsgBox.Show("查無此學號,請重新輸入"); btnRefresh.Enabled = true; Waiting = false; txtClass.SelectAll(); } else { List<StudentRecord> NowList = new List<StudentRecord>(); NowList.Add(SeleteStud); _loader.RunWorkerAsync(NowList); } #endregion } else if (cbRange.SelectedIndex == 2) { #region 班級 KeyValuePair<string, ClassRecord> item = (KeyValuePair<string, ClassRecord>)cbClass.SelectedItem; if (item.Value.Students.Count == 0) { FISCA.Presentation.Controls.MsgBox.Show("本班級並無學生"); btnRefresh.Enabled = true; Waiting = false; return; } _loader.RunWorkerAsync(item.Value.Students); #endregion } else if (cbRange.SelectedIndex == 3) { #region 年級 KeyValuePair<string, List<ClassRecord>> item = (KeyValuePair<string, List<ClassRecord>>)cbClass.SelectedItem; List<StudentRecord> stud = new List<StudentRecord>(); foreach (ClassRecord STUD in item.Value) { stud.AddRange(STUD.Students); } _loader.RunWorkerAsync(stud); #endregion } else if (cbRange.SelectedIndex == 4) //全校 { _loader.RunWorkerAsync(Students); } #endregion //查詢不Log //ApplicationLog.Log("獎懲批次修改", "查詢", "獎懲批次修改,已使用查詢功能。"); }
public IActionResult Update(string scope, int id, [FromBody] StudentRecordUpdate update) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(new ErrorsResponse(ModelState))); } if (!_records.IsLocked(scope)) { return(StatusCode(422)); } var record = new StudentRecord { Id = id, StudentFirstName = update.StudentFirstName, StudentMiddleInitial = update.StudentMiddleInitial, StudentLastName = update.StudentLastName, StudentGradeLevel = update.StudentGradeLevel, StudentDateOfBirth = update.StudentDateOfBirth, StudentStreet1 = update.StudentStreet1, StudentStreet2 = update.StudentStreet2, StudentCity = update.StudentCity, StudentState = update.StudentState, StudentZipCode = update.StudentZipCode, StudentEnrollmentDate = update.StudentEnrollmentDate, StudentWithdrawalDate = update.StudentWithdrawalDate, StudentIsSpecialEducation = update.StudentIsSpecialEducation, StudentCurrentIep = update.StudentCurrentIep, StudentFormerIep = update.StudentFormerIep, StudentNorep = update.StudentNorep, }; var current = _records.Get(record.Id); var delta = MergeProperties(current, record, new[] { nameof(StudentRecord.Id), nameof(StudentRecord.StudentId), nameof(StudentRecord.SchoolDistrictId), nameof(StudentRecord.SchoolDistrictName), nameof(StudentRecord.Header), nameof(StudentRecord.LastUpdated), nameof(StudentRecord.ActivitySchoolYear), nameof(StudentRecord.StudentPaSecuredId), }); var username = User.FindFirst(c => c.Type == JwtRegisteredClaimNames.Sub).Value; using (var tx = _context.Database.BeginTransaction()) { try { _records.Update(current); _audits.Create(new AuditHeader { Username = username, Activity = AuditActivity.EDIT_STUDENT_RECORD, Timestamp = DateTime.Now, Identifier = current.StudentId, Details = delta.Select(d => new AuditDetail { Field = d.Key, Previous = d.Value.Previous, Next = d.Value.Next, }).ToList(), }); _context.SaveChanges(); tx.Commit(); } catch (Exception) { tx.Rollback(); throw; } } return(Ok()); }
private void btnPrint_Click(object sender, EventArgs e) { if (K12.Presentation.NLDPanels.Student.SelectedSource.Count < 1) { FISCA.Presentation.Controls.MsgBox.Show("請先選擇學生"); return; } btnPrint.Enabled = false; filter f = new filter { GradeType = comboBoxEx2.Text }; Document document = new Document(); BackgroundWorker bgw = new BackgroundWorker(); Dictionary <StudentRecord, List <string> > errCheck = new Dictionary <StudentRecord, List <string> >(); bgw.DoWork += delegate { #region DoWork Byte[] template; if (K12.Presentation.NLDPanels.Student.SelectedSource.Count <= 0) { return; } List <string> sids = K12.Presentation.NLDPanels.Student.SelectedSource; Dictionary <string, SemesterHistoryRecord> dshr = SemesterHistory.SelectByStudentIDs(sids).ToDictionary(x => x.RefStudentID, x => x); Dictionary <string, StudentRecord> dsr = Student.SelectByIDs(sids).ToDictionary(x => x.ID, x => x); Dictionary <string, SemesterScoreRecord> dssr = SemesterScore.SelectByStudentIDs(sids).ToDictionary(x => x.RefStudentID + "#" + x.SchoolYear + "#" + x.Semester, x => x); DataTable dt = tool._Q.Select("select ref_student_id,entrance_date,leaving_date from $jhcore_bilingual.studentrecordext where ref_student_id in ('" + string.Join("','", sids) + "')"); Dictionary <string, edld> dedld = new Dictionary <string, edld>(); DateTime tmp; foreach (DataRow row in dt.Rows) { if (!dedld.ContainsKey("" + row["ref_student_id"])) { dedld.Add("" + row["ref_student_id"], new edld() { }); } if (DateTime.TryParse("" + row["entrance_date"], out tmp)) { dedld["" + row["ref_student_id"]].entrance_date = tmp; } if (DateTime.TryParse("" + row["leaving_date"], out tmp)) { dedld["" + row["ref_student_id"]].leaving_date = tmp; } } List <string> gradeYearList; int domainDicKey; switch (f.GradeType) { case "3~6": case "6": gradeYearList = new List <string> { "3", "4", "5", "6" }; domainDicKey = 6; template = (ReportConfiguration3_6.Template != null) //單頁範本 ? ReportConfiguration3_6.Template.ToBinary() : new Campus.Report.ReportTemplate(Properties.Resources._6樣版, Campus.Report.TemplateType.Word).ToBinary(); Choose3to6Grade = true; break; case "7~8": case "8": gradeYearList = new List <string> { "7", "8" }; domainDicKey = 8; template = (ReportConfiguration7_8.Template != null) //單頁範本 ? ReportConfiguration7_8.Template.ToBinary() : new Campus.Report.ReportTemplate(Properties.Resources._8樣版, Campus.Report.TemplateType.Word).ToBinary(); Choose7to8Grade = true; break; case "9~12": case "12": gradeYearList = new List <string> { "9", "10", "11", "12" }; domainDicKey = 12; template = (ReportConfiguration9_12.Template != null) //單頁範本 ? ReportConfiguration9_12.Template.ToBinary() : new Campus.Report.ReportTemplate(Properties.Resources._9_12_grade樣板, Campus.Report.TemplateType.Word).ToBinary(); break; default: return; } List <CourseGradeB.Tool.Domain> cgbdl = CourseGradeB.Tool.DomainDic[domainDicKey]; // 2016/5/18 穎驊新增功能,因原本3~6年級其Domain 並無English、Western Social Studies ,會造成如果沒有成績,而不顯示N/A直接空白的問題 if (Choose3to6Grade) { English.Hours = 6; English.Name = "English"; English.ShortName = "English"; WesternSocialStudies.Hours = 2; WesternSocialStudies.Name = "Western Social Studies"; WesternSocialStudies.ShortName = "W.S.S"; cgbdl.Add(English); cgbdl.Add(WesternSocialStudies); } // 2016/5/20(蔡英文上任)穎驊新增功能,因原本7~8年級其Domain 並無Elective ,會造成如果沒有成績,而不顯示N/A直接空白的問題 if (Choose7to8Grade) { Elective.Hours = 2; Elective.Name = "Elective"; Elective.ShortName = "Elective"; cgbdl.Add(Elective); } cgbdl.Sort(delegate(CourseGradeB.Tool.Domain x, CourseGradeB.Tool.Domain y) { return(x.DisplayOrder.CompareTo(y.DisplayOrder)); }); //int domainCount; Dictionary <string, string> NationalityMapping = K12.EduAdminDataMapping.Utility.GetNationalityMappingDict(); Dictionary <string, object> mailmerge = new Dictionary <string, object>(); GradeCumulateGPA gcgpa = new GradeCumulateGPA(); foreach (var studentID in dshr.Keys) {//學生 System.IO.Stream docStream = new System.IO.MemoryStream(template); Document each = new Document(docStream); //DocumentBuilder db = new DocumentBuilder(each); //Table table = (Table)each.GetChild(NodeType.Table, 1, true); //table.AllowAutoFit = true; //not work,why ? // 2016/4/28 取得樣板上,所有的功能變數,以利以後核對使用。 string[] fieldNames = each.MailMerge.GetFieldNames(); grade lastGrade = null; mailmerge.Clear(); mailmerge.Add("列印日期", DateTime.Today.ToString("MMMM d, yyyy", new System.Globalization.CultureInfo("en-US"))); #region 學生資料 StudentRecord sr = dsr[studentID]; mailmerge.Add("學生系統編號", sr.ID); mailmerge.Add("學號", sr.StudentNumber); mailmerge.Add("姓名", sr.Name); mailmerge.Add("英文名", sr.EnglishName); string gender; switch (sr.Gender) { case "男": gender = "Male"; break; case "女": gender = "Female"; break; default: gender = sr.Gender; break; } mailmerge.Add("性別", gender); mailmerge.Add("國籍", sr.Nationality); if (NationalityMapping.ContainsKey(sr.Nationality)) { mailmerge["國籍"] = NationalityMapping[sr.Nationality]; } mailmerge.Add("生日", sr.Birthday.HasValue ? sr.Birthday.Value.ToString("d-MMMM-yyyy", new System.Globalization.CultureInfo("en-US")) : ""); string esy = "", edog = ""; if (dedld.ContainsKey(studentID)) { if (dedld[studentID].entrance_date != null) { esy = dedld[studentID].entrance_date.Value.ToString("MMMM-yyyy", new System.Globalization.CultureInfo("en-US")); } if (dedld[studentID].leaving_date != null) { edog = dedld[studentID].leaving_date.Value.ToString("MMMM-yyyy", new System.Globalization.CultureInfo("en-US")); } } mailmerge.Add("入學日期", esy); mailmerge.Add("預計畢業日期", edog); //mailmerge.Add("Registrar", row.Value[0].SeatNo); //mailmerge.Add("Dean", row.Value[0].SeatNo); //mailmerge.Add("Principal", row.Value[0].SeatNo); #endregion #region 學生成績 Dictionary <int, grade> dgrade = new Dictionary <int, grade>(); #region 整理學生成績及年級 foreach (SemesterHistoryItem shi in dshr[studentID].SemesterHistoryItems) { if (!gradeYearList.Contains("" + shi.GradeYear)) { continue; } int _gradeYear = shi.GradeYear; string key = shi.RefStudentID + "#" + shi.SchoolYear + "#" + shi.Semester; if (!dgrade.ContainsKey(_gradeYear)) { dgrade.Add(_gradeYear, new grade() { grade_year = shi.GradeYear, school_year = shi.SchoolYear }); } if (shi.Semester == 1) { dgrade[_gradeYear].semester = 1; if (dssr.ContainsKey(key)) { dgrade[_gradeYear].sems1 = dssr[key]; } } else if (shi.Semester == 2) { dgrade[_gradeYear].semester = 2; if (dssr.ContainsKey(key)) { dgrade[_gradeYear].sems2 = dssr[key]; } } } #endregion mailmerge.Add("GPA", ""); int gradeCount = 1; foreach (string gy in gradeYearList) {//級別_ //群 , 科目 , 分數 //Dictionary<string, Dictionary<string, course>> dcl = new Dictionary<string, Dictionary<string, course>>(); Dictionary <string, List <SubjectScore> > dcl = new Dictionary <string, List <SubjectScore> >(); mailmerge.Add(string.Format("級別{0}", gradeCount), gy); mailmerge.Add(string.Format("學年度{0}", gradeCount), ""); if (dgrade.ContainsKey(int.Parse(gy))) { grade g = dgrade[int.Parse(gy)]; mailmerge[string.Format("學年度{0}", gradeCount)] = (g.school_year + 1911) + "-" + (g.school_year + 1912); foreach (var semScore in new SemesterScoreRecord[] { g.sems1, g.sems2 }) { if (semScore != null) { foreach (var subjectScore in semScore.Subjects.Values) { //if (!dcl.ContainsKey(subjectScore.Domain)) // dcl.Add(subjectScore.Domain, new Dictionary<string, course>()); //if (!dcl[subjectScore.Domain].ContainsKey(subjectScore.Subject)) // dcl[subjectScore.Domain].Add(subjectScore.Subject, new course()); //switch (subjectScore.Semester) //{ // case 1: // dcl[subjectScore.Domain][subjectScore.Subject].sems1_title = subjectScore.Subject; // dcl[subjectScore.Domain][subjectScore.Subject].sems1_score = subjectScore.Score.HasValue ? Math.Round(subjectScore.Score.Value, 0, MidpointRounding.AwayFromZero) : 0; // break; // case 2: // dcl[subjectScore.Domain][subjectScore.Subject].sems2_title = subjectScore.Subject; // dcl[subjectScore.Domain][subjectScore.Subject].sems2_score = subjectScore.Score.HasValue ? Math.Round(subjectScore.Score.Value, 0, MidpointRounding.AwayFromZero) : 0; // break; //} if (!dcl.ContainsKey(subjectScore.Domain)) { dcl.Add(subjectScore.Domain, new List <SubjectScore>()); } subjectScore.Score = subjectScore.Score.HasValue ? Math.Round(subjectScore.Score.Value, 0, MidpointRounding.AwayFromZero) : 0; dcl[subjectScore.Domain].Add(subjectScore); } } } //使用學期歷程最後一筆的學年度學期 if (g.sems1 != null) { mailmerge["GPA"] = g.sems1.CumulateGPA; } if (g.sems2 != null) { mailmerge["GPA"] = g.sems2.CumulateGPA; } lastGrade = g; } //檢查預設清單,缺漏處補回空資料 foreach (CourseGradeB.Tool.Domain domain in cgbdl) { //if (!dcl.ContainsKey(domain.Name)) // dcl.Add(domain.Name, new Dictionary<string, course>()); if (!dcl.ContainsKey(domain.Name)) { dcl.Add(domain.Name, new List <SubjectScore>()); } } foreach (var domain in dcl.Keys) { foreach (var semester in new int[] { 1, 2 }) { //群 int courseCount = 1; dcl[domain].Sort((SubjectScore s1, SubjectScore s2) => { return((s1.Subject + " (" + s1.Credit + ")").CompareTo(s2.Subject + " (" + s2.Credit + ")")); }); foreach (var item in dcl[domain]) { if (item.Semester == semester) { mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目{3}", domain.FixFieldName(), gradeCount, semester, courseCount), item.Subject + " (" + item.Credit + ")"); mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目級別{3}", domain.FixFieldName(), gradeCount, semester, courseCount), "Level:" + item.Level); mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目成績{3}", domain.FixFieldName(), gradeCount, semester, courseCount), "" + item.Score); // 2016/4/28 穎驊筆記,下面為檢察功能,fieldName為目前樣板的所有功能變數,假如樣版沒有完整的對應功能變數,會加入錯誤訊息提醒。 if (!fieldNames.Contains(string.Format("{0}_級{1}_學期{2}_科目成績{3}", domain.FixFieldName(), gradeCount, semester, courseCount))) { if (!errCheck.ContainsKey(sr)) { errCheck.Add(sr, new List <string>()); } errCheck[sr].Add("合併欄位「" + string.Format("{0}_級{1}_學期{2}_科目成績{3}", domain.FixFieldName(), gradeCount, semester, courseCount) + "」在樣板中不存在(" + item.SchoolYear + "學年度第" + item.Semester + "學期 科目名稱 " + item.Subject + ")。"); } courseCount++; //mailmerge.Add(string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount), item.sems1_title); //mailmerge.Add(string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount), item.sems2_title); ////都存在且相同才需要合併 //if (item.sems1_title != null && item.sems2_title != null && item.sems1_title == item.sems2_title) //{ // mailmerge[string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = item.sems1_title }; // mailmerge[string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = item.sems2_title }; //} //mailmerge.Add(string.Format("{0}_級{1}_學期1_科目成績{2}", domain.FixFieldName(), gradeCount, courseCount), // item.sems1_title != null ? "" + item.sems1_score : "N/A"); //mailmerge.Add(string.Format("{0}_級{1}_學期2_科目成績{2}", domain.FixFieldName(), gradeCount, courseCount), // item.sems2_title != null ? "" + item.sems2_score : "N/A"); //courseCount++; } } for (; courseCount <= 3; courseCount++) { mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目{3}", domain.FixFieldName(), gradeCount, semester, courseCount), ""); mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目級別{3}", domain.FixFieldName(), gradeCount, semester, courseCount), ""); mailmerge.Add(string.Format("{0}_級{1}_學期{2}_科目成績{3}", domain.FixFieldName(), gradeCount, semester, courseCount), "N/A"); //mailmerge.Add(string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount), new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = "" }); //mailmerge.Add(string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount), new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = "" }); //mailmerge.Add(string.Format("{0}_級{1}_學期1_科目成績{2}", domain.FixFieldName(), gradeCount, courseCount), "N/A"); //mailmerge.Add(string.Format("{0}_級{1}_學期2_科目成績{2}", domain.FixFieldName(), gradeCount, courseCount), "N/A"); } } for (var courseCount = 1; courseCount <= 3; courseCount++) { var subjName1 = "" + mailmerge[string.Format("{0}_級{1}_學期{2}_科目{3}", domain.FixFieldName(), gradeCount, 1, courseCount)]; var subjName2 = "" + mailmerge[string.Format("{0}_級{1}_學期{2}_科目{3}", domain.FixFieldName(), gradeCount, 2, courseCount)]; if (subjName1 == subjName2 || subjName1 == "" || subjName2 == "") { mailmerge[string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjName1 }; mailmerge[string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjName1 }; } if (subjName1 != "" && subjName2 == "") { mailmerge[string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjName1 }; mailmerge[string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjName1 }; } if (subjName1 == "" && subjName2 != "") { mailmerge[string.Format("{0}_級{1}_學期1_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjName2 }; mailmerge[string.Format("{0}_級{1}_學期2_科目{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjName2 }; } var subjLevel1 = "" + mailmerge[string.Format("{0}_級{1}_學期{2}_科目級別{3}", domain.FixFieldName(), gradeCount, 1, courseCount)]; var subjLevel2 = "" + mailmerge[string.Format("{0}_級{1}_學期{2}_科目級別{3}", domain.FixFieldName(), gradeCount, 2, courseCount)]; if (subjLevel1 == subjLevel2) { mailmerge[string.Format("{0}_級{1}_學期1_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjLevel1 }; mailmerge[string.Format("{0}_級{1}_學期2_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjLevel1 }; } if (subjLevel1 != "" && subjLevel2 == "") { mailmerge[string.Format("{0}_級{1}_學期1_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjLevel1 }; mailmerge[string.Format("{0}_級{1}_學期2_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjLevel1 }; } if (subjLevel1 == "" && subjLevel2 != "") { mailmerge[string.Format("{0}_級{1}_學期1_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.First, value = subjLevel2 }; mailmerge[string.Format("{0}_級{1}_學期2_科目級別{2}", domain.FixFieldName(), gradeCount, courseCount)] = new mailmergeSpecial() { cellmerge = Aspose.Words.Tables.CellMerge.Previous, value = subjLevel2 }; } } } gradeCount++; } GradeCumulateGPARecord gcgpar; mailmerge.Add("級最高GPA", ""); mailmerge.Add("級平均GPA", ""); if (lastGrade != null && sr.Class != null) { //if (lastGrade.semester != null) //{ gcgpar = gcgpa.GetGradeCumulateGPARecord(lastGrade.school_year, lastGrade.semester, lastGrade.grade_year); if (gcgpar != null) { mailmerge["級最高GPA"] = decimal.Round(gcgpar.MaxGPA, 2, MidpointRounding.AwayFromZero); mailmerge["級平均GPA"] = decimal.Round(gcgpar.AvgGPA, 2, MidpointRounding.AwayFromZero); } //} } #endregion // 正式把MailMerge資料 給填上去,2015/4/27 驊紀錄 each.MailMerge.FieldMergingCallback = new MailMerge_MergeField(); each.MailMerge.Execute(mailmerge.Keys.ToArray(), mailmerge.Values.ToArray()); each.MailMerge.DeleteFields(); document.Sections.Add(document.ImportNode(each.FirstSection, true)); //2016/4/28 以下是恩正給穎驊的程式碼,可以輸出本程式MergeField 所有功能變數的縮寫成一個獨立Doc檔 // 在未來如果要要大量更動新增表格很方便可以直接複製貼上使用,如要使用,將上方原本的輸出MergeField、下面的//document.Sections.RemoveAt(0);註解掉即可。 //{ // Document doc = new Document(); // DocumentBuilder bu = new DocumentBuilder(doc); // bu.MoveToDocumentStart(); // bu.CellFormat.Borders.LineStyle = LineStyle.Single; // bu.CellFormat.VerticalAlignment = CellVerticalAlignment.Center; // Table table = bu.StartTable(); // foreach (String col in mailmerge.Keys) // { // bu.InsertCell(); // bu.CellFormat.Width = 15; // bu.InsertField("MERGEFIELD " + col + @" \* MERGEFORMAT", "«.»"); // bu.ParagraphFormat.Alignment = ParagraphAlignment.Center; // bu.InsertCell(); // bu.CellFormat.Width = 125; // bu.Write(col); // bu.ParagraphFormat.Alignment = ParagraphAlignment.Left; // bu.EndRow(); // } // table.AllowAutoFit = false; // bu.EndTable(); // document = doc; // break; //} } document.Sections.RemoveAt(0); #endregion }; bgw.RunWorkerCompleted += delegate { if (errCheck.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (var stuRec in errCheck.Keys) { foreach (var err in errCheck[stuRec]) { sb.AppendLine(string.Format("{0} {1}({2}) {3}:{4}", stuRec.StudentNumber, stuRec.Class != null ? stuRec.Class.Name : "", stuRec.SeatNo, stuRec.Name, err)); } } MessageBox.Show(sb.ToString()); } #region Completed btnPrint.Enabled = true; //if (e.Error != null) //{ // MessageBox.Show(e.Error.Message); // return; //} Document inResult = document; try { SaveFileDialog SaveFileDialog1 = new SaveFileDialog(); SaveFileDialog1.Filter = "Word (*.doc)|*.doc|所有檔案 (*.*)|*.*"; SaveFileDialog1.FileName = "國外成績單"; if (SaveFileDialog1.ShowDialog() == DialogResult.OK) { inResult.Save(SaveFileDialog1.FileName); Process.Start(SaveFileDialog1.FileName); FISCA.Presentation.MotherForm.SetStatusBarMessage(SaveFileDialog1.FileName + ",列印完成!!"); //Update_ePaper ue = new Update_ePaper(new List<Document> { inResult }, current, PrefixStudent.學號); //ue.ShowDialog(); } else { FISCA.Presentation.Controls.MsgBox.Show("檔案未儲存"); return; } } catch (Exception exp) { string msg = "檔案儲存錯誤,請檢查檔案是否開啟中!!"; FISCA.Presentation.Controls.MsgBox.Show(msg + "\n" + exp.Message); FISCA.Presentation.MotherForm.SetStatusBarMessage(msg + "\n" + exp.Message); } #endregion }; bgw.RunWorkerAsync(); }
/// <summary> /// Add a new Objective /// </summary> /// <remarks> /// Calls SetValue on scorm.js. for each element in the Objectives. Launches a seperate thread for the work. /// This is the target function of the <see cref="AddObjective"/> function call. /// </remarks> /// <param name="objective">Objective.</param> private static void CallAddObjective(StudentRecord.Objectives objective) { try { if(!CheckThread())return; WaitForInitialize(); string identifier; string strValue; objective.id = "urn:STALS:objective-id-" + studentRecord.objectives.Count.ToString (); //Override ID to ensure it is uniqu //Set timestamp to Now //All other properties must be set by the caller //Set the Objective Values int i = studentRecord.objectives.Count; studentRecord.objectives.Add(objective); identifier = "cmi.objectives."+i+".id"; strValue = objective.id; scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.scaled"; strValue = objective.score.scaled.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.raw"; strValue = objective.score.raw.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.max"; strValue = objective.score.max.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.min"; strValue = objective.score.min.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".success_status"; strValue = CustomTypeToString( objective.successStatus); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".completion_status"; strValue = CustomTypeToString( objective.completionStatus); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".progress_measure"; strValue = objective.progressMeasure.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".description"; strValue = objective.description; scormAPIWrapper.SetValue(identifier,strValue); } catch(System.Exception e) { UnityEngine.Application.ExternalCall("DebugPrint", "***CallAddObjective***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source ); } }
/// <summary> /// Adds the objective to list. /// </summary> /// <remarks>When a new objective is added via the GUI, we need to add a new 'AnObjective' prefab.</remarks> /// <param name="index">Index.</param> /// <param name="newObjective">New objective.</param> private void AddObjectiveToList(int index, StudentRecord.Objectives newObjective) { Transform panelObjectivesList = GameObject.Find ("PanelObjectivesList").transform; Transform transformNewObjectve = Instantiate(AnObjective); transformNewObjectve.SetParent (panelObjectivesList); transformNewObjectve.GetComponent<AnObjective>().Initialise(index,newObjective); }
/// <summary> /// Adds the objective. /// </summary> /// <remarks> /// Contains: /// 1. cmi.objectives.n.id (long_identifier_type (SPM: 4000), RW) Unique label for the objective /// 2. cmi.objectives.n.score._children (scaled,raw,min,max, RO) Listing of supported data model elements /// 3. cmi.objectives.n.score.scaled (real (10,7) range (-1..1), RW) Number that reflects the performance of the learner for the objective /// 4. cmi.objectives.n.score.raw (real (10,7), RW) Number that reflects the performance of the learner, for the objective, relative to the range bounded by the values of min and max /// 5. cmi.objectives.n.score.min (real (10,7), RW) Minimum value, for the objective, in the range for the raw score /// 6. cmi.objectives.n.score.max (real (10,7), RW) Maximum value, for the objective, in the range for the raw score /// 7. cmi.objectives.n.success_status (“passed”, “failed”, “unknown”, RW) Indicates whether the learner has mastered the objective /// 8. cmi.objectives.n.completion_status (“completed”, “incomplete”, “not attempted”, “unknown”, RW) Indicates whether the learner has completed the associated objective /// 9. cmi.objectives.n.progress_measure (real (10,7) range (0..1), RW) Measure of the progress the learner has made toward completing the objective /// 10. cmi.objectives.n.description (localized_string_type (SPM: 250), RW) Provides a brief informative description of the objective /// </remarks> /// <param name="objective">StudentRecord.Objectives objective.</param> /// <c> /// Usage:\n /// StudentRecord.Objectives newRecord = new StudentRecord.Objectives();\n /// StudentRecord.LearnerScore newScore = new StudentRecord.LearnerScore ();\n /// newScore.scaled = 0.8f;\n /// newScore.raw = 80f;\n /// newScore.max = 100f;\n /// newScore.min = 0f;\n /// newRecord.score = newScore;\n /// newRecord.successStatus = StudentRecord.SuccessStatusType.passed;\n /// newRecord.completionStatus = StudentRecord.CompletionStatusType.completed;\n /// newRecord.progressMeasure = 1f;\n /// newRecord.description = "The description of this objective";\n /// ScormManager.AddObjective(newRecord); /// </c> public static void AddObjective(StudentRecord.Objectives objective) { System.Threading.Thread thread = new System.Threading.Thread (() => CallAddObjective (objective)); thread.Start (); }
/// <summary> /// Adds the learner interaction to the list. /// </summary> /// /// <remarks>When a new interaction is added via the GUI, we need to add it to the list in the GUI</remarks> /// <param name="record">Record.</param> public void AddLearnerInteractionToList(StudentRecord.LearnerInteractionRecord record) { string stringInteractionsList = ""; string timeStamp = record.timeStamp.ToString(); // Get the Interaction data as strings String id = record.id; string type = record.type.ToString(); string weighting = record.weighting.ToString(); string latency = record.latency.ToString(); string description = record.description; string response = record.response; string result = record.result.ToString(); // If the Interaction result is set as the 'estimate', the result needs to be set to the numeric estimate value if(record.result == StudentRecord.ResultType.estimate) { result = record.estimate.ToString(); } string stringInteractionObjectivesList = ""; // Load the list of objectives and format it into a string if(record.objectives != null) { List<StudentRecord.LearnerInteractionObjective> interactionObjectivesList = record.objectives; if(interactionObjectivesList.Count > 0) { string stringObjectiveIds = ""; foreach(StudentRecord.LearnerInteractionObjective singleObjective in interactionObjectivesList) { stringObjectiveIds += singleObjective.id + " "; } stringInteractionObjectivesList = "Objectives ("+ stringObjectiveIds+")\n"; } } string stringInteractionCorrectResponseList = ""; // Load the list of correct response patterns and format it into a string if(record.correctResponses != null) { List<StudentRecord.LearnerInteractionCorrectResponse> interactionCorrectResponseList = record.correctResponses; if(interactionCorrectResponseList.Count > 0) { string stringPatterns = ""; foreach(StudentRecord.LearnerInteractionCorrectResponse singleCorrectResponse in interactionCorrectResponseList) { stringPatterns += singleCorrectResponse.pattern + " "; } stringInteractionCorrectResponseList = "Correct Response Patterns ("+ stringPatterns+")\n"; } } stringInteractionsList += timeStamp + " :: " + id + "\n" + description + "\n(type: "+type+" weighting: "+weighting+" latency: "+latency+"secs)\nResponse: "+response+" Result: "+result+"\n"+stringInteractionCorrectResponseList+stringInteractionObjectivesList+"\n"; // Format the entire Interaction data set as a string and add to the GUI element GameObject.Find ("InteractionList").GetComponent<Text> ().text += stringInteractionsList; }
/// <summary> /// Internal implementation of communication with the LMS /// </summary> /// <remarks> /// Read all the data from the LMS into the internal data structure. Runs in a seperate thread. /// Will fire "Scorm_Initialize_Complete" when the datamodel is ready to be manipulated /// </remarks> private static void Initialize_imp() { if(!CheckThread())return; scormAPIWrapper = new ScormAPIWrapper(objectName,"ScormValueCallback"); scormAPIWrapper.Initialize(); try { if(scormAPIWrapper.IsScorm2004) { //Load StudentRecord data using SCORM 2004 studentRecord = LoadStudentRecord(); } else { //Load StudentRecord data using SCORM 1.2 throw new System.InvalidOperationException("SCORM 1.2 not currently supported"); //TODO: Not currently supported. } } catch(Exception e) { UnityEngine.Application.ExternalCall("DebugPrint", "***Initialize_imp***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source ); } initialized = true; GameObject.Find(objectName).BroadcastMessage("Scorm_Initialize_Complete",SendMessageOptions.DontRequireReceiver); }
/// <summary> /// Update an existing Objective /// </summary> /// <remarks> /// Calls SetValue on scorm.js. for each element in the Objectives. Launches a seperate thread for the work. /// This is the target function of the <see cref="UpdateObjective"/> function call. /// </remarks> /// <param name="i">The index.</param> /// <param name="objective">Objective.</param> private static void CallUpdateObjective(int i, StudentRecord.Objectives objective) { try { if(!CheckThread())return; WaitForInitialize(); string identifier; string strValue; //Set the Objective Values identifier = "cmi.objectives."+i+".id"; strValue = objective.id; scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.scaled"; strValue = objective.score.scaled.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.raw"; strValue = objective.score.raw.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.max"; strValue = objective.score.max.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".score.min"; strValue = objective.score.min.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".success_status"; strValue = CustomTypeToString( objective.successStatus); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".completion_status"; strValue = CustomTypeToString( objective.completionStatus); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".progress_measure"; strValue = objective.progressMeasure.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.objectives."+i+".description"; strValue = objective.description; scormAPIWrapper.SetValue(identifier,strValue); studentRecord.objectives[i] = objective; } catch(System.Exception e) { UnityEngine.Application.ExternalCall("DebugPrint", "***CallUpdateObjective***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source ); } }
/// <summary> /// Update an exitsing Learner Interaction /// </summary> /// <remarks> /// Calls SetValue on scorm.js. for each element in the LearnerInteractionRecord. Launches a seperate thread for the work. /// This is the target function of the <see cref="UpdateInteraction"/> function call. /// </remarks> /// <param name="i">The index of the interaction in the existing LearnerInteraction.</param> /// <param name="interaction">Interaction.</param> private static void CallUpdateInteraction(int i, StudentRecord.LearnerInteractionRecord interaction) { try { if(!CheckThread())return; WaitForInitialize(); string identifier; string strValue; interaction.timeStamp = DateTime.Now; //Set timestamp to Now //All other properties must be set by the caller //Set the interaction Values identifier = "cmi.interactions."+i+".type"; strValue = CustomTypeToString (interaction.type); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".timestamp"; strValue = String.Format("{0:s}", interaction.timeStamp); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".weighting"; strValue = interaction.weighting.ToString(); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".learner_response"; strValue = interaction.response; scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".result"; strValue = CustomTypeToString (interaction.result); if (interaction.result == StudentRecord.ResultType.estimate) { strValue = interaction.estimate.ToString(); } scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".latency"; strValue = secondsToTimeInterval(interaction.latency); scormAPIWrapper.SetValue(identifier,strValue); identifier = "cmi.interactions."+i+".description"; strValue = interaction.description; scormAPIWrapper.SetValue(identifier,strValue); int objectivesCount = interaction.objectives.Count; if(objectivesCount != 0) { for (int x = 0; x < objectivesCount; i++) { identifier = "cmi.interactions."+i+".objectives."+x+".id"; strValue = interaction.objectives[x].id; scormAPIWrapper.SetValue(identifier,strValue); } } int correctResponsesCount = interaction.correctResponses.Count; if(correctResponsesCount != 0) { for (int x = 0; x < correctResponsesCount; i++) { identifier = "cmi.interactions."+i+".correct_responses."+x+".pattrern"; strValue = interaction.correctResponses[x].pattern; scormAPIWrapper.SetValue(identifier,strValue); } } studentRecord.interactions[i] = interaction; } catch(System.Exception e) { UnityEngine.Application.ExternalCall("DebugPrint", "***CallUpdateInteraction***" + e.Message +"<br/>" + e.StackTrace + "<br/>" + e.Source ); } }
/// <summary> /// 檢查學生是否有缺考, 小郭, 2013/12/17 /// </summary> /// <returns></returns> private bool IsMissingExam(StudentRecord student) { string missingWord = "缺"; List<string> checkSubjectList = new List<string>(); // 產生要檢查有沒有缺考的科目 if (cboSortType.Text == "科目排名") { // 只檢查單一個科目 checkSubjectList.Add(lbxSubjct.Text); } else { // 檢查多的科目 foreach (ListViewItem selSubject in lstSubject.CheckedItems) { checkSubjectList.Add(selSubject.Text); } } // 判斷有沒有缺考的科目 foreach (ExamScoreInfo exam in student.ExamScoreList) { foreach (string subjectName in checkSubjectList) { if ((cboExam.Text == exam.ExamName || cboExamlst.Text == exam.ExamName) && // 找到指定的試別 ((exam.Subject + exam.SubjectLevel) == subjectName) && // 找到要檢查的科目 (exam.SpecialCase == missingWord)) // 判斷是否為缺考 { // 有缺考科目 return true; } } } return false; }
/// <summary> /// Sets the completion status. /// </summary> /// <remarks> /// cmi.completion_status (“completed”, “incomplete”, “not attempted”, “unknown”, RW) Indicates whether the learner has completed the SCO /// </remarks> /// <param name="value">StudentRecord.CompletionStatusType object.</param> public static void SetCompletionStatus(StudentRecord.CompletionStatusType value) { string identifier = "cmi.completion_status"; string strValue = CustomTypeToString(value); studentRecord.completionStatus = value; SetValue (identifier, strValue); }
/// <summary> /// Updates the comment from learner. /// </summary> /// <param name="index">Index of the comment to update.</param> /// <param name="comment">StudentRecord.CommentsFromLearner object.</param> /// <c> /// Usage:\n /// int index = 1;\n /// StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner ();\n /// comment.comment = "The comment";\n /// comment.location = "The location (bookmark) in the SCO";\n /// ScormManager.UpdateCommentFromLearner(index, comment); /// </c> public static void UpdateCommentFromLearner(int index, StudentRecord.CommentsFromLearner comment) { System.Threading.Thread thread = new System.Threading.Thread (() => CallUpdateCommentFromLearner (index, comment)); thread.Start (); }
/// <summary> /// Updates the interaction. /// </summary> /// <param name="index">Index.</param> /// <param name="interaction">Interaction (StudentRecord.LearnerInteractionRecord).</param> /// <c> /// Usage:\n /// int index = 0; /// StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord();\n /// newRecord.type = StudentRecord.InteractionType.other;\n /// newRecord.timeStamp = DateTime.Now;\n /// newRecord.weighting = 0.5f;\n /// newRecord.response = "true";\n /// newRecord.latency = 12f;\n /// newRecord.description = "Is this easy to use?";\n /// newRecord.result = StudentRecord.ResultType.correct;\n /// newRecord.estimate = 1f; //Not used\n /// \n /// ScormManager.UpdateInteraction (index, newRecord);\n /// </c> public static void UpdateInteraction(int index, StudentRecord.LearnerInteractionRecord interaction) { System.Threading.Thread thread = new System.Threading.Thread (() => CallUpdateInteraction (index,interaction)); thread.Start (); }
/// <summary> /// Sets the learner preference. /// </summary> /// <param name="learnerPreference">Learner preference.</param> /// <c> /// Usage:\n /// StudentRecord.LearnerPreference learnerPreference = new StudentRecord.LearnerPreference();\n /// learnerPreference.audioLevel = 1.1;\n /// learnerPreference.deliverySpeed = 1f;\n /// learnerPreference.audioCaptioning = 0;\n /// learnerPreference.langauge = "";\n /// ScormManager.SetLearnerPreference(learnerPreference); /// </c> public static void SetLearnerPreference(StudentRecord.LearnerPreference learnerPreference) { string identifier = "cmi.learner_preference.audio_level"; string strValue = learnerPreference.audioLevel.ToString (); SetValue (identifier, strValue); identifier = "cmi.learner_preference.language"; strValue = learnerPreference.langauge; SetValue (identifier, strValue); identifier = "cmi.learner_preference.delivery_speed"; strValue = learnerPreference.deliverySpeed.ToString (); SetValue (identifier, strValue); identifier = "cmi.learner_preference.audio_captioning"; strValue = learnerPreference.audioCaptioning.ToString (); SetValue (identifier, strValue); studentRecord.learnerPreference = learnerPreference; }
private int 進步排名排序(StudentRecord c1, StudentRecord c2) { object o1 = "0", o2 = "0"; decimal d1 = 0, d2 = 0; c1.Fields.TryGetValue("進步排名", out o1); c2.Fields.TryGetValue("進步排名", out o2); decimal.TryParse("" + o1, out d1); decimal.TryParse("" + o2, out d2); return d2.CompareTo(d1); }
//void dataGridViewX1_DataError(object sender, DataGridViewDataErrorEventArgs e) //{ // MsgBox.Show("輸入資料錯誤!!"); // e.Cancel = false; //} void BGW_FormLoad_DoWork(object sender, DoWorkEventArgs e) { StringBuilder sb_3 = new StringBuilder(); GetPoint = new 成績取得器(); GetPoint.SetWeightProportion(); GetPoint.GetSCJoinByClubIDList(ClubAdmin.Instance.SelectedSource); #region 社團老師資訊 List <string> teacherIDList = new List <string>(); foreach (CLUBRecord club in GetPoint._ClubDic.Values) { if (!string.IsNullOrEmpty(club.RefTeacherID)) { if (!teacherIDList.Contains(club.RefTeacherID)) { teacherIDList.Add(club.RefTeacherID); } } } List <TeacherRecord> TeacherList = Teacher.SelectByIDs(teacherIDList); Dictionary <string, TeacherRecord> ClubTeacherDic = new Dictionary <string, TeacherRecord>(); foreach (TeacherRecord each in TeacherList) { if (!ClubTeacherDic.ContainsKey(each.ID)) { ClubTeacherDic.Add(each.ID, each); } } #endregion #region 取得班級資料 //從學生Record內取得班級ID,再取得班級Record ClassDic = GetClassDic(); #endregion RowList.Clear(); _logDic = new Dictionary <string, Log_Result>(); //取得社團參與記錄 foreach (List <SCJoin> each in GetPoint._SCJoinDic.Values) { if (each.Count == 1) { #region 只有一筆資料 SCJoin sch = each[0]; SCJoinRow scjRow = new SCJoinRow(); scjRow.SCJ = sch; //學生 if (GetPoint._StudentDic.ContainsKey(sch.RefStudentID)) { scjRow.student = GetPoint._StudentDic[sch.RefStudentID]; //社團 if (GetPoint._ClubDic.ContainsKey(sch.RefClubID)) { scjRow.club = GetPoint._ClubDic[sch.RefClubID]; if (ClubTeacherDic.ContainsKey(GetPoint._ClubDic[sch.RefClubID].RefTeacherID)) { scjRow.teacher = ClubTeacherDic[GetPoint._ClubDic[sch.RefClubID].RefTeacherID]; } } if (GetPoint._RSRDic.ContainsKey(sch.UID)) { scjRow.RSR = GetPoint._RSRDic[sch.UID]; } RowList.Add(scjRow); } #endregion } else if (each.Count >= 1) { #region 兩筆資料 //錯誤訊息 StudentRecord sr = Student.SelectByID(each[0].RefStudentID); sb_3.AppendLine("學生[" + sr.Name + "]有2筆以上社團記錄"); SCJoin sch = each[0]; SCJoinRow scjRow = new SCJoinRow(); scjRow.SCJ = sch; //學生 if (GetPoint._StudentDic.ContainsKey(sch.RefStudentID)) { scjRow.student = GetPoint._StudentDic[sch.RefStudentID]; //社團 if (GetPoint._ClubDic.ContainsKey(sch.RefClubID)) { scjRow.club = GetPoint._ClubDic[sch.RefClubID]; if (ClubTeacherDic.ContainsKey(GetPoint._ClubDic[sch.RefClubID].RefTeacherID)) { scjRow.teacher = ClubTeacherDic[GetPoint._ClubDic[sch.RefClubID].RefTeacherID]; } } if (GetPoint._RSRDic.ContainsKey(sch.UID)) { scjRow.RSR = GetPoint._RSRDic[sch.UID]; } RowList.Add(scjRow); } #endregion } else { //沒有記錄繼續 } } if (!string.IsNullOrEmpty(sb_3.ToString())) { MsgBox.Show(sb_3.ToString()); } }
/// <summary> /// Sets the score. /// </summary> /// <param name="learnerScore">Learner score.</param> public static void SetScore(StudentRecord.LearnerScore learnerScore) { string identifier = "cmi.score.scaled"; string strValue = learnerScore.scaled.ToString(); SetValue (identifier, strValue); identifier = "cmi.score.raw"; strValue = learnerScore.raw.ToString(); SetValue (identifier, strValue); identifier = "cmi.score.max"; strValue = learnerScore.max.ToString(); SetValue (identifier, strValue); identifier = "cmi.score.min"; strValue = learnerScore.min.ToString(); SetValue (identifier, strValue); studentRecord.learnerScore = learnerScore; }
/// <summary> /// 主要是給匯出時用的 /// </summary> /// <param name="classRecord"></param> /// <param name="studentRecord"></param> /// <param name="fitnessRecord"></param> public void SetDataForExport(ClassRecord classRecord, StudentRecord studentRecord, DAO.StudentFitnessRecord fitnessRecord, bool isExportDegree) { // 測驗日期 SetColumnValue("測驗日期", Utility.ConvertDateTimeToChineseDateTime(fitnessRecord.TestDate)); // 學校類別 SetColumnValue("學校類別", fitnessRecord.SchoolCategory); if (classRecord != null) { // 年級 if (classRecord.GradeYear.HasValue) { SetColumnValue("年級", classRecord.GradeYear.Value.ToString()); } // 班級名稱 SetColumnValue("班級名稱", classRecord.Name); // 班級序號 for sort SetOthersValue("班級序號", classRecord.DisplayOrder); } // 學號/座號 SetColumnValue("學號/座號", studentRecord.StudentNumber); // 性別 SetColumnValue("性別", Utility.ConvertDBGenderToOutGender(studentRecord.Gender)); // 身分證字號 SetColumnValue("身分證字號", studentRecord.IDNumber); // 生日 SetColumnValue("生日", Utility.ConvertDateTimeToChineseDateTime(studentRecord.Birthday)); // 身高 SetColumnValue("身高", fitnessRecord.Height); // 體重 SetColumnValue("體重", fitnessRecord.Weight); // 坐姿體前彎 SetColumnValue("坐姿體前彎", fitnessRecord.SitAndReach); // 立定跳遠 SetColumnValue("立定跳遠", fitnessRecord.StandingLongJump); // 仰臥起坐 SetColumnValue("仰臥起坐", fitnessRecord.SitUp); // 心肺適能 SetColumnValue("心肺適能", fitnessRecord.Cardiorespiratory); // 姓名 for sort SetOthersValue("姓名", studentRecord.Name); if (isExportDegree == true) { // 身高常模 SetColumnValue("身高常模", fitnessRecord.HeightDegree); // 體重常模 SetColumnValue("體重常模", fitnessRecord.WeightDegree); // 坐姿體前彎常模 SetColumnValue("坐姿體前彎常模", fitnessRecord.SitAndReachDegree); // 立定跳遠常模 SetColumnValue("立定跳遠常模", fitnessRecord.StandingLongJumpDegree); // 仰臥起坐常模 SetColumnValue("仰臥起坐常模", fitnessRecord.SitUpDegree); // 心肺適能常模 SetColumnValue("心肺適能常模", fitnessRecord.CardiorespiratoryDegree); } }
/// <summary> /// Adds the comment from learner. /// </summary> /// <param name="comment">StudentRecord.CommentsFromLearner object.</param> /// <c> /// Usage:\n /// StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner ();\n /// comment.comment = "The comment";\n /// comment.location = "The location (bookmark) in the SCO";\n /// ScormManager.AddCommentFromLearner(comment); /// </c> public static void AddCommentFromLearner(StudentRecord.CommentsFromLearner comment) { System.Threading.Thread thread = new System.Threading.Thread (() => CallAddCommentFromLearner (comment)); thread.Start (); }
private void FillDataGridView() { #region 更新畫面資料 dataGridViewX1.Rows.Clear(); dataGridViewX1.SuspendLayout(); List<string> jone = new List<string>(); foreach (CheckBox each in groupPanel1.Controls) { if (each.Checked) { jone.Add(each.Text); } } List<string> StudentCount = new List<string>(); foreach (DisciplineRecord eachDis in DisciplineList) { StudentRecord SR = Student.SelectByID(eachDis.RefStudentID); //取得學生 string discipline = GetDisciplineString(eachDis); if (discipline == "") continue; if (eachDis.MeritFlag == "0") //是懲戒 { if (eachDis.Cleared == "是") //已消過就離開 { continue; } } if (CheckMerit(eachDis, jone)) //如果不是CheckBox所勾選內容 continue; if (!StudentCount.Contains(eachDis.RefStudentID)) { StudentCount.Add(eachDis.RefStudentID); //學生人數統計 } DataGridViewRow _row = new DataGridViewRow(); _row.CreateCells(dataGridViewX1); _row.Cells[0].Value = eachDis.ID; //獎懲編號 _row.Cells[1].Value = eachDis.RefStudentID; //系統編號 _row.Cells[2].Value = eachDis.OccurDate.ToShortDateString(); //獎懲日期 if (SR.Class != null) { _row.Cells[3].Value = SR.Class.Name; //班級 } _row.Cells[4].Value = SR.SeatNo; //座號 _row.Cells[5].Value = SR.StudentNumber; //學號 _row.Cells[6].Value = SR.Name; //姓名 _row.Cells[7].Value = SR.Gender; //性別 _row.Cells[8].Value = discipline; //獎懲次數 _row.Cells[9].Value = eachDis.Reason; //事由 _row.Cells[10].Value = eachDis.SchoolYear; //學年度 _row.Cells[11].Value = eachDis.Semester; //學期 if ( DicDisciplineRegistByTeacher.ContainsKey(eachDis.ID) ) { TeacherRecord tr = Teacher.SelectByID(DicDisciplineRegistByTeacher[eachDis.ID]); if ( tr != null ) _row.Cells[12].Value = tr.Name+(!string.IsNullOrWhiteSpace(tr.Nickname)?"("+tr.Nickname+")":"");//登錄人員 } if (eachDis.RegisterDate.HasValue) { _row.Cells[13].Value = eachDis.RegisterDate.Value.ToShortDateString(); //登錄日期 } _row.Cells[14].Value = eachDis.MeritFlag; //獎懲區分 dataGridViewX1.Rows.Add(_row); _row.Tag = eachDis; } txtHelpStudentCount.Text = "學生人數:" + StudentCount.Count; dataGridViewX1.ResumeLayout(); if (dataGridViewX1.Rows.Count > 0) dataGridViewX1.Rows[0].Selected = false; #endregion }
/// <summary> /// Sets the success status. /// </summary> /// <param name="value">StudentRecord.SuccessStatusType Value.</param> public static void SetSuccessStatus(StudentRecord.SuccessStatusType value) { string identifier = "cmi.success_status"; string strValue = CustomTypeToString(value); studentRecord.successStatus = value; SetValue (identifier, strValue); }