// 載入母親資料 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(); }
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 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; }
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; }
private void LoadData() { _ChangeListener.SuspendListen(); txtRemark.Text = ""; txtRemark.Tag = _data; if (_data != null) { txtRemark.Text = _data.Data; } _ChangeListener.Reset(); _ChangeListener.ResumeListen(); this.Loading = false; }
/// <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(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 }
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(); }
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; }