public static int JHClassRecordComparison(JHClassRecord x, JHClassRecord y) { //string xx = x.DisplayOrder.PadLeft(3, '0') + ":" + x.Name; //string yy = y.DisplayOrder.PadLeft(3, '0') + ":" + y.Name; //return xx.CompareTo(yy); //年級:班級排列序號:班級名稱 string xx = ""; string yy = ""; if (x.DisplayOrder == "" || x.DisplayOrder == null) { xx = x.GradeYear.ToString().PadLeft(3, '0') + ":" + x.DisplayOrder.PadLeft(3, 'Z') + ":" + x.Name; } else { xx = x.GradeYear.ToString().PadLeft(3, '0') + ":" + x.DisplayOrder.PadLeft(3, '0') + ":" + x.Name; } if (y.DisplayOrder == "" || y.DisplayOrder == null) { yy = y.GradeYear.ToString().PadLeft(3, '0') + ":" + y.DisplayOrder.PadLeft(3, 'Z') + ":" + y.Name; } else { yy = y.GradeYear.ToString().PadLeft(3, '0') + ":" + y.DisplayOrder.PadLeft(3, '0') + ":" + y.Name; } return(xx.CompareTo(yy)); }
private int SortStudentByClassSeatNo(JHStudentRecord x, JHStudentRecord y) { JHClassRecord c1 = x.Class; JHClassRecord c2 = y.Class; if (x.RefClassID == y.RefClassID) { int seatNo1 = x.SeatNo.HasValue ? x.SeatNo.Value : int.MinValue; int seatNo2 = y.SeatNo.HasValue ? y.SeatNo.Value : int.MinValue; if (seatNo1 == seatNo2) { return(x.StudentNumber.CompareTo(y.StudentNumber)); } else { return(seatNo1.CompareTo(seatNo2)); } } else { if (c1 == null) { return(-1); } else if (c2 == null) { return(1); } return(c1.Name.CompareTo(c2.Name)); } }
public static int JHClassRecordComparison(JHClassRecord x, JHClassRecord y) { string xx = x.DisplayOrder.PadLeft(3, '0') + ":" + x.Name; string yy = y.DisplayOrder.PadLeft(3, '0') + ":" + y.Name; return(xx.CompareTo(yy)); }
public ClassExamScoreData(JHClassRecord cla) { Class = cla; //Students = cla.Students; Students = new List <JHStudentRecord>(); _StudentScoreDict = new Dictionary <string, StudentScore>(); List <StudentScore> studentScores = new List <StudentScore>(); foreach (JHStudentRecord student in cla.Students) { if (student.Status == K12.Data.StudentRecord.StudentStatus.一般 || student.Status == K12.Data.StudentRecord.StudentStatus.輟學) { Students.Add(student); studentScores.Add(new StudentScore(student)); } } StudentScore.SetClassMapping(); studentScores.ReadCalculationRule(null); _StudentScoreDict = new Dictionary <string, StudentScore>(); foreach (var score in studentScores) { if (!_StudentScoreDict.ContainsKey(score.Id)) { _StudentScoreDict.Add(score.Id, score); } } Rows = new StudentRows(); ValidCourseIDs = new List <string>(); }
public AddTransStudCourse(JHSchool.Data.JHStudentRecord studentRec) { InitializeComponent(); classRecIdx = new Dictionary <string, JHClassRecord>(); foreach (JHClassRecord cr in JHSchool.Data.JHClass.SelectAll()) { if (cr != null) { cboSelectClass.Items.Add(cr.Name); if (!classRecIdx.ContainsKey(cr.Name)) { classRecIdx.Add(cr.Name, cr); } } } chkSaveYes.Checked = true; studRec = studentRec; if (studRec.Class != null) { lblStudMsg.Text = "班級:" + studRec.Class.Name + ", 座號:" + studRec.SeatNo + ", 姓名:" + studRec.Name + ", 學號:" + studRec.StudentNumber; cboSelectClass.Text = studRec.Class.Name; studClassRec = studRec.Class; } else { lblStudMsg.Text = "未設定班級"; } AddTransBackgroundManager.AddTransStudCourseObj = this; }
protected override void OnSaveButtonClick(EventArgs e) { if (cboProgramPlan.SelectedItem != null) { string id = string.Empty; if (cboProgramPlan.SelectedItem is JHProgramPlanRecord) { JHProgramPlanRecord record = cboProgramPlan.SelectedItem as JHProgramPlanRecord; id = record.ID; } if (id != _programPlanID) { JHClassRecord cla = JHClass.SelectByID(PrimaryKey); cla.RefProgramPlanID = id; JHClass.Update(cla); //ClassRecord classRecord = Class.Instance.Items[PrimaryKey]; //ClassRecordEditor editor = classRecord.GetEditor(); //editor.RefProgramPlanID = id; //editor.Save(); } } base.OnSaveButtonClick(e); }
public static List <string> GetGradeyearStudents(int gradeYear) { List <JHStudentRecord> allstudent = JHStudent.SelectAll(); List <string> gyStudent = new List <string>(); foreach (JHStudentRecord each in allstudent) { if (each.Status != StudentRecord.StudentStatus.一般) { continue; } JHClassRecord cr = each.Class; if (cr == null) { continue; } if (!cr.GradeYear.HasValue) { continue; } if (cr.GradeYear.Value != gradeYear) { continue; } gyStudent.Add(each.ID); } return(gyStudent); }
private int SortClassesByClassName(JHClassRecord x, JHClassRecord y) { string xx = x.DisplayOrder.PadLeft(3, '0') + ":" + x.Name; string yy = y.DisplayOrder.PadLeft(3, '0') + ":" + y.Name; return(xx.CompareTo(yy)); }
public int SortStudents(JHStudentRecord x, JHStudentRecord y) { JHClassRecord c1 = x.Class; JHClassRecord c2 = y.Class; if (c1 != null && c2 != null && c1 == c2) { int seatNo1 = int.MinValue, seatNo2 = int.MinValue; int.TryParse("" + x.SeatNo, out seatNo1); int.TryParse("" + y.SeatNo, out seatNo2); if (seatNo1 == seatNo2) { return(x.StudentNumber.CompareTo(y.StudentNumber)); } else { return(seatNo1.CompareTo(seatNo2)); } } else { if (c1 == null) { return(int.MinValue); } else if (c2 == null) { return(int.MaxValue); } return(c1.CompareTo(c2)); } }
public List <StudentScore> Read() { #region 讀取成績計算規則。 IStatusReporter Rep = Reporter; Rep.Feedback("讀取成績計算規則...", 0); UniqueSet <string> ruleids = new UniqueSet <string>(); foreach (StudentScore each in Students) { if (!string.IsNullOrEmpty(each.RefCalculationRuleID)) { if (!ruleids.Contains(each.RefCalculationRuleID)) { ruleids.Add(each.RefCalculationRuleID); } } JHClassRecord cr = each.Class; if (cr != null) { if (string.IsNullOrEmpty(cr.RefScoreCalcRuleID)) { continue; } if (!ruleids.Contains(cr.RefScoreCalcRuleID)) { ruleids.Add(cr.RefScoreCalcRuleID); } } } FunctionSpliter <string, JHScoreCalcRuleRecord> spliter = new FunctionSpliter <string, JHScoreCalcRuleRecord>(10, Util.MaxThread); spliter.Function = delegate(List <string> idsPart) { return(JHScoreCalcRule.SelectByIDs(idsPart)); }; spliter.ProgressChange = delegate(int progress) { Rep.Feedback("讀取成績計算規則...", Util.CalculatePercentage(ruleids.Count, progress)); }; StudentScore.SetRuleMapping(spliter.Execute(ruleids.ToList())); List <StudentScore> noRule = new List <StudentScore>(); foreach (StudentScore each in Students) { if (each.CalculationRule == null) { noRule.Add(each); } } return(noRule); #endregion }
/// <summary> /// 取得班級課程規劃表 /// </summary> /// <param name="classRecord"></param> /// <returns></returns> private JHProgramPlanRecord GetProgramPlan(JHClassRecord classRecord) { if (string.IsNullOrEmpty(classRecord.RefProgramPlanID)) { return(null); } else { return(JHProgramPlan.SelectByID(classRecord.RefProgramPlanID)); } }
private void button1_Click(object sender, EventArgs e) { StudentScore.SetClassMapping(); JHClassRecord cls = JHClass.SelectByID("24");//正興 301 班。 txtMsg.Text = string.Empty; txtMsg.AppendText("計算班級:" + cls.Name + "\n"); ThreadPool.QueueUserWorkItem(new WaitCallback(ReadAttendScore), cls); }
private void cboSelectClass_SelectedIndexChanged(object sender, EventArgs e) { lstView.Items.Clear(); if (!string.IsNullOrEmpty(cboSelectClass.Text)) { // 更新所選班級時更換相對班級,給載入班課程使用 if (classRecIdx.ContainsKey(cboSelectClass.Text)) { studClassRec = classRecIdx[cboSelectClass.Text]; } getCourseToForm(); } }
public JHProgramPlanRecord GetProgramPlanRecord(JHClassRecord cla) { if (cla == null) { return(null); } if (!string.IsNullOrEmpty(cla.RefProgramPlanID) && ContainsKey(cla.RefProgramPlanID)) { return(this[cla.RefProgramPlanID]); } else { return(null); } }
private void ReadAttendScore(object state) { JHClassRecord cls = state as JHClassRecord; List <string> ids = new List <string>(); foreach (JHStudentRecord each in cls.Students) { ids.Add(each.ID); } students = ids.ToStudentScore(); List <StudentScore> noValid; //string[] subjects = new string[] { "數學" }; //helper.ReadAttendScore(students, 98, 1, new string[] { }, this); //List<StudentScore> noCourses = helper.CalcuateAttendScore(students, this); //回傳沒有修課的學生。 //helper.SaveAttendScore(students, new string[] { }, this); //helper.ReadSemesterScore(students, 98, 1, this); List <StudentScore> noRule = students.ReadCalculationRule(this); //沒有計算規則的學生。 //helper.ReadSemesterScore(students, this); //if (noRule.Count > 0) //{ // Feedback("有部份學生沒有設定成績計算規則。", 0); // return; //} //helper.CalcuateSubjectSemesterScore(students, new string[] { }); //helper.CalcuateDomainSemesterScore(students, new string[] { }); //helper.SaveSemesterScore(students, this); students.ReadSemesterScore(this); //讀取所有學期的成績。 students.ReadSemesterHistory(this); //讀取學期歷程。 noValid = students.VaidSixSemesterHistory(); //驗證學期歷程是否完整。 noValid = students.ValidSixSemesterDomainScore(); //驗證學期成績是否完整。 students.ReadGraduateScore(this); //讀取畢業成績。 students.CalculateGraduateScore(); //計算畢業成績。 students.SaveGraduateScore(this); //儲存畢業成績。 Feedback("成績計算完成。", 0); }
private JHProgramPlanRecord GetProgramPlan(JHClassRecord classRec) { if (classRec != null && !string.IsNullOrEmpty(classRec.RefProgramPlanID)) { if (programPlanCache.ContainsKey(classRec.RefProgramPlanID)) { return(programPlanCache[classRec.RefProgramPlanID]); } else { return(null); } } else { return(null); } }
/// <summary> /// Comparision /// 依班級、座號、學號排序修課學生。 /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> private int SCAttendComparer(JHSCAttendRecord a, JHSCAttendRecord b) { JHStudentRecord aStudent = a.Student; JHClassRecord aClass = a.Student.Class; JHStudentRecord bStudent = b.Student; JHClassRecord bClass = b.Student.Class; string aa = aClass == null ? (string.Empty).PadLeft(10, '0') : (aClass.Name).PadLeft(10, '0'); aa += aStudent == null ? (string.Empty).PadLeft(3, '0') : (aStudent.SeatNo + "").PadLeft(3, '0'); aa += aStudent == null ? (string.Empty).PadLeft(10, '0') : (aStudent.StudentNumber).PadLeft(10, '0'); string bb = bClass == null ? (string.Empty).PadLeft(10, '0') : (bClass.Name).PadLeft(10, '0'); bb += bStudent == null ? (string.Empty).PadLeft(3, '0') : (bStudent.SeatNo + "").PadLeft(3, '0'); bb += bStudent == null ? (string.Empty).PadLeft(10, '0') : (bStudent.StudentNumber).PadLeft(10, '0'); return(aa.CompareTo(bb)); }
protected override void OnPrimaryKeyChanged(EventArgs e) { SaveButtonVisible = CancelButtonVisible = false; JHClassRecord classRecord = JHClass.SelectByID(PrimaryKey); if (classRecord != null) { JHProgramPlanRecord programPlanRecord = GetProgramPlan(classRecord); if (programPlanRecord != null) { _programPlanID = programPlanRecord.ID; SetComboBoxSelection(programPlanRecord); } else { _programPlanID = string.Empty; SetComboBoxSelection(null); } } base.OnPrimaryKeyChanged(e); }
void _BGWorker_DoWork(object sender, DoWorkEventArgs e) { _ClassRecord = JHClass.SelectByID(PrimaryKey); _AllClassRecList = JHClass.SelectAll(); // 教師名稱索引 _TeacherNameDic.Clear(); foreach (JHTeacherRecord TRec in JHTeacher.SelectAll()) { if (TRec.Status == K12.Data.TeacherRecord.TeacherStatus.刪除) { continue; } if (string.IsNullOrEmpty(TRec.Nickname)) { _TeacherNameDic.Add(TRec.ID, TRec.Name); } else { _TeacherNameDic.Add(TRec.ID, TRec.Name + "(" + TRec.Nickname + ")"); } } }
private void btnNext_Click(object sender, EventArgs e) { if (!IsValid()) { return; } // 取得畫面賞用者所選的課程ID Global._selectCourseIDList.Clear(); foreach (ListViewItem lv in lvSubject.CheckedItems) { foreach (KeyValuePair <string, string> str in Global._CourseIDSubjectDict) { if (str.Value == lv.Text) { Global._selectCourseIDList.Add(str.Key); } } } // 儲存試別 //Campus.Configuration.ConfigData cd = Campus.Configuration.Config.App["高雄個人評量成績單試別"]; //cd["高雄個人評量成績單試別"] = cbExam.Text; //cd.Save(); K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["高雄個人評量成績單試別"]; cd["高雄個人評量成績單試別"] = cbExam.Text; cd.Save(); ReportConfiguration rc = new ReportConfiguration(Global.ReportName); rc.SetString("缺曠獎懲統計開始日期", txtSDate.Text); rc.SetString("缺曠獎懲統計結束日期", txtEDate.Text); rc.SetString("成績校正日期", txtCorrect.Text); rc.Save(); JHExamRecord exam = cbExam.SelectedItem as JHExamRecord; DateTime from = DateTime.Parse(txtSDate.Text); DateTime to = DateTime.Parse(txtEDate.Text); List <JHStudentRecord> students = GetStudents(); students.Sort(delegate(JHStudentRecord x, JHStudentRecord y) { JHClassRecord c1 = x.Class; JHClassRecord c2 = y.Class; if (x.Class == null) { return(-1); } if (y.Class == null) { return(1); } if (c1.ID == c2.ID) { int seatNo1 = x.SeatNo.HasValue ? x.SeatNo.Value : int.MinValue; int seatNo2 = y.SeatNo.HasValue ? y.SeatNo.Value : int.MinValue; if (seatNo1 == seatNo2) { return(x.StudentNumber.CompareTo(y.StudentNumber)); } else { return(seatNo1.CompareTo(seatNo2)); } } else { return(c1.Name.CompareTo(c2.Name)); } }); _config.SetExam(exam); _config.SetDateRange(from, to); _config.SetStudents(students); _config.SchoolYear = iptSchoolYear.Value; _config.Semester = iptSemester.Value; _config.Load(); Report report = new Report(_config); report.Generate(); this.DialogResult = DialogResult.OK; }