private void LoadData() { _ChangeListener.SuspendListen(); txtName.Text = ""; txtPhone.Text = ""; if (_K12EmergencyContactRecord != null) { txtName.Text = _K12EmergencyContactRecord.ContactName; txtPhone.Text = _K12EmergencyContactRecord.ContactPhone; } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
private void FillData() { _listener.SuspendListen(); foreach (DataGridViewRow row in dgv.Rows) { DataGridViewCell cell = row.Cells[chScore.Index]; cell.ErrorText = string.Empty; if ("" + row.Tag == "LearnDomain") { cell.Value = "" + _record.LearnDomainScore; } else if ("" + row.Tag == "CourseLearn") { cell.Value = "" + _record.CourseLearnScore; } else { string domain = "" + row.Cells[chDomain.Index].Value; if (_record.Domains.ContainsKey(domain)) { cell.Value = "" + _record.Domains[domain].Score; } else { cell.Value = string.Empty; } } } _listener.Reset(); _listener.ResumeListen(); }
// 載入母親資料 private void LoadMother() { DataListenerPause(); btnGuardian.Enabled = true; btnFather.Enabled = true; btnMother.Enabled = false; cboAlive.Visible = true; lblAlive.Visible = true; cboRelationship.Visible = false; lblRelationship.Visible = false; btnParentType.Text = btnMother.Text; txtParentName.Text = _StudParentRec.Mother.Name; txtIDNumber.Text = _StudParentRec.Mother.IDNumber; txtParentPhone.Text = _StudParentRec.Mother.Phone; cboAlive.Text = _StudParentRec.Mother.Living; cboNationality.Text = _StudParentRec.Mother.Nationality; cboJob.Text = _StudParentRec.Mother.Job; cboEduDegree.Text = _StudParentRec.Mother.EducationDegree; txtEMail.Text = _StudParentRec.Mother.EMail; //cboAlive.SetComboBoxValue(_StudParentRec.Mother.Living); //cboNationality.SetComboBoxValue(_StudParentRec.Mother.Nationality); //cboJob.SetComboBoxValue(_StudParentRec.Mother.Job); //cboEduDegree.SetComboBoxValue(_StudParentRec.Mother.EducationDegree); lnkCopyGuardian.Visible = true; lnkCopyFather.Visible = false; lnkCopyMother.Visible = false; _DataListener_Mother.Reset(); _DataListener_Mother.ResumeListen(); }
void _BGWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (_isBusy) { _isBusy = false; _BGWorker.RunWorkerAsync(); return; } int RowIdx = 0; foreach (DAL.UserDefData udd in _UserDefDataList) { dgv.Rows.Add(); dgv.Rows[RowIdx].Tag = udd.UID; dgv.Rows[RowIdx].Cells[SchoolYear.Index].Value = udd.SchoolYear.ToString(); dgv.Rows[RowIdx].Cells[GradeYear.Index].Value = udd.GradeYear.ToString(); dgv.Rows[RowIdx].Cells[Semester.Index].Value = udd.Semester.ToString(); dgv.Rows[RowIdx].Cells[GradeRank.Index].Value = udd.GradeRank.ToString(); dgv.Rows[RowIdx].Cells[GradeRankAdd.Index].Value = udd.GradeRankAdd.ToString(); dgv.Rows[RowIdx].Cells[GradeRankPercent.Index].Value = udd.GradeRankPercent.ToString(); dgv.Rows[RowIdx].Cells[GradeRankPercentAdd.Index].Value = udd.GradeRankPercentAdd.ToString(); RowIdx++; } ChangeManager.Reset(); ChangeManager.ResumeListen(); this.Loading = false; }
private void FillData() { listener.SuspendListen(); txtSchool.Text = _BeforeEnrollmentRecord.School; txtSchoolLocation.Text = _BeforeEnrollmentRecord.SchoolLocation; txtClass.Text = _BeforeEnrollmentRecord.ClassName; if (_BeforeEnrollmentRecord.SeatNo.HasValue) { txtSeatNo.Text = _BeforeEnrollmentRecord.SeatNo.Value + ""; } else { txtSeatNo.Text = ""; } txtMemo.Text = _BeforeEnrollmentRecord.Memo; epSeatNo.Clear(); listener.ResumeListen(); listener.Reset(); prlp.SetBeforeSaveText("學校名稱", txtSchool.Text); prlp.SetBeforeSaveText("所在地", txtSchoolLocation.Text); prlp.SetBeforeSaveText("班級", txtClass.Text); prlp.SetBeforeSaveText("座號", txtSeatNo.Text); prlp.SetBeforeSaveText("備註", txtMemo.Text); }
private void LoadData() { _ChangeListener.SuspendListen(); ClearTxt(); foreach (Control cr in this.Controls) { if (cr is TextBox) { if (_dataDict.ContainsKey(cr.Name)) { cr.Text = _dataDict[cr.Name].Data; cr.Tag = _dataDict[cr.Name]; } } } if (_dataDict.ContainsKey(dtFillDate.Name)) { DateTime dt; dtFillDate.Tag = _dataDict[dtFillDate.Name]; if (DateTime.TryParse(_dataDict[dtFillDate.Name].Data, out dt)) { dtFillDate.Value = dt; } else { dtFillDate.Text = ""; } } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
private void ResetOverrideButton() { SaveButtonVisible = false; CancelButtonVisible = false; _Listener.Reset(); _Listener.ResumeListen(); }
private void BindDataToForm() { SaveButtonVisible = false; CancelButtonVisible = false; this._DefaultSchoolYear = ""; this._DefaultGDNumber = ""; this._DefaultMemo = ""; this._DefaultReason = ""; this._DefaultClass = ""; DataListener.SuspendListen(); txtSchoolYear.Text = ""; txtGDNumber.Text = ""; txtMemo.Text = ""; cboReason.Text = ""; txtClass.Text = ""; cboReason.Items.Clear(); cboReason.Items.Add("畢業"); cboReason.Items.Add("修業"); cboReason.Items.Add(""); cboReason.DropDownStyle = ComboBoxStyle.DropDownList; if (LeaveInfoRec.SchoolYear.HasValue) { txtSchoolYear.Text = this._DefaultSchoolYear = "" + LeaveInfoRec.SchoolYear.Value; } if (!string.IsNullOrEmpty(LeaveInfoRec.DiplomaNumber)) { txtGDNumber.Text = this._DefaultGDNumber = LeaveInfoRec.DiplomaNumber; } if (!string.IsNullOrEmpty(LeaveInfoRec.Memo)) { txtMemo.Text = this._DefaultMemo = LeaveInfoRec.Memo; } if (!string.IsNullOrEmpty(LeaveInfoRec.Reason)) { cboReason.Text = this._DefaultReason = LeaveInfoRec.Reason; } //if (!string.IsNullOrEmpty(LeaveInfoRec.ClassName)) // txtClass.Text = this._DefaultClass = LeaveInfoRec.ClassName; epSchoolYear.Clear(); prlp.SetBeforeSaveText("畢業學年度", this._DefaultSchoolYear); prlp.SetBeforeSaveText("畢業資格", this._DefaultReason); prlp.SetBeforeSaveText("畢業證書字號", this._DefaultGDNumber); prlp.SetBeforeSaveText("畢業相關訊息", this._DefaultMemo); DataListener.Reset(); DataListener.ResumeListen(); this.Loading = false; }
private void LoadData() { _ChangeListener.SuspendListen(); chkHighConcern.Checked = false; txtCount.Text = ""; txtDocNo.Text = ""; txtEDoc.Text = ""; if (_HighConcernDict.Count > 0) { chkHighConcern.Checked = _HighConcernDict[PrimaryKey].HighConcern; txtCount.Text = _HighConcernDict[PrimaryKey].NumberReduce.ToString(); txtDocNo.Text = _HighConcernDict[PrimaryKey].DocNo; txtEDoc.Text = _HighConcernDict[PrimaryKey].EDoc; } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
// 載入資料到畫面 private void DataBindToForm() { if (_TeacherRec == null) { _TeacherRec = new JHTeacherRecord(); } _DataListener.SuspendListen(); txtName.Text = _TeacherRec.Name; txtIDNumber.Text = _TeacherRec.IDNumber; cboGender.Text = _TeacherRec.Gender; txtNickname.Text = _TeacherRec.Nickname; txtPhone.Text = _TeacherRec.ContactPhone; txtEmail.Text = _TeacherRec.Email; txtCategory.Text = _TeacherRec.Category; txtSTLoginAccount.Text = _TeacherRec.TALoginName; txtSTLoginPwd.Text = _TeacherRec.TAPassword; cboAccountType.Text = _TeacherRec.AccountType; txtTeacherNumber.Text = _TeacherRec.TeacherNumber; try { pic1.Image = Photo.ConvertFromBase64Encoding(_TeacherRec.Photo, pic1.Width, pic1.Height); } catch (Exception) { pic1.Image = pic1.InitialImage; } // Log prlp.SetBeforeSaveText("姓名", txtName.Text); prlp.SetBeforeSaveText("身分證號", txtIDNumber.Text); prlp.SetBeforeSaveText("性別", cboGender.Text); prlp.SetBeforeSaveText("暱稱", txtNickname.Text); prlp.SetBeforeSaveText("聯絡電話", txtPhone.Text); prlp.SetBeforeSaveText("電子信箱", txtEmail.Text); prlp.SetBeforeSaveText("教師類別", txtCategory.Text); prlp.SetBeforeSaveText("登入帳號", txtSTLoginAccount.Text); prlp.SetBeforeSaveText("登入密碼", txtSTLoginPwd.Text); prlp.SetBeforeSaveText("帳號類型", cboAccountType.Text); prlp.SetBeforeSaveText("教師編號", txtTeacherNumber.Text); this.Loading = false; SaveButtonVisible = false; CancelButtonVisible = false; _DataListener.Reset(); _DataListener.ResumeListen(); }
/// <summary> /// 將讀取資料填入DataGridView /// </summary> private void DataBindToDataGridView() { try { //_LogTransfer.Clear(); this.Loading = true; ChangeManager.SuspendListen(); dgv.Rows.Clear(); _FieldNameList.Clear(); int rowIdx = 0; foreach (DAO.UDT_CounselUserDefDataDef udd in _UserDefineData) { rowIdx = dgv.Rows.Add(); dgv.Rows[rowIdx].Tag = udd; dgv.Rows[rowIdx].Cells[FieldName.Index].Value = udd.FieldName; dgv.Rows[rowIdx].Cells[Value.Index].Value = udd.Value; _FieldNameList.Add(udd.FieldName); //_LogTransfer.SetLogValue(udd.FieldName, udd.Value); } // 放入樣板有內容沒有的 foreach (string str in _UseDefineDataType.Keys) { if (!_FieldNameList.Contains(str)) { DAO.UDT_CounselUserDefDataDef cudd = new DAO.UDT_CounselUserDefDataDef(); cudd.FieldName = str; cudd.Value = ""; cudd.StudentID = int.Parse(PrimaryKey); rowIdx = dgv.Rows.Add(); dgv.Rows[rowIdx].Tag = cudd; dgv.Rows[rowIdx].Cells[FieldName.Index].Value = cudd.FieldName; dgv.Rows[rowIdx].Cells[Value.Index].Value = cudd.Value; } } } catch (Exception ex) { FISCA.Presentation.Controls.MsgBox.Show(ex.Message); } this.CancelButtonVisible = false; this.SaveButtonVisible = false; this.ContentValidated = true; ChangeManager.Reset(); ChangeManager.ResumeListen(); this.Loading = false; }
private void LoadData() { _ChangeListener.SuspendListen(); txtRemark.Text = ""; txtRemark.Tag = _data; if (_data != null) { txtRemark.Text = _data.Data; } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
void _bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (_isBusy) { _isBusy = false; _bgWorker.RunWorkerAsync(); return; } _ChangeListener.SuspendListen(); BindDataToDataGrid(); _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; _reloadQuestion = false; }
/// <summary> /// 載入資料至控制項 /// </summary> private void LoadData() { _ChangeListener.SuspendListen(); if (_reloadQuestion) { LoadQuestionToUI(); } SetControlsDefault(); BindAnswerDataToUI(); _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; _reloadQuestion = false; }
private void LoadData() { _ChangeListener.SuspendListen(); cbxCourseGroupCode.Text = ""; cbxCourseGroupCode.Items.Clear(); cbxCourseGroupCode.Items.Add(""); foreach (string name in GroupNameList) { cbxCourseGroupCode.Items.Add(name); } cbxCourseGroupCode.Text = ClassGroupName; _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
private void BindDataToDataGridView() { try { ChangeManager.SuspendListen(); dataGridViewX1.Rows.Clear(); foreach (K12.Data.SemesterHistoryItem shi in _SemesterHistoryRec.SemesterHistoryItems) { string SchoolDayCount = "", seatNo = ""; if (shi.SeatNo.HasValue) { seatNo = shi.SeatNo.Value + ""; } if (shi.SchoolDayCount.HasValue) { SchoolDayCount = shi.SchoolDayCount.Value + ""; } dataGridViewX1.Rows.Add(shi.SchoolYear, shi.Semester, shi.GradeYear, shi.ClassName, seatNo, shi.Teacher, SchoolDayCount); // 這段在記log string logIdxStr = shi.SchoolYear + "" + shi.Semester + "_"; prlp.SetBeforeSaveText(logIdxStr + "學年度", shi.SchoolYear + ""); prlp.SetBeforeSaveText(logIdxStr + "學期", shi.Semester + ""); prlp.SetBeforeSaveText(logIdxStr + "年級", shi.GradeYear + ""); prlp.SetBeforeSaveText(logIdxStr + "班級", shi.ClassName); prlp.SetBeforeSaveText(logIdxStr + "座號", seatNo); prlp.SetBeforeSaveText(logIdxStr + "班導師", shi.Teacher); prlp.SetBeforeSaveText(logIdxStr + "上課天數", SchoolDayCount); } this.CancelButtonVisible = false; this.SaveButtonVisible = false; this.ContentValidated = true; ChangeManager.Reset(); ChangeManager.ResumeListen(); this.Loading = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 將讀取資料填入DataGridView /// </summary> private void DataBindToDataGridView() { try { this.Loading = true; ChangeManager.SuspendListen(); dgv.Rows.Clear(); _DeleteDataList.Clear(); foreach (DAL.UserDefData udd in _UserDefDataList) { int rowIdx = dgv.Rows.Add(); dgv.Rows[rowIdx].Tag = udd; dgv.Rows[rowIdx].Cells[FieldName.Index].Value = udd.FieldName; dgv.Rows[rowIdx].Cells[Value.Index].Value = udd.Value; udd.Deleted = true; // 當有資料才放入刪除 if (!string.IsNullOrEmpty(udd.UID)) { _DeleteDataList.Add(udd); } prlp.SetBeforeSaveText(udd.FieldName + "欄位名稱", udd.FieldName); prlp.SetBeforeSaveText(udd.FieldName + "值", udd.Value); } } catch (Exception ex) { FISCA.Presentation.Controls.MsgBox.Show(ex.Message); } this.CancelButtonVisible = false; this.SaveButtonVisible = false; this.ContentValidated = true; ChangeManager.Reset(); ChangeManager.ResumeListen(); this.Loading = false; //dgv.Columns[FieldName.Index].ReadOnly = true; }
/// <summary> /// 載入資料 /// </summary> private void LoadData() { _ChangeListener.SuspendListen(); ClearTxt(); foreach (Control cr in this.Controls) { if (cr is TextBoxX) { if (_dataDict.ContainsKey(cr.Name)) { cr.Text = _dataDict[cr.Name].Data; cr.Tag = _dataDict[cr.Name]; } } } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
public ScoreInputForm(JHStudentRecord student, JHCourseRecord course) { InitializeComponent(); InitializeListener(); prlp = new PermRecLogProcess(); lblCourseName.Text = course.Name; lblStudent.Text = student.Name + " " + student.StudentNumber; _course = course; _student = student; List <JHSCAttendRecord> scattendList = JHSCAttend.SelectByStudentIDAndCourseID(new string[] { student.ID }, new string[] { course.ID }); if (scattendList.Count > 0) { _scattend = scattendList[0]; } #region 取得評量成績 _listener.SuspendListen(); // 取得所有試別 Dictionary <string, JHExamRecord> exams = JHExam.SelectAll().ToDictionary(x => x.ID); List <string> examIDs = new List <string>(exams.Keys); List <HC.JHAEIncludeRecord> aeList = new List <HC.JHAEIncludeRecord>(); if (course.RefAssessmentSetupID != null) { JHAssessmentSetupRecord assessment = JHAssessmentSetup.SelectByID(course.RefAssessmentSetupID); if (assessment != null) { foreach (JHAEIncludeRecord ae in JHAEInclude.SelectByAssessmentSetupID(assessment.ID)) { aeList.Add(new HC.JHAEIncludeRecord(ae)); } } //{ // foreach (JHAEIncludeRecord ae in JHAEInclude.SelectAll()) // { // if (ae.RefAssessmentSetupID == assessment.ID) // aeList.Add(new HC.JHAEIncludeRecord(ae)); // } //} } List <JHSCETakeRecord> jhSCEList = JHSCETake.SelectByStudentAndCourse(student.ID, course.ID); //aeList.Sort(delegate(HC.JHAEIncludeRecord x, HC.JHAEIncludeRecord y) //{ // return x.RefExamID.CompareTo(y.RefExamID); //}); aeList.Sort(delegate(HC.JHAEIncludeRecord x, HC.JHAEIncludeRecord y) { int ix = examIDs.IndexOf(x.RefExamID); int iy = examIDs.IndexOf(y.RefExamID); if (ix == -1) { ix = int.MaxValue; } if (iy == -1) { iy = int.MaxValue; } return(ix.CompareTo(iy)); }); List <HC.JHSCETakeRecord> sceList = JHSCETake.SelectByStudentAndCourse(student.ID, course.ID).AsHCJHSCETakeRecords(); Dictionary <string, DataGridViewRow> rows = new Dictionary <string, DataGridViewRow>(); foreach (HC.JHAEIncludeRecord ae in aeList) { DataGridViewRow row = new DataGridViewRow(); //JHExamRecord exam = JHExam.SelectByID(ae.RefExamID); JHExamRecord exam = null; if (exams.ContainsKey(ae.RefExamID)) { exam = exams[ae.RefExamID]; } row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + ae.RefExamID + ")", "", "", ""); dgv.Rows.Add(row); row.Cells[chExamName.Index].Tag = (exam != null) ? exam.ID : ""; if (!ae.UseScore) { DisableCell(row, chScore); } if (!ae.UseAssignmentScore) { DisableCell(row, chAssignmentScore); } if (!ae.UseText) { DisableCell(row, chText); } if (!rows.ContainsKey(ae.RefExamID)) { rows.Add(ae.RefExamID, row); } } //List<HC.JHSCETakeRecord> sceList = jhSCEList.AsHCJHSCETakeRecords(); foreach (HC.JHSCETakeRecord sce in sceList) { if (rows.ContainsKey(sce.RefExamID)) { DataGridViewRow row = rows[sce.RefExamID]; row.Cells[chScore.Index].Value = sce.Score.HasValue ? "" + sce.Score.Value : ""; row.Cells[chAssignmentScore.Index].Value = sce.AssignmentScore.HasValue ? "" + sce.AssignmentScore.Value : ""; row.Cells[chText.Index].Value = sce.Text; row.Tag = sce; } else { DataGridViewRow row = new DataGridViewRow(); JHExamRecord exam = JHExam.SelectByID(sce.RefExamID); row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + sce.RefExamID + ")", sce.Score.HasValue ? "" + sce.Score.Value : "", sce.AssignmentScore.HasValue ? "" + sce.AssignmentScore.Value : "", sce.Text); row.Tag = sce; row.Cells[chExamName.Index].Tag = (exam != null) ? exam.ID : ""; dgv.Rows.Add(row); DisableCell(row, chExamName); DisableCell(row, chScore); DisableCell(row, chAssignmentScore); DisableCell(row, chText); } } #region 填入修課總成績 if (_scattend != null) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "課程總成績", "" + _scattend.Score, "", _scattend.Text); DisableCell(row, chAssignmentScore); row.Tag = "課程總成績"; dgv.Rows.Add(row); } #endregion foreach (DataGridViewRow dgv1 in dgv.Rows) { foreach (DataGridViewCell cell in dgv1.Cells) { cell.ErrorText = ""; if (cell.OwningColumn == chScore || cell.OwningColumn == chAssignmentScore) { cell.Style.ForeColor = Color.Black; if (!string.IsNullOrEmpty("" + cell.Value)) { decimal d; if (!decimal.TryParse("" + cell.Value, out d)) { cell.ErrorText = "分數必須為數字"; } else { if (d < 60) { cell.Style.ForeColor = Color.Red; } if (d > 100 || d < 0) { cell.Style.ForeColor = Color.Green; } } } } } } _listener.Reset(); _listener.ResumeListen(); #endregion SetLoadDataToLog(); }
private void LoadData() { lvData.Items.Clear(); dgData.Rows.Clear(); int row = 0; foreach (string str in _RowNameList) { lvData.Items.Add(str); foreach (string str1 in _ColumIndexDict.Keys) { lvData.Items[row].SubItems.Add(""); } row++; } foreach (KeyValuePair <string, UDTYearlyDataDef> data in _YearlyDataDict) { if (_ColumIndexDict.ContainsKey(data.Key)) { int colIdx = 0; colIdx = _ColumIndexDict[data.Key]; lvData.Columns[colIdx].Tag = data.Value; foreach (KeyValuePair <string, int> rowIdx in _RowIndexDict) { if (rowIdx.Key == "一年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G1; } if (rowIdx.Key == "二年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G2; } if (rowIdx.Key == "三年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G3; } if (rowIdx.Key == "四年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G4; } if (rowIdx.Key == "五年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G5; } if (rowIdx.Key == "六年級") { lvData.Items[rowIdx.Value].SubItems[colIdx].Text = data.Value.G6; } } } } _ChangeListener.SuspendListen(); string rpStr = "學習狀況_"; // 社團班級幹部 foreach (KeyValuePair <string, UDTSemesterDataDef> data1 in _SemesterDataDict) { int rowIdx = dgData.Rows.Add(); dgData.Rows[rowIdx].Tag = data1.Value; dgData.Rows[rowIdx].Cells[colItem.Index].Value = data1.Value.Key.Replace(rpStr, ""); dgData.Rows[rowIdx].Cells[col01.Index].Value = data1.Value.S1a; dgData.Rows[rowIdx].Cells[col02.Index].Value = data1.Value.S1b; dgData.Rows[rowIdx].Cells[col03.Index].Value = data1.Value.S2a; dgData.Rows[rowIdx].Cells[col04.Index].Value = data1.Value.S2b; dgData.Rows[rowIdx].Cells[col05.Index].Value = data1.Value.S3a; dgData.Rows[rowIdx].Cells[col06.Index].Value = data1.Value.S3b; dgData.Rows[rowIdx].Cells[col07.Index].Value = data1.Value.S4a; dgData.Rows[rowIdx].Cells[col08.Index].Value = data1.Value.S4b; dgData.Rows[rowIdx].Cells[col09.Index].Value = data1.Value.S5a; dgData.Rows[rowIdx].Cells[col10.Index].Value = data1.Value.S5b; dgData.Rows[rowIdx].Cells[col11.Index].Value = data1.Value.S6a; dgData.Rows[rowIdx].Cells[col12.Index].Value = data1.Value.S6b; } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; _reloadQuestion = false; }
// 填入地址資訊到畫面 public void BindDataToForm() { DataListenerPause(); prlp.SetBeforeSaveText("戶籍郵遞區號", _StudAddressRec.Permanent.ZipCode); prlp.SetBeforeSaveText("戶籍縣市", _StudAddressRec.Permanent.County); prlp.SetBeforeSaveText("戶籍鄉鎮市區", _StudAddressRec.Permanent.Town); prlp.SetBeforeSaveText("戶籍村里", _StudAddressRec.Permanent.District); prlp.SetBeforeSaveText("戶籍鄰", _StudAddressRec.Permanent.Area); prlp.SetBeforeSaveText("戶籍其它地址", _StudAddressRec.Permanent.Detail); prlp.SetBeforeSaveText("戶籍經度", _StudAddressRec.Permanent.Longitude); prlp.SetBeforeSaveText("戶籍緯度", _StudAddressRec.Permanent.Latitude); prlp.SetBeforeSaveText("聯絡郵遞區號", _StudAddressRec.Mailing.ZipCode); prlp.SetBeforeSaveText("聯絡縣市", _StudAddressRec.Mailing.County); prlp.SetBeforeSaveText("聯絡鄉鎮市區", _StudAddressRec.Mailing.Town); prlp.SetBeforeSaveText("聯絡村里", _StudAddressRec.Mailing.District); prlp.SetBeforeSaveText("聯絡鄰", _StudAddressRec.Mailing.Area); prlp.SetBeforeSaveText("聯絡其它地址", _StudAddressRec.Mailing.Detail); prlp.SetBeforeSaveText("聯絡經度", _StudAddressRec.Mailing.Longitude); prlp.SetBeforeSaveText("聯絡緯度", _StudAddressRec.Mailing.Latitude); prlp.SetBeforeSaveText("其它郵遞區號", _StudAddressRec.Address1.ZipCode); prlp.SetBeforeSaveText("其它縣市", _StudAddressRec.Address1.County); prlp.SetBeforeSaveText("其它鄉鎮市區", _StudAddressRec.Address1.Town); prlp.SetBeforeSaveText("其它村里", _StudAddressRec.Address1.District); prlp.SetBeforeSaveText("其它鄰", _StudAddressRec.Address1.Area); prlp.SetBeforeSaveText("其它其它地址", _StudAddressRec.Address1.Detail); prlp.SetBeforeSaveText("其它經度", _StudAddressRec.Address1.Longitude); prlp.SetBeforeSaveText("其它緯度", _StudAddressRec.Address1.Latitude); this.Loading = false; SaveButtonVisible = false; CancelButtonVisible = false; // 判斷不同 Bind 到相對應 if (_address_type == AddressType.Permanent) { txtZipcode.Text = _StudAddressRec.Permanent.ZipCode; cboCounty.Text = _StudAddressRec.Permanent.County; cboTown.Text = _StudAddressRec.Permanent.Town; txtDistrict.Text = _StudAddressRec.Permanent.District; txtArea.Text = _StudAddressRec.Permanent.Area; txtDetail.Text = _StudAddressRec.Permanent.Detail; txtLongtitude.Text = _StudAddressRec.Permanent.Longitude; txtLatitude.Text = _StudAddressRec.Permanent.Latitude; _DataListener_Permanent.Reset(); _DataListener_Permanent.ResumeListen(); } if (_address_type == AddressType.Mailing) { txtZipcode.Text = _StudAddressRec.Mailing.ZipCode; cboCounty.Text = _StudAddressRec.Mailing.County; cboTown.Text = _StudAddressRec.Mailing.Town; txtDistrict.Text = _StudAddressRec.Mailing.District; txtArea.Text = _StudAddressRec.Mailing.Area; txtDetail.Text = _StudAddressRec.Mailing.Detail; txtLongtitude.Text = _StudAddressRec.Mailing.Longitude; txtLatitude.Text = _StudAddressRec.Mailing.Latitude; _DataListener_Mailing.Reset(); _DataListener_Mailing.ResumeListen(); } if (_address_type == AddressType.Other) { txtZipcode.Text = _StudAddressRec.Address1.ZipCode; cboCounty.Text = _StudAddressRec.Address1.County; cboTown.Text = _StudAddressRec.Address1.Town; txtDistrict.Text = _StudAddressRec.Address1.District; txtArea.Text = _StudAddressRec.Address1.Area; txtDetail.Text = _StudAddressRec.Address1.Detail; txtLongtitude.Text = _StudAddressRec.Address1.Longitude; txtLatitude.Text = _StudAddressRec.Address1.Latitude; _DataListener_Other.Reset(); _DataListener_Other.ResumeListen(); } }
private void LoadData() { _ChangeListener.SuspendListen(); dgData.Rows.Clear(); foreach (DataGridViewColumn col in dgData.Columns) { col.Tag = null; } dgData.AllowUserToAddRows = true; int Row = 0; // 放入年級 foreach (string str in _RowNameList) { Row = dgData.Rows.Add(); dgData.Rows[Row].Cells[0].Value = str; } // 放入選項 colData1.Items.Clear(); colData2.Items.Clear(); colData3.Items.Clear(); colData4.Items.Clear(); colData5.Items.Clear(); colData6.Items.Clear(); colData7.Items.Clear(); //生活習慣 if (_QuestionDataDict.ContainsKey("生活習慣")) { colData1.Items.AddRange((from data in _QuestionDataDict["生活習慣"].itemList select data.Key).ToArray()); } //人際關係 if (_QuestionDataDict.ContainsKey("人際關係")) { colData2.Items.AddRange((from data in _QuestionDataDict["人際關係"].itemList select data.Key).ToArray()); } //外向行為 if (_QuestionDataDict.ContainsKey("外向行為")) { colData3.Items.AddRange((from data in _QuestionDataDict["外向行為"].itemList select data.Key).ToArray()); } //內向行為 if (_QuestionDataDict.ContainsKey("內向行為")) { colData4.Items.AddRange((from data in _QuestionDataDict["內向行為"].itemList select data.Key).ToArray()); } //學習動機 if (_QuestionDataDict.ContainsKey("學習動機")) { colData5.Items.AddRange((from data in _QuestionDataDict["學習動機"].itemList select data.Key).ToArray()); } //服務熱忱 if (_QuestionDataDict.ContainsKey("服務熱忱")) { colData6.Items.AddRange((from data in _QuestionDataDict["服務熱忱"].itemList select data.Key).ToArray()); } //人生態度 if (_QuestionDataDict.ContainsKey("人生態度")) { colData7.Items.AddRange((from data in _QuestionDataDict["人生態度"].itemList select data.Key).ToArray()); } // 填入答案 foreach (KeyValuePair <string, UDTYearlyDataDef> data in _UDTYearlyDataDict) { int ColIdx = 0; if (_ColumIndexDict.ContainsKey(data.Key)) { ColIdx = _ColumIndexDict[data.Key]; } // 內容值放入 Tag dgData.Columns[ColIdx].Tag = data.Value; foreach (KeyValuePair <string, int> rowDa in _RowIndexDict) { if (rowDa.Key == "一年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G1; } if (rowDa.Key == "二年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G2; } if (rowDa.Key == "三年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G3; } if (rowDa.Key == "四年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G4; } if (rowDa.Key == "五年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G5; } if (rowDa.Key == "六年級") { dgData.Rows[rowDa.Value].Cells[ColIdx].Value = data.Value.G6; } } } dgData.AllowUserToAddRows = false; _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; _reloadQuestion = false; }
public ScoreInputForm(JHStudentRecord student, JHCourseRecord course) { InitializeComponent(); InitializeListener(); prlp = new PermRecLogProcess(); lblCourseName.Text = course.Name; lblStudent.Text = student.Name + " " + student.StudentNumber; _course = course; _student = student; List <JHSCAttendRecord> scattendList = JHSCAttend.SelectByStudentIDAndCourseID(new string[] { student.ID }, new string[] { course.ID }); if (scattendList.Count > 0) { _scattend = scattendList[0]; } #region 取得評量成績缺考暨免試設定 PluginMain.ScoreTextMap.Clear(); PluginMain.ScoreValueMap.Clear(); Framework.ConfigData cd = JHSchool.School.Configuration["評量成績缺考暨免試設定"]; if (!string.IsNullOrEmpty(cd["評量成績缺考暨免試設定"])) { XmlElement element = Framework.XmlHelper.LoadXml(cd["評量成績缺考暨免試設定"]); foreach (XmlElement each in element.SelectNodes("Setting")) { var UseText = each.SelectSingleNode("UseText").InnerText; var AllowCalculation = bool.Parse(each.SelectSingleNode("AllowCalculation").InnerText); decimal Score; decimal.TryParse(each.SelectSingleNode("Score").InnerText, out Score); var Active = bool.Parse(each.SelectSingleNode("Active").InnerText); var UseValue = decimal.Parse(each.SelectSingleNode("UseValue").InnerText); if (Active) { if (!PluginMain.ScoreTextMap.ContainsKey(UseText)) { PluginMain.ScoreTextMap.Add(UseText, new ScoreMap { UseText = UseText, AllowCalculation = AllowCalculation, Score = Score, Active = Active, UseValue = UseValue, }); } if (!PluginMain.ScoreValueMap.ContainsKey(UseValue)) { PluginMain.ScoreValueMap.Add(UseValue, new ScoreMap { UseText = UseText, AllowCalculation = AllowCalculation, Score = Score, Active = Active, UseValue = UseValue, }); } } } } #endregion #region 取得評量成績 _listener.SuspendListen(); // 取得所有試別 Dictionary <string, JHExamRecord> exams = JHExam.SelectAll().ToDictionary(x => x.ID); List <string> examIDs = new List <string>(exams.Keys); List <HC.JHAEIncludeRecord> aeList = new List <HC.JHAEIncludeRecord>(); if (course.RefAssessmentSetupID != null) { JHAssessmentSetupRecord assessment = JHAssessmentSetup.SelectByID(course.RefAssessmentSetupID); if (assessment != null) { foreach (JHAEIncludeRecord ae in JHAEInclude.SelectByAssessmentSetupID(assessment.ID)) { aeList.Add(new HC.JHAEIncludeRecord(ae)); } } //{ // foreach (JHAEIncludeRecord ae in JHAEInclude.SelectAll()) // { // if (ae.RefAssessmentSetupID == assessment.ID) // aeList.Add(new HC.JHAEIncludeRecord(ae)); // } //} } List <JHSCETakeRecord> jhSCEList = JHSCETake.SelectByStudentAndCourse(student.ID, course.ID); //aeList.Sort(delegate(HC.JHAEIncludeRecord x, HC.JHAEIncludeRecord y) //{ // return x.RefExamID.CompareTo(y.RefExamID); //}); aeList.Sort(delegate(HC.JHAEIncludeRecord x, HC.JHAEIncludeRecord y) { int ix = examIDs.IndexOf(x.RefExamID); int iy = examIDs.IndexOf(y.RefExamID); if (ix == -1) { ix = int.MaxValue; } if (iy == -1) { iy = int.MaxValue; } return(ix.CompareTo(iy)); }); List <HC.JHSCETakeRecord> sceList = JHSCETake.SelectByStudentAndCourse(student.ID, course.ID).AsHCJHSCETakeRecords(); Dictionary <string, DataGridViewRow> rows = new Dictionary <string, DataGridViewRow>(); foreach (HC.JHAEIncludeRecord ae in aeList) { DataGridViewRow row = new DataGridViewRow(); //JHExamRecord exam = JHExam.SelectByID(ae.RefExamID); JHExamRecord exam = null; if (exams.ContainsKey(ae.RefExamID)) { exam = exams[ae.RefExamID]; } row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + ae.RefExamID + ")", "", "", ""); dgv.Rows.Add(row); row.Cells[chExamName.Index].Tag = (exam != null) ? exam.ID : ""; if (!ae.UseScore) { DisableCell(row, chScore); } if (!ae.UseAssignmentScore) { DisableCell(row, chAssignmentScore); } if (!ae.UseText) { DisableCell(row, chText); } if (!rows.ContainsKey(ae.RefExamID)) { rows.Add(ae.RefExamID, row); } } //List<HC.JHSCETakeRecord> sceList = jhSCEList.AsHCJHSCETakeRecords(); foreach (HC.JHSCETakeRecord sce in sceList) { if (rows.ContainsKey(sce.RefExamID)) { DataGridViewRow row = rows[sce.RefExamID]; if (sce.Score.HasValue) { if (PluginMain.ScoreValueMap.ContainsKey(decimal.Parse(sce.Score.Value + ""))) { row.Cells[chScore.Index].Value = PluginMain.ScoreValueMap[decimal.Parse(sce.Score.Value + "")].UseText; } else { row.Cells[chScore.Index].Value = sce.Score.Value; } } else { row.Cells[chScore.Index].Value = ""; } if (sce.AssignmentScore.HasValue) { if (PluginMain.ScoreValueMap.ContainsKey(decimal.Parse(sce.AssignmentScore.Value + ""))) { row.Cells[chAssignmentScore.Index].Value = PluginMain.ScoreValueMap[decimal.Parse(sce.AssignmentScore.Value + "")].UseText; } else { row.Cells[chAssignmentScore.Index].Value = sce.AssignmentScore.Value; } } else { row.Cells[chAssignmentScore.Index].Value = ""; } row.Cells[chText.Index].Value = sce.Text; row.Tag = sce; } else { DataGridViewRow row = new DataGridViewRow(); JHExamRecord exam = JHExam.SelectByID(sce.RefExamID); row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + sce.RefExamID + ")", sce.Score.HasValue ? "" + sce.Score.Value : "", sce.AssignmentScore.HasValue ? "" + sce.AssignmentScore.Value : "", sce.Text); row.Tag = sce; row.Cells[chExamName.Index].Tag = (exam != null) ? exam.ID : ""; dgv.Rows.Add(row); DisableCell(row, chExamName); DisableCell(row, chScore); DisableCell(row, chAssignmentScore); DisableCell(row, chText); } } #region 填入修課總成績 if (_scattend != null) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "課程總成績", "" + _scattend.Score, "", _scattend.Text); DisableCell(row, chAssignmentScore); row.Tag = "課程總成績"; dgv.Rows.Add(row); } #endregion foreach (DataGridViewRow dgv1 in dgv.Rows) { foreach (DataGridViewCell cell in dgv1.Cells) { cell.ErrorText = ""; if (cell.OwningColumn == chScore || cell.OwningColumn == chAssignmentScore) { cell.Style.ForeColor = Color.Black; if (!string.IsNullOrEmpty("" + cell.Value)) { decimal d; if (!decimal.TryParse("" + cell.Value, out d)) { if (PluginMain.ScoreTextMap.Keys.Count > 0) { if (!PluginMain.ScoreTextMap.ContainsKey("" + cell.Value)) { cell.ErrorText = "分數必須為數字或「" + string.Join("、", PluginMain.ScoreTextMap.Keys) + "」"; } } else { cell.ErrorText = "分數必須為數字"; } } else { if (d < 60) { cell.Style.ForeColor = Color.Red; } if (d > 100 || d < 0) { cell.Style.ForeColor = Color.Green; } } } } } } _listener.Reset(); _listener.ResumeListen(); #endregion SetLoadDataToLog(); }
public ScoreInputForm(Data.JHStudentRecord student, Data.JHCourseRecord course) { InitializeComponent(); InitializeListener(); lblCourseName.Text = course.Name; lblStudent.Text = student.Name + " " + student.StudentNumber; _course = course; _student = student; List <Data.JHSCAttendRecord> scattendList = Data.JHSCAttend.SelectByStudentIDAndCourseID(new string[] { student.ID }, new string[] { course.ID }); if (scattendList.Count > 0) { _scattend = scattendList[0]; } #region 取得評量成績 _listener.SuspendListen(); List <Data.JHAEIncludeRecord> aeList = new List <JHSchool.Data.JHAEIncludeRecord>(); if (course.RefAssessmentSetupID != null) { Data.JHAssessmentSetupRecord assessment = Data.JHAssessmentSetup.SelectByID(course.RefAssessmentSetupID); if (assessment != null) { foreach (Data.JHAEIncludeRecord ae in Data.JHAEInclude.SelectAll()) { if (ae.RefAssessmentSetupID == assessment.ID) { aeList.Add(ae); } } } } List <Data.JHSCETakeRecord> sceList = Data.JHSCETake.SelectByStudentAndCourse(student.ID, course.ID); aeList.Sort(delegate(Data.JHAEIncludeRecord x, Data.JHAEIncludeRecord y) { return(x.RefExamID.CompareTo(y.RefExamID)); }); Dictionary <string, DataGridViewRow> rows = new Dictionary <string, DataGridViewRow>(); foreach (Data.JHAEIncludeRecord ae in aeList) { DataGridViewRow row = new DataGridViewRow(); Data.JHExamRecord exam = Data.JHExam.SelectByID(ae.RefExamID); row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + ae.RefExamID + ")", "", "", ""); dgv.Rows.Add(row); row.Cells[chExamName.Index].Tag = exam.ID; if (!ae.UseScore) { DisableCell(row, chScore); } if (!ae.UseEffort) { DisableCell(row, chEffort); } if (!ae.UseText) { DisableCell(row, chText); } if (!rows.ContainsKey(ae.RefExamID)) { rows.Add(ae.RefExamID, row); } } foreach (Data.JHSCETakeRecord sce in sceList) { if (rows.ContainsKey(sce.RefExamID)) { DataGridViewRow row = rows[sce.RefExamID]; row.Cells[chScore.Index].Value = sce.Score.HasValue ? "" + sce.Score.Value : ""; row.Cells[chEffort.Index].Value = sce.Effort.HasValue ? "" + sce.Effort.Value : ""; row.Cells[chText.Index].Value = sce.Text; row.Tag = sce; } else { DataGridViewRow row = new DataGridViewRow(); Data.JHExamRecord exam = Data.JHExam.SelectByID(sce.RefExamID); row.CreateCells(dgv, (exam != null) ? exam.Name : "無此評量(" + sce.RefExamID + ")", sce.Score.HasValue ? "" + sce.Score.Value : "", sce.Effort.HasValue ? "" + sce.Effort.Value : "", sce.Text); row.Tag = sce; row.Cells[chExamName.Index].Tag = exam.ID; dgv.Rows.Add(row); DisableCell(row, chExamName); DisableCell(row, chScore); DisableCell(row, chEffort); DisableCell(row, chText); } } #region 填入修課總成績 if (_scattend != null) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "課程總成績", "" + _scattend.Score, "" + _scattend.Effort, _scattend.Text); row.Tag = "課程總成績"; dgv.Rows.Add(row); } #endregion _listener.Reset(); _listener.ResumeListen(); #endregion }