public CourseListViewItem(JHSchool.CourseRecord course, KH.JHAEIncludeRecord aei, List <KH.JHSCETakeRecord> sceList) { _is_finish = true; TeacherRecord teacher = course.GetFirstTeacher(); //_total = course.GetAttends().Count; _total = SCAttend.GetCourseStudentCount(course.ID); Calculate(sceList); if (aei.UseScore) { _is_finish &= (_scoreCount == _total); } if (aei.UseEffort) { _is_finish &= (_effortCount == _total); } if (aei.UseText) { _is_finish &= (_textCount == _total); } this.Text = course.Name; this.SubItems.Add((teacher != null) ? teacher.Name : ""); this.SubItems.Add(aei.UseScore ? ScoreField : "").ForeColor = (_scoreCount == _total) ? Color.Black : Color.Red; this.SubItems.Add(aei.UseEffort ? EffortField : "").ForeColor = (_effortCount == _total) ? Color.Black : Color.Red; this.SubItems.Add(aei.UseText ? TextField : "").ForeColor = (_textCount == _total) ? Color.Black : Color.Red; }
private void ApplicationReviewForm_Load(object sender, EventArgs e) { listApplication = this._access.Select <UDT.MeetingRoomApplication>(string.Format("uid = {0}", _applicationID)); listApplicationDetail = this._access.Select <UDT.MeetingRoomApplicationDetail>(string.Format("ref_application_id = {0}", _applicationID)); listRoom = this._access.Select <UDT.MeetingRoom>(string.Format("uid = {0}", listApplication[0].RefMeetingRoomID)); teacherR = Teacher.SelectByID("" + actor.getTeacherID()); #region Init lbReviewDate.Text = DateTime.Now.ToString("yyyy/MM/dd"); tbxApplicant.Text = listApplication[0].ApplicantName; tbxHost.Text = listApplication[0].TeacherName; tbxRoomName.Text = listRoom[0].Name; tbxStartDate.Text = listApplication[0].ApplyStarDate.ToShortDateString(); tbxEndDate.Text = listApplication[0].RepeatEndDate.ToShortDateString(); tbxApplyReason.Text = listApplication[0].ApplyReason; tbxIsRepeat.Text = listApplication[0].IsRepeat ? "是" : "否"; tbxRepeatType.Text = ("" + listApplication[0].RepeatType) == "null" ? "" : "" + listApplication[0].RepeatType; foreach (UDT.MeetingRoomApplicationDetail ad in listApplicationDetail) { DataGridViewRow datarow = new DataGridViewRow(); datarow.CreateCells(dataGridViewX1); int index = 0; datarow.Cells[index++].Value = ad.StarTime.ToShortDateString(); datarow.Cells[index++].Value = ad.StarTime.ToShortTimeString(); datarow.Cells[index++].Value = ad.EndTime.ToShortTimeString(); dataGridViewX1.Rows.Add(datarow); } #endregion }
private static TCInstructRecordEditor SetTeacher(CourseRecord course, TeacherRecord teacher, string sequence) { TCInstructRecord tcrecord; if (sequence == "1") { tcrecord = course.GetFirstInstruct(); } else if (sequence == "2") { tcrecord = course.GetSecondInstruct(); } else { tcrecord = course.GetThirdInstruct(); } if (tcrecord != null && teacher != null) { return(new TCInstructRecordEditor(tcrecord, teacher)); //改變教師 } else if (tcrecord != null && teacher == null) { return(new TCInstructRecordEditor(tcrecord)); //刪除記錄。 } else if (tcrecord == null && teacher == null) { return(new TCInstructRecordEditor()); //什麼都不作。 } else { return(new TCInstructRecordEditor(course, teacher, sequence)); //新增記錄。 } }
private StringBuilder GetLogs() { TeacherRecord tr = Teacher.SelectByID(Actor.Instance.GetTeacherID()); StringBuilder logs = new StringBuilder(); logs.AppendLine(string.Format(@" {0}「{1}」確認: 申請人「{2}」申請設備「{3}」出借。 設備基本資料: 設備名稱「{3}」 設備類別「{4}」 廠牌「{5}」 型號「{6}」 放置位置「{7}」 申請資料: 申請人「{2}」 申請時間「{8}」 預約使用時間「{9}」~「{10}」 申請事由「{11}」 借出時間「{12}」 ", this._identity, tr.Name, tbxApplicant.Text, tbxEquipName.Text, tbxCategory.Text, tbxCompany.Text, tbxModel.Text, tbxPlace.Text, tbxApplyTime.Text, tbxStarTime.Text, tbxEndTime.Text, tbxReason.Text, lbTimeNow.Text)); return(logs); }
public static TeacherTagRecordEditor AddTag(this TeacherRecord teacher, TagRecord record) { if (record.Category.ToUpper() != TagCategory.Teacher.ToString().ToUpper()) { throw new ArgumentException(""); } return(new TeacherTagRecordEditor(teacher, record)); }
/// <summary> /// 取得教師授課課程 /// </summary> /// <param name="schoolyear">學年度</param> /// <param name="semester">學期</param> /// <param name="teacher">教師</param> public List <CourseRecord> GetTeacherCourse(int schoolyear, int semester, TeacherRecord teacher) { if (_Provider == null) { throw new Exception("Provider尚未設定"); } return(_Provider.GetTeacherCourse(schoolyear, semester, teacher)); }
/// <summary> /// 建立變更教師的 Editor。 /// </summary> internal TCInstructRecordEditor(TCInstructRecord info, TeacherRecord teacher) { NoChange = false; TCInstructRecord = info; ID = info.ID; RefCourseID = info.RefCourseID; RefTeacherID = teacher.ID; //使用指定的教師。 Sequence = info.Sequence; }
/// <summary> /// 建立新增授課教師的 Editor。 /// </summary> internal TCInstructRecordEditor(CourseRecord course, TeacherRecord teacher, string sequence) { NoChange = false; TCInstructRecord = null; ID = string.Empty; RefTeacherID = teacher.ID; RefCourseID = course.ID; Sequence = sequence; }
private void MenuButton_Click(object sender, EventArgs e) { TeacherRecord teacher = (sender as MenuButton).Tag as TeacherRecord; //List<string> courseIDs = new List<string>(K12.Presentation.NLDPanels.Course.SelectedSource); //List<JHTCInstructRecord> insertList = new List<JHTCInstructRecord>(); //List<JHTCInstructRecord> updateList = new List<JHTCInstructRecord>(); //foreach (JHTCInstructRecord tc in JHTCInstruct.SelectByTeacherIDAndCourseID(new string[] { }, K12.Presentation.NLDPanels.Course.SelectedSource)) //{ // if (tc.Sequence == 1) //評分教師 // { // courseIDs.Remove(tc.RefCourseID); // tc.RefTeacherID = teacher.ID; // updateList.Add(tc); // } //} //foreach (string courseID in courseIDs) //{ // JHTCInstructRecord newTCInstruct = new JHTCInstructRecord(); // newTCInstruct.RefCourseID = courseID; // newTCInstruct.RefTeacherID = teacher.ID; // newTCInstruct.Sequence = 1; // insertList.Add(newTCInstruct); //} //if (insertList.Count > 0) // JHTCInstruct.Insert(insertList); //if (updateList.Count > 0) // JHTCInstruct.Update(updateList); //MsgBox.Show("指定評分教師完成"); List <TCInstructRecordEditor> editors = new List <TCInstructRecordEditor>(); foreach (var item in Course.Instance.SelectedList) { editors.Add(item.SetFirstTeacher(teacher)); } if (editors.Count > 0) { MultiThreadBackgroundWorker <TCInstructRecordEditor> worker = new MultiThreadBackgroundWorker <TCInstructRecordEditor>(); worker.PackageSize = 50; worker.Loading = MultiThreadLoading.Light; worker.DoWork += delegate(object worker_sender, PackageDoWorkEventArgs <TCInstructRecordEditor> worker_e) { worker_e.Items.SaveAllEditors(); }; worker.RunWorkerCompleted += delegate { MsgBox.Show("指定評分教師完成"); }; worker.RunWorkerAsync(editors); } }
public MainForm() { InitializeComponent(); _targetSCADic = new Dictionary <string, SCAttendRecord>(); _studentDic = new Dictionary <string, StudentRecord>(); //來源課程 string course_id = K12.Presentation.NLDPanels.Course.SelectedSource[0]; _sourceCourse = K12.Data.Course.SelectByID(course_id); //來源課程教師 string teacher_id = _sourceCourse.MajorTeacherID; _teacher = K12.Data.Teacher.SelectByID(teacher_id); if (_teacher != null) { //取得該教師其他授課課程 List <K12.Data.TCInstructRecord> tcs = K12.Data.TCInstruct.SelectByTeacherIDAndCourseID(new string[] { teacher_id }, new string[] { }); List <string> courses = new List <string>(); foreach (K12.Data.TCInstructRecord tr in tcs) { if (tr.Sequence == 1 && tr.RefCourseID != _sourceCourse.ID) { courses.Add(tr.RefCourseID); } } _courses = K12.Data.Course.SelectByIDs(courses); lblTitle.Text = string.Format("{0} ({1})", _sourceCourse.Name, _teacher.Name); //呈現該教師其他授課課程 foreach (CourseRecord cr in _courses) { ButtonItem item = new ButtonItem(); item.OptionGroup = "course"; item.Text = cr.Name; item.Tag = cr; item.Click += new EventHandler(item_click); itemPanle1.Items.Add(item); } //取得來源修課紀錄 _sourceSCAs = K12.Data.SCAttend.SelectByCourseIDs(new string[] { _sourceCourse.ID }); //學生對照 List <string> stu_ids = _sourceSCAs.Select(x => x.RefStudentID).ToList(); foreach (StudentRecord stu in K12.Data.Student.SelectByIDs(stu_ids)) { _studentDic.Add(stu.ID, stu); } } }
private void BGW_DoWork(object sender, DoWorkEventArgs e) { if (this.PrimaryKey != "") { teacher = K12.Data.Teacher.SelectByID(this.PrimaryKey); _records.Clear(); _records = tool._A.Select <BodyTmperature>(string.Format("body_tag='Teacher' and ref_obj_id='{0}'", this.PrimaryKey)); } }
/// <summary> /// 取得教師上的所有課程資料。 /// </summary> public static List <CourseRecord> GetInstructCoruses(this TeacherRecord teacher) { List <CourseRecord> courses = new List <CourseRecord>(); foreach (TCInstructRecord each in GetInstructs(teacher)) { courses.Add(each.Course); } return(courses); }
public frmAssignedSurvy_SingleForm(UDT.AssignedSurvey AssignedSurvey, CourseRecord Course, TeacherRecord Teacher, string CaseName) { InitializeComponent(); this.AssignedSurvey = AssignedSurvey; this.Course = Course; this.Teacher = Teacher; this.CaseName = CaseName; Access = new AccessHelper(); this.ErrorProvider = new ErrorProvider(); this.Load += new EventHandler(frmAssignedSurvy_SingleForm_Load); }
/// <summary> /// 傳入老師Record,回傳包含老師暱稱的名字 /// </summary> public string GetTeacherName(TeacherRecord tr) { if (string.IsNullOrEmpty(tr.Nickname)) { return(tr.Name); } else { return(tr.Name + "(" + tr.Nickname + ")"); } }
/// <summary> /// Constructor /// 傳入一個課程。 /// </summary> /// <param name="course"></param> public CourseScoreInputForm(CourseRecord course) { InitializeComponent(); prlp = new PermRecLogProcess(); _course = course; #region 設定小標題 TeacherRecord first = course.GetFirstTeacher(); TeacherRecord second = course.GetSecondTeacher(); TeacherRecord third = course.GetThirdTeacher(); StringBuilder builder = new StringBuilder(""); if (first != null) { builder.Append(first.Name + ","); } if (second != null) { builder.Append(second.Name + ","); } if (third != null) { builder.Append(third.Name + ","); } string teachers = builder.ToString(); if (!string.IsNullOrEmpty(teachers)) { teachers = teachers.Substring(0, teachers.Length - 1); } lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : ""); #endregion #region 取得文字評量代碼表 K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["文字描述代碼表"]; if (!string.IsNullOrEmpty(cd["xml"])) { K12.Data.XmlHelper helper = new K12.Data.XmlHelper(K12.Data.XmlHelper.LoadXml(cd["xml"])); foreach (XmlElement item in helper.GetElements("Item")) { string code = item.GetAttribute("Code"); string content = item.GetAttribute("Content"); if (!_textMapping.ContainsKey(code)) { _textMapping.Add(code, content); } } } #endregion }
/// <summary> /// 取得老師名稱 /// </summary> private string GetTeacherName(CLUBRecord cr) { string name = ""; //老師1 if (!string.IsNullOrEmpty(cr.RefTeacherID)) { TeacherRecord tr = GetPoint.TeacherDic[cr.RefTeacherID]; if (string.IsNullOrEmpty(tr.Nickname)) { name += tr.Name; } else { name += tr.Name + "(" + tr.Nickname + ")"; } } //老師2 if (!string.IsNullOrEmpty(cr.RefTeacherID2)) { TeacherRecord tr = GetPoint.TeacherDic[cr.RefTeacherID2]; if (string.IsNullOrEmpty(tr.Nickname)) { name += "/" + tr.Name; } else { name += "/" + tr.Name + "(" + tr.Nickname + ")"; } } //老師3 if (!string.IsNullOrEmpty(cr.RefTeacherID3)) { TeacherRecord tr = GetPoint.TeacherDic[cr.RefTeacherID3]; if (string.IsNullOrEmpty(tr.Nickname)) { name += "/" + tr.Name; } else { name += "/" + tr.Name + "(" + tr.Nickname + ")"; } } return(name); }
/// <summary> /// Constructor /// 傳入一個課程。 /// </summary> /// <param name="course"></param> public CourseScoreInputForm(CourseRecord course) { InitializeComponent(); _course = course; _SceTakeDic = new Dictionary <string, SCETakeRecord>(); _ScAttendDic = new Dictionary <string, JHSCAttendRecord>(); _dirtyCellList = new List <DataGridViewCell>(); _studentRow = new Dictionary <string, DataGridViewRow>(); _BW = new BackgroundWorker(); _BW.DoWork += new DoWorkEventHandler(_BW_DoWork); _BW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BW_Completed); _A = new AccessHelper(); _Q = new QueryHelper(); #region 設定小標題 TeacherRecord first = course.GetFirstTeacher(); TeacherRecord second = course.GetSecondTeacher(); TeacherRecord third = course.GetThirdTeacher(); StringBuilder builder = new StringBuilder(""); if (first != null) { builder.Append(first.Name + ","); } if (second != null) { builder.Append(second.Name + ","); } if (third != null) { builder.Append(third.Name + ","); } string teachers = builder.ToString(); if (!string.IsNullOrEmpty(teachers)) { teachers = teachers.Substring(0, teachers.Length - 1); } lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : ""); #endregion }
private string GetTeacherName(string p) { string name = ""; if (!string.IsNullOrEmpty(p)) { if (SDL.TeacherDic.ContainsKey(p)) { TeacherRecord tr = SDL.TeacherDic[p]; if (!string.IsNullOrEmpty(tr.Nickname)) { name = tr.Name + "(" + tr.Nickname + ")"; } else { name = tr.Name; } } } return(name); }
void bgw_DoWork(object sender, DoWorkEventArgs e) { ReplyList = _A.Select <Reply>(String.Format("ref_student_id={0}", K12.Presentation.NLDPanels.Student.SelectedSource[0])); foreach (Reply each in ReplyList) { if (each.Status == 0) { each.s_Status = "暫存"; } else if (each.Status == 1) { each.s_Status = "送出"; } DataTable dt = _Q.Select(string.Format("SELECT * FROM $ischool.emba.teaching_evaluation.survey where uid={0}", each.SurveyID)); foreach (DataRow dRow in dt.Rows) { string category = "" + dRow["Category"]; each.s_Category = category; } CourseRecord course = K12.Data.Course.SelectByID(each.CourseID.ToString()); each.s_SchoolYear = course.SchoolYear.HasValue ? course.SchoolYear.ToString() : ""; each.s_Course = course.Name; if (course.Semester == 0) { each.s_Semester = "夏季學期"; } else { each.s_Semester = "第" + course.Semester + "學期"; } TeacherRecord teacher = K12.Data.Teacher.SelectByID(each.TeacherID.ToString()); each.s_Teacher = teacher.Name; } }
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 ApplicationCancelForm_Load(object sender, EventArgs e) { // 取得資料 this._listApplication = this._access.Select <UDT.MeetingRoomApplication>(string.Format("uid = {0}", this._applicationID)); this._listApplicationDetail = this._access.Select <UDT.MeetingRoomApplicationDetail>(string.Format("ref_application_id = {0}", this._applicationID)); this._listRoom = this._access.Select <UDT.MeetingRoom>(string.Format("uid = {0}", _listApplication[0].RefMeetingRoomID)); this._teacherR = Teacher.SelectByID("" + actor.getTeacherID()); #region Init cancelDateLb.Text = DateTime.Now.ToShortDateString(); tbxApplicant.Text = _listApplication[0].ApplicantName; tbxHost.Text = _listApplication[0].TeacherName; tbxRoomName.Text = _listRoom[0].Name; tbxStartDate.Text = _listApplication[0].ApplyStarDate.ToShortDateString(); tbxEndDate.Text = _listApplication[0].RepeatEndDate.ToShortDateString(); tbxApplyReason.Text = _listApplication[0].ApplyReason; bool type = false; tbxRepeat.Text = bool.TryParse(("" + _listApplication[0].IsRepeat), out type) ? "是" : "否"; tbxRepeatType.Text = ("" + _listApplication[0].RepeatType) == "null" ? "" : "" + _listApplication[0].RepeatType; foreach (UDT.MeetingRoomApplicationDetail ad in _listApplicationDetail) { DataGridViewRow datarow = new DataGridViewRow(); datarow.CreateCells(dataGridViewX1); int index = 0; datarow.Cells[index++].Value = ad.StarTime.ToShortDateString(); datarow.Cells[index++].Value = ad.StarTime.ToShortTimeString(); datarow.Cells[index++].Value = ad.EndTime.ToShortTimeString(); dataGridViewX1.Rows.Add(datarow); } #endregion }
/// <summary> /// 填寫DataTable的資料 /// </summary> /// <param name="dt"></param> private static void FillData(DataTable dt) { string printDateTime = SelectTime(); string schoolName = K12.Data.School.ChineseName; string 校長 = K12.Data.School.Configuration["學校資訊"].PreviousData.SelectSingleNode("ChancellorChineseName").InnerText; string 教務主任 = K12.Data.School.Configuration["學校資訊"].PreviousData.SelectSingleNode("EduDirectorName").InnerText; //假別設定 Dictionary <string, List <string> > allowAbsentDic = new Dictionary <string, List <string> >(); foreach (AbsentSetting abs in _A.Select <AbsentSetting>()) { string target = abs.Target; string source = abs.Source; if (!allowAbsentDic.ContainsKey(target)) { allowAbsentDic.Add(target, new List <string>()); } allowAbsentDic[target].Add(source); } List <string> classIDs = _students.Select(x => x.RefClassID).Distinct().ToList(); List <string> studentIDs = _students.Select(x => x.ID).ToList(); //學生ID字串 string id_str = string.Join("','", studentIDs); id_str = "'" + id_str + "'"; //班級 catch Dictionary <string, ClassRecord> classDic = new Dictionary <string, ClassRecord>(); foreach (ClassRecord cr in K12.Data.Class.SelectByIDs(classIDs)) { if (!classDic.ContainsKey(cr.ID)) { classDic.Add(cr.ID, cr); } } //基本資料 foreach (StudentRecord student in _students) { DataRow row = dt.NewRow(); ClassRecord myClass = classDic.ContainsKey(student.RefClassID) ? classDic[student.RefClassID] : new ClassRecord(); TeacherRecord myTeacher = myClass.Teacher != null ? myClass.Teacher : new TeacherRecord(); row["列印日期"] = printDateTime; row["學校名稱"] = schoolName; row["學年度"] = _schoolYear; row["學期"] = _semester; row["姓名"] = student.Name; row["班級"] = myClass.Name + ""; row["班導師"] = myTeacher.Name + ""; row["座號"] = student.SeatNo + ""; row["學號"] = student.StudentNumber; row["校長"] = 校長; row["教務主任"] = 教務主任; //filedName是 "列印假別1~20" foreach (string filedName in allowAbsentDic.Keys) { row[filedName] = 0; } dt.Rows.Add(row); _RowCatchs.Add(student.ID, row); } //上課天數 foreach (SemesterHistoryRecord shr in K12.Data.SemesterHistory.SelectByStudents(_students)) { DataRow row = _RowCatchs[shr.RefStudentID]; foreach (SemesterHistoryItem shi in shr.SemesterHistoryItems) { if (shi.SchoolYear == _schoolYear && shi.Semester == _semester) { row["上課天數"] = shi.SchoolDayCount + ""; } } } //學期科目及領域成績 foreach (JHSemesterScoreRecord jsr in JHSchool.Data.JHSemesterScore.SelectBySchoolYearAndSemester(studentIDs, _schoolYear, _semester)) { DataRow row = _RowCatchs[jsr.RefStudentID]; _文字描述.Clear(); //學習領域成績 if (_UserSelScoreType == "原始成績") { row["學習領域成績"] = jsr.LearnDomainScoreOrigin.HasValue ? jsr.LearnDomainScoreOrigin.Value + "" : string.Empty; row["課程學習成績"] = jsr.CourseLearnScoreOrigin.HasValue ? jsr.CourseLearnScoreOrigin.Value + "" : string.Empty; } else { row["學習領域成績"] = jsr.LearnDomainScore.HasValue ? jsr.LearnDomainScore.Value + "" : string.Empty; row["課程學習成績"] = jsr.CourseLearnScore.HasValue ? jsr.CourseLearnScore.Value + "" : string.Empty; } row["學習領域原始成績"] = jsr.LearnDomainScoreOrigin.HasValue ? jsr.LearnDomainScoreOrigin.Value + "" : string.Empty; row["課程學習原始成績"] = jsr.CourseLearnScoreOrigin.HasValue ? jsr.CourseLearnScoreOrigin.Value + "" : string.Empty; // 收集領域科目成績給領域科目對照時使用 Dictionary <string, DomainScore> DomainScoreDict = new Dictionary <string, DomainScore>(); Dictionary <string, List <SubjectScore> > DomainSubjScoreDict = new Dictionary <string, List <SubjectScore> >(); #region 科目成績照領域排序 var jsSubjects = new List <SubjectScore>(jsr.Subjects.Values); var domainList = new Dictionary <string, int>(); domainList.Add("語文", 9000); domainList.Add("國語文", 8000); domainList.Add("英語", 7000); domainList.Add("數學", 6000); domainList.Add("社會", 5000); domainList.Add("自然科學", 4500); domainList.Add("自然與生活科技", 4000); domainList.Add("藝術", 3500); domainList.Add("藝術與人文", 3000); domainList.Add("健康與體育", 2000); domainList.Add("綜合活動", 1000); domainList.Add("彈性課程", 0900); jsSubjects.Sort(delegate(SubjectScore r1, SubjectScore r2) { decimal rank1 = 0; decimal rank2 = 0; if (r1.Credit != null) { rank1 += r1.Credit.Value; } if (r2.Credit != null) { rank2 += r2.Credit.Value; } if (domainList.ContainsKey(r1.Domain)) { rank1 += domainList[r1.Domain]; } if (domainList.ContainsKey(r2.Domain)) { rank2 += domainList[r2.Domain]; } if (rank1 == rank2) { return(r2.Subject.CompareTo(r1.Subject)); } else { return(rank2.CompareTo(rank1)); } }); #endregion //科目成績 int count = 0; foreach (SubjectScore subj in jsSubjects) { string ssNmae = subj.Domain; if (string.IsNullOrEmpty(ssNmae)) { ssNmae = "彈性課程"; } if (!DomainSubjScoreDict.ContainsKey(ssNmae)) { DomainSubjScoreDict.Add(ssNmae, new List <SubjectScore>()); } DomainSubjScoreDict[ssNmae].Add(subj); count++; //超過就讓它爆炸 if (count > Global.SupportSubjectCount) { throw new Exception("超過支援列印科目數量: " + Global.SupportSubjectCount); } row["S科目" + count] = subj.Subject; row["S領域" + count] = string.IsNullOrWhiteSpace(subj.Domain) ? "彈性課程" : subj.Domain; row["S節數" + count] = subj.Period + ""; row["S權數" + count] = subj.Credit + ""; row["S成績" + count] = GetScoreString(subj.Score, subj.ScoreOrigin, subj.ScoreMakeup); row["S等第" + count] = GetScoreDegreeString(subj.Score, subj.ScoreOrigin);//subj.Score.HasValue ? _degreeMapper.GetDegreeByScore(subj.Score.Value) : string.Empty; row["S原始成績" + count] = subj.ScoreOrigin.HasValue ? subj.ScoreOrigin.Value + "" : string.Empty; row["S補考成績" + count] = subj.ScoreMakeup.HasValue ? subj.ScoreMakeup.Value + "" : string.Empty; } // 處理領域科目並列 foreach (string dName in Global.PriDomainNameList()) { if (DomainSubjScoreDict.ContainsKey(dName)) { int si = 1; foreach (SubjectScore ss in DomainSubjScoreDict[dName]) { row[dName + "科目" + si] = ss.Subject; row[dName + "領域" + si] = ss.Domain; row[dName + "節數" + si] = ss.Period + ""; row[dName + "權數" + si] = ss.Credit + ""; row[dName + "等第" + si] = GetScoreDegreeString(ss.Score, ss.ScoreOrigin);//ss.Score.HasValue ? _degreeMapper.GetDegreeByScore(ss.Score.Value) : string.Empty; row[dName + "成績" + si] = GetScoreString(ss.Score, ss.ScoreOrigin, ss.ScoreMakeup); row[dName + "原始成績" + si] = ss.ScoreOrigin.HasValue ? ss.ScoreOrigin.Value + "" : string.Empty; row[dName + "補考成績" + si] = ss.ScoreMakeup.HasValue ? ss.ScoreMakeup.Value + "" : string.Empty; si++; } } } count = 0; foreach (DomainScore domain in jsr.Domains.Values) { if (!DomainScoreDict.ContainsKey(domain.Domain)) { DomainScoreDict.Add(domain.Domain, domain); } count++; //超過就讓它爆炸 if (count > Global.SupportDomainCount) { throw new Exception("超過支援列印領域數量: " + Global.SupportDomainCount); } row["D領域" + count] = domain.Domain; row["D節數" + count] = domain.Period + ""; row["D權數" + count] = domain.Credit + ""; //row["D成績" + count] = domain.Score.HasValue ? domain.Score.Value + "" : string.Empty; row["D成績" + count] = GetScoreString(domain.Score, domain.ScoreOrigin, domain.ScoreMakeup); row["D等第" + count] = GetScoreDegreeString(domain.Score, domain.ScoreOrigin);//domain.Score.HasValue ? _degreeMapper.GetDegreeByScore(domain.Score.Value) : string.Empty; row["D原始成績" + count] = domain.ScoreOrigin.HasValue ? domain.ScoreOrigin.Value + "" : string.Empty; row["D補考成績" + count] = domain.ScoreMakeup.HasValue ? domain.ScoreMakeup.Value + "" : string.Empty; if (!string.IsNullOrWhiteSpace(domain.Text)) { _文字描述.Add(domain.Domain + " : " + domain.Text); } } // 處理指定領域 foreach (string dName in Global.PriDomainNameList()) { if (DomainScoreDict.ContainsKey(dName)) { DomainScore domain = DomainScoreDict[dName]; row[dName + "領域"] = domain.Domain; row[dName + "節數"] = domain.Period + ""; row[dName + "權數"] = domain.Credit + ""; row[dName + "成績"] = GetScoreString(domain.Score, domain.ScoreOrigin, domain.ScoreMakeup); row[dName + "等第"] = GetScoreDegreeString(domain.Score, domain.ScoreOrigin);//domain.Score.HasValue ? _degreeMapper.GetDegreeByScore(domain.Score.Value) : string.Empty; row[dName + "原始成績"] = domain.ScoreOrigin.HasValue ? domain.ScoreOrigin.Value + "" : string.Empty; row[dName + "補考成績"] = domain.ScoreMakeup.HasValue ? domain.ScoreMakeup.Value + "" : string.Empty; } } row["文字描述"] = string.Join(Environment.NewLine, _文字描述); } //預設學年度學期物件 JHSchool.Behavior.BusinessLogic.SchoolYearSemester sysm = new JHSchool.Behavior.BusinessLogic.SchoolYearSemester(_schoolYear, _semester); //AutoSummary foreach (AutoSummaryRecord asr in AutoSummary.Select(_students.Select(x => x.ID), new JHSchool.Behavior.BusinessLogic.SchoolYearSemester[] { sysm })) { DataRow row = _RowCatchs[asr.RefStudentID]; //缺曠 foreach (AbsenceCountRecord acr in asr.AbsenceCounts) { string key = Global.GetKey(acr.PeriodType, acr.Name); //filedName是 "列印假別1~20" foreach (string filedName in allowAbsentDic.Keys) { foreach (string item in allowAbsentDic[filedName]) { if (key == item) { int count = 0; int.TryParse(row[filedName] + "", out count); count += acr.Count; row[filedName] = count; } } } } //獎懲 row["大功"] = asr.MeritA; row["小功"] = asr.MeritB; row["嘉獎"] = asr.MeritC; row["大過"] = asr.DemeritA; row["小過"] = asr.DemeritB; row["警告"] = asr.DemeritC; //日常生活表現 JHMoralScoreRecord msr = asr.MoralScore; XmlElement textScore = (msr != null && msr.TextScore != null) ? msr.TextScore : K12.Data.XmlHelper.LoadXml("<TextScore/>"); foreach (string key in Global.DLBehaviorRef.Keys) { SetDLBehaviorData(key, Global.DLBehaviorRef[key], textScore, row); } } //社團成績 string condition = string.Format("SchoolYear='{0}' and Semester='{1}' and studentid in ({2})", _schoolYear, _semester, id_str); List <AssnCode> list = _A.Select <AssnCode>(condition); foreach (string id in studentIDs) { int count = 0; DataRow row = _RowCatchs[id]; foreach (AssnCode ac in list.FindAll(x => x.StudentID == id)) { XmlElement scores = K12.Data.XmlHelper.LoadXml(ac.Scores); foreach (XmlElement item in scores.SelectNodes("Item")) { count++; //超過就讓它爆炸 if (count > Global.SupportClubCount) { throw new Exception("超過支援列印社團數量: " + Global.SupportClubCount); } string name = item.GetAttribute("AssociationName"); string score = item.GetAttribute("Score"); string effort = item.GetAttribute("Effort"); string text = item.GetAttribute("Text"); row["社團Name" + count] = name; row["社團Score" + count] = score; row["社團Effort" + count] = effort; row["社團Text" + count] = text; } } } //服務學習時數 string query = string.Format("select ref_student_id,occur_date,reason,hours from $k12.service.learning.record where school_year={0} and semester={1} and ref_student_id in ({2})", _schoolYear, _semester, id_str); DataTable table = _Q.Select(query); foreach (DataRow dr in table.Rows) { string sid = dr["ref_student_id"] + ""; DataRow row = _RowCatchs[sid]; decimal new_hr = 0; decimal.TryParse(dr["hours"] + "", out new_hr); decimal old_hr = 0; decimal.TryParse(row["服務學習時數"] + "", out old_hr); decimal hr = old_hr + new_hr; row["服務學習時數"] = hr; } // 取得體適能資料 Dictionary <string, List <StudentFitnessRecord_C> > StudentFitnessRecord_CDict = new Dictionary <string, List <StudentFitnessRecord_C> >(); string qry = "ref_student_id in('" + string.Join("','", studentIDs.ToArray()) + "') and school_year=" + _schoolYear; AccessHelper accHelper = new AccessHelper(); List <StudentFitnessRecord_C> StudentFitnessRecord_CList = accHelper.Select <StudentFitnessRecord_C>(qry); // 依測驗日期排序 StudentFitnessRecord_CList = (from data in StudentFitnessRecord_CList orderby data.TestDate ascending select data).ToList(); foreach (StudentFitnessRecord_C rec in StudentFitnessRecord_CList) { if (!StudentFitnessRecord_CDict.ContainsKey(rec.StudentID)) { StudentFitnessRecord_CDict.Add(rec.StudentID, new List <StudentFitnessRecord_C>()); } StudentFitnessRecord_CDict[rec.StudentID].Add(rec); } foreach (string sid in StudentFitnessRecord_CDict.Keys) { if (_RowCatchs.ContainsKey(sid)) { DataRow row = _RowCatchs[sid]; int cot = 1; foreach (StudentFitnessRecord_C rec in StudentFitnessRecord_CDict[sid]) { row["身高" + cot] = rec.Height; row["體重" + cot] = rec.Weight; row["坐姿體前彎" + cot] = rec.SitAndReach; row["坐姿體前彎常模" + cot] = rec.SitAndReachDegree; row["立定跳遠" + cot] = rec.StandingLongJump; row["立定跳遠常模" + cot] = rec.StandingLongJumpDegree; row["仰臥起坐" + cot] = rec.SitUp; row["仰臥起坐常模" + cot] = rec.SitUpDegree; row["心肺適能" + cot] = rec.Cardiorespiratory; row["心肺適能常模" + cot] = rec.CardiorespiratoryDegree; cot++; } } } }
public new void Layout(List <string> PrimaryKeys) { //選取的結點的完整路徑 List <string> selectPath = new List <string>(); #region 記錄選取的結點的完整路徑 var selectNode = advTree1.SelectedNode; if (selectNode != null) { while (selectNode != null) { selectPath.Insert(0, selectNode.Text); selectNode = selectNode.Parent; } } #endregion advTree1.Nodes.Clear(); items.Clear(); //第一維記錄教師分類,第二維記錄年級下的教師編號 SortedList <string, List <string> > TeacherCategory = new SortedList <string, List <string> >(); //用來記錄未分類的教師 List <string> TeacherUnCategory = new List <string>(); //取得所有教師編號 foreach (var key in PrimaryKeys) { //根據學生記錄取得班級記錄 TeacherRecord TeacherRec = Teacher.Instance[key]; //根據班級記錄取得年級,若是年級為null則年級為空白 string strTeacherCategory = (TeacherRec == null ? "" : TeacherRec.Category); //將gradeYear轉型成int if (!strTeacherCategory.Equals("")) { if (!TeacherCategory.ContainsKey(strTeacherCategory)) { TeacherCategory.Add(strTeacherCategory, new List <string>()); } TeacherCategory[strTeacherCategory].Add(key); } else { TeacherUnCategory.Add(key); } } foreach (string strCategory in TeacherCategory.Keys) { DevComponents.AdvTree.Node TeacherCategoryNode = new DevComponents.AdvTree.Node(); TeacherCategoryNode.Text = strCategory; TeacherCategoryNode.Cells.Add(new DevComponents.AdvTree.Cell("" + TeacherCategory[strCategory].Count)); items.Add(TeacherCategoryNode, TeacherCategory[strCategory]); this.advTree1.Nodes.Add(TeacherCategoryNode); } if (TeacherUnCategory.Count > 0) { DevComponents.AdvTree.Node TeacherCategoryNode = new DevComponents.AdvTree.Node() { Text = "未分類" }; TeacherCategoryNode.Cells.Add(new DevComponents.AdvTree.Cell("" + TeacherUnCategory.Count)); items.Add(TeacherCategoryNode, TeacherUnCategory); this.advTree1.Nodes.Add(TeacherCategoryNode); } if (selectPath.Count != 0) { selectNode = SelectNode(selectPath, 0, advTree1.Nodes); if (selectNode != null) { advTree1.SelectedNode = selectNode; } } advTree1.Focus(); }
/// <summary> /// Constructor /// 傳入一個課程。 /// </summary> /// <param name="course"></param> public CourseScoreInputForm(CourseRecord course) { InitializeComponent(); prlp = new PermRecLogProcess(); _course = course; #region 設定小標題 TeacherRecord first = course.GetFirstTeacher(); TeacherRecord second = course.GetSecondTeacher(); TeacherRecord third = course.GetThirdTeacher(); StringBuilder builder = new StringBuilder(""); if (first != null) { builder.Append(first.Name + ","); } if (second != null) { builder.Append(second.Name + ","); } if (third != null) { builder.Append(third.Name + ","); } string teachers = builder.ToString(); if (!string.IsNullOrEmpty(teachers)) { teachers = teachers.Substring(0, teachers.Length - 1); } lblCourseName.Text = course.Name + (!string.IsNullOrEmpty(teachers) ? " (" + teachers + ")" : ""); #endregion #region 取得努力程度對照表 K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["努力程度對照表"]; if (!string.IsNullOrEmpty(cd["xml"])) { XmlElement element = XmlHelper.LoadXml(cd["xml"]); foreach (XmlElement each in element.SelectNodes("Effort")) { int code = int.Parse(each.GetAttribute("Code")); decimal score; if (!decimal.TryParse(each.GetAttribute("Score"), out score)) { score = 0; } if (!_effortList.ContainsKey(score)) { _effortList.Add(score, code); } } _scoreList = new List <decimal>(); _scoreList.AddRange(_effortList.Keys); _scoreList.Sort(delegate(decimal a, decimal b) { return(b.CompareTo(a)); }); } #endregion #region 取得文字評量代碼表 cd = K12.Data.School.Configuration["文字描述代碼表"]; if (!string.IsNullOrEmpty(cd["xml"])) { XmlHelper helper = new XmlHelper(XmlHelper.LoadXml(cd["xml"])); foreach (XmlElement item in helper.GetElements("Item")) { string code = item.GetAttribute("Code"); string content = item.GetAttribute("Content"); if (!_textMapping.ContainsKey(code)) { _textMapping.Add(code, content); } } } #endregion }
/// <summary> /// 設定課程的第三位教師。 /// </summary> /// <param name="teacher">設定成 Null 即為移除教師。</param> public static TCInstructRecordEditor SetThirdTeacher(this CourseRecord course, TeacherRecord teacher) { return(SetTeacher(course, teacher, "3")); }
private void _rbgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error == null && !e.Cancelled) { dataGridViewX1.Rows.Clear(); Tuple <List <DisciplineRequestRecord>, Dictionary <string, StudentRecord>, Dictionary <string, TeacherRecord> > tp = (Tuple <List <DisciplineRequestRecord>, Dictionary <string, StudentRecord>, Dictionary <string, TeacherRecord> >)e.Result; List <DisciplineRequestRecord> drrl = tp.Item1; Dictionary <string, StudentRecord> dsr = tp.Item2; Dictionary <string, TeacherRecord> dtr = tp.Item3; if (drrl.Count > 0) { #region 更新畫面資料 dataGridViewX1.SuspendLayout(); foreach (DisciplineRequestRecord item in drrl) { DataGridViewRow _row = new DataGridViewRow(); StudentRecord sr = null; TeacherRecord tr = null; if (dsr.ContainsKey("" + item.RefStudentId)) { sr = dsr["" + item.RefStudentId]; } if (dtr.ContainsKey("" + item.RefTeacherId)) { tr = dtr["" + item.RefTeacherId]; } _row.CreateCells(dataGridViewX1); _row.Cells[0].Value = item.OccurDate.ToShortDateString(); //獎懲日期 _row.Cells[6].Value = item.DisciplineString; //獎懲次數 _row.Cells[7].Value = item.Reason; //事由 if (sr != null && sr.Class != null) { _row.Cells[2].Value = sr.Class.Name; //班級 } _row.Cells[3].Value = sr.SeatNo; //座號 _row.Cells[4].Value = sr.StudentNumber; //學號 _row.Cells[5].Value = sr.Name; //姓名 if (tr != null) { _row.Cells[1].Value = tr.Name + (!string.IsNullOrWhiteSpace(tr.Nickname) ? "(" + tr.Nickname + ")" : "");//登錄人員 } _row.Tag = item; _row.Cells[8].Value = ""; _row.Cells[9].Value = ""; dataGridViewX1.Rows.Add(_row); } dataGridViewX1.ResumeLayout(); #endregion _rIsDirty = false; if (dataGridViewX1.Rows.Count > 0) { dataGridViewX1.Rows[0].Selected = false; } } else { dataGridViewX1.Rows.Clear(); FISCA.Presentation.Controls.MsgBox.Show("查無獎懲資料!"); return; } } }
/// <summary> /// 取得教師上的所有課程關聯資料。 /// </summary> public static List <TCInstructRecord> GetInstructs(this TeacherRecord teacher) { return(TCInstruct.Instance.GetTeacherCourses(teacher.ID)); }
public TeacherTagRecordEditor(TeacherRecord teacher, TagRecord record) { TeacherTagRecord = null; RefEntityID = teacher.ID; RefTagID = record.ID; }
/// <summary> /// 設定使用者介面 /// </summary> public void SetupPresentation() { if (_initialized) { return; } #region 課程加入授課教師 Course.Instance.SelectedListChanged += delegate { assignTeacherButton.Enable = (Course.Instance.SelectedList.Count > 0 && Teacher.Instance.TemporaList.Count > 0); }; Teacher.Instance.TemporaListChanged += delegate { assignTeacherButton.Enable = (Course.Instance.SelectedList.Count > 0 && Teacher.Instance.TemporaList.Count > 0); }; assignTeacherButton = Course.Instance.RibbonBarItems["指定"]["評分教師"]; assignTeacherButton.Enable = false; assignTeacherButton.Image = Properties.Resources.teacher_64; MenuButton loadingMenuButton = assignTeacherButton["載入中…"]; assignTeacherButton.PopupOpen += delegate(object sender, PopupOpenEventArgs e) { if (Teacher.Instance.TemporaList.Count <= 0) { return; } if (Course.Instance.SelectedList.Count <= 0) { return; } loadingMenuButton.Visible = false; foreach (var item in Teacher.Instance.TemporaList) { MenuButton mb = e.VirtualButtons[item.Name]; mb.Tag = item; mb.Click += new EventHandler(MenuButton_Click); } }; #endregion #region 授課教師 ListPanelField teacherField = new ListPaneField("授課教師"); teacherField.GetVariable += delegate(object sender, GetVariableEventArgs e) { string teacherName = ""; if (TCInstruct.Instance.Loaded) { TeacherRecord teacher1 = Course.Instance[e.Key].GetFirstTeacher(); if (teacher1 != null) { teacherName += teacher1.FullName; } TeacherRecord teacher2 = Course.Instance[e.Key].GetSecondTeacher(); if (teacher2 != null) { if (teacherName.Length > 0) { teacherName += "," + teacher2.FullName; } else { teacherName += teacher2.FullName; } } TeacherRecord teacher3 = Course.Instance[e.Key].GetThirdTeacher(); if (teacher3 != null) { if (teacherName.Length > 0) { teacherName += "," + teacher3.FullName; } else { teacherName += teacher3.FullName; } } if (teacherName.Length > 0) { e.Value = teacherName; } else { e.Value = string.Empty; } } else { e.Value = "Loading..."; } }; Course.Instance.AddListPaneField(teacherField); #endregion _initialized = true; }
/// <summary> /// 傳入老師Record,回傳包含老師暱稱的名字 /// </summary> public string GetTeacherName(TeacherRecord tr) { if (string.IsNullOrEmpty(tr.Nickname)) { return tr.Name; } else { return tr.Name + "(" + tr.Nickname + ")"; } }
void _BGWork_DoWork(object sender, DoWorkEventArgs e) { _AllTeacherNameDic.Clear(); _AllLogIDDic.Clear(); foreach (TeacherRecord TR in Teacher.SelectAll()) { _AllTeacherNameDic.Add(TR.Name + TR.Nickname, TR.ID); if (!string.IsNullOrEmpty(TR.TALoginName)) _AllLogIDDic.Add(TR.TALoginName.Trim().ToUpper(), TR.ID); } // Ū���Юv��� _TeacherRec = Teacher.SelectByID(PrimaryKey); }
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 }
void BGW_DoWork(object sender, DoWorkEventArgs e) { ClassClubTraMag mag = new ClassClubTraMag(_SchoolYear, _Semester, PrintLost); //依據使用者所選擇的學年期 //取得相關學生之社團結算成績 //列印不及格學生清單時,排除所有學期成績60分(含)以上之學生 //取得範本 #region 建立範本 Workbook template = new Workbook(); template.Open(new MemoryStream(Properties.Resources.班級社團成績單_範本), FileFormatType.Excel97To2003); if (PrintLost) //不及格確認單 { PriontName = "班級社團成績不及格(確認單)"; } else { PriontName = "班級社團成績單"; } Workbook prototype = new Workbook(); prototype.Copy(template); Worksheet ptws = prototype.Worksheets[0]; #region 建立標頭Column 評量比例 評 = new 評量比例(); if (評._wp == null) { e.Cancel = true; return; } ColumnNameList = new List <string>(); ColumnNameList.Add("座號"); ColumnNameList.Add("姓名"); ColumnNameList.Add("學號"); ColumnNameList.Add("性別"); ColumnNameList.Add("社團"); foreach (string each in 評.ColumnDic.Keys) { ColumnNameList.Add(each + "(" + 評.ProportionDic[each] + "%)"); } ColumnNameList.Add("學期成績"); if (PrintLost) //不及格確認單 { ColumnNameList.Add("簽名"); } int ColumnNameIndex = 0; //Jean Aspose更新 Style style = prototype.CreateStyle(); style.IsTextWrapped = true; foreach (string each in ColumnNameList) { ptws.Cells[2, ColumnNameIndex].SetStyle(style); ptws.Cells[2, ColumnNameIndex].PutValue(each); if (ColumnNameIndex >= 5) { ptws.Cells.SetColumnWidth(ColumnNameIndex, 10); tool.SetCellBro(ptws, 2, ColumnNameIndex, 1, 1); } ColumnNameIndex++; } #endregion Range ptHeader = ptws.Cells.CreateRange(0, 3, false); Range ptEachRow = ptws.Cells.CreateRange(3, 1, false); //建立Excel檔案 Workbook wb = new Workbook(); wb.Copy(prototype); //取得第一張 Worksheet ws = wb.Worksheets[0]; int dataIndex = 0; int CountPage = 1; int DetalIndex = 5; #endregion #region 填資料 foreach (string classID in mag.TraDic.Keys) { if (mag.TraDic[classID].Count == 0) { continue; } ws.Cells.CreateRange(dataIndex, 3, false).CopyStyle(ptHeader); ws.Cells.CreateRange(dataIndex, 3, false).CopyValue(ptHeader); ClassRecord cr = mag.ClassDic[classID]; ws.Cells.Merge(dataIndex, 0, 1, ColumnNameList.Count); string TitleName = string.Format("{0}學年度 第{1}學期 {2}", _SchoolYear.ToString(), _Semester.ToString(), PriontName); ws.Cells[dataIndex, 0].PutValue(TitleName); dataIndex++; //班級 ws.Cells.Merge(dataIndex, 0, 1, 3); ws.Cells[dataIndex, 0].PutValue(string.Format("班級:{0}", cr.Name)); ws.Cells.Merge(dataIndex, 4, 1, 3); //教師 if (!string.IsNullOrEmpty(cr.RefTeacherID)) { #region 教師 if (mag.TeacherDic.ContainsKey(cr.RefTeacherID)) { TeacherRecord tr = mag.TeacherDic[cr.RefTeacherID]; //是否有暱稱 if (!string.IsNullOrEmpty(tr.Nickname)) { string TeacherString = "班導師:" + tr.Name + "(" + tr.Nickname + ")"; ws.Cells[dataIndex, 4].PutValue(TeacherString); } else { string TeacherString = "班導師:" + mag.TeacherDic[cr.RefTeacherID].Name; ws.Cells[dataIndex, 4].PutValue(TeacherString); } } #endregion } //頁數 ws.Cells.Merge(dataIndex, ColumnNameList.Count - 3, 1, 3); ws.Cells[dataIndex, ColumnNameList.Count - 3].PutValue("日期:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm") + " 頁數:" + CountPage.ToString()); dataIndex += 2; mag.TraDic[classID].Sort(SortTraDic); foreach (ClassClubTraObj each in mag.TraDic[classID]) { ws.Cells.CreateRange(dataIndex, 1, false).CopyStyle(ptEachRow); ws.Cells.CreateRange(dataIndex, 1, false).CopyValue(ptEachRow); ws.Cells[dataIndex, 0].PutValue(each.studentRecord.SeatNo.HasValue ? each.studentRecord.SeatNo.Value.ToString() : ""); ws.Cells[dataIndex, 1].PutValue(each.studentRecord.Name); ws.Cells[dataIndex, 2].PutValue(each.studentRecord.StudentNumber); ws.Cells[dataIndex, 3].PutValue(each.studentRecord.Gender); //社團 if (each.club != null) { ws.Cells[dataIndex, 4].PutValue(each.club.ClubName); } if (each.SCJoin != null) { if (!string.IsNullOrEmpty(each.SCJoin.Score)) { int x = 0; XmlElement xml = DSXmlHelper.LoadXml(each.SCJoin.Score); foreach (XmlElement each1 in xml.SelectNodes("Item")) { x++; string name = each1.GetAttribute("Name"); if (評.ColumnDic.ContainsKey(name)) { ws.Cells[dataIndex, DetalIndex + 評.ColumnDic[name]].PutValue(each1.GetAttribute("Score")); } } } } for (int x = 3; x < ColumnNameList.Count; x++) { tool.SetCellBro(ws, dataIndex, x, 1, 1); } //學期成績 if (PrintLost) //不及格確認單 { ws.Cells.SetColumnWidth(ColumnNameList.Count - 1, 14); if (each.RSR != null) { ws.Cells.SetColumnWidth(ColumnNameList.Count - 2, 8); string Score = each.RSR.ResultScore.HasValue ? each.RSR.ResultScore.Value.ToString() : ""; ws.Cells[dataIndex, ColumnNameList.Count - 2].PutValue(Score); } else { } } else { if (each.RSR != null) //有學期成績 { ws.Cells.SetColumnWidth(ColumnNameList.Count - 1, 8); string Score = each.RSR.ResultScore.HasValue ? each.RSR.ResultScore.Value.ToString() : ""; ws.Cells[dataIndex, ColumnNameList.Count - 1].PutValue(Score); } else { } } dataIndex++; } CountPage++; //每班增加1頁 ws.HPageBreaks.Add(dataIndex, ColumnNameList.Count); } #endregion e.Result = wb; }