protected override void OnSaveButtonClick(EventArgs e) { LeaveInfoRec.ClassName = txtClass.Text; LeaveInfoRec.DiplomaNumber = txtGDNumber.Text; LeaveInfoRec.Memo = txtMemo.Text; LeaveInfoRec.Reason = cboReason.Text; int SchoolYear = 0; if (string.IsNullOrEmpty(txtSchoolYear.Text)) { LeaveInfoRec.SchoolYear = null; } else { if (int.TryParse(txtSchoolYear.Text, out SchoolYear)) { LeaveInfoRec.SchoolYear = SchoolYear; } else { epSchoolYear.SetError(txtSchoolYear, "請輸入整數"); return; } } JHSchool.Data.JHLeaveIfno.Update(LeaveInfoRec); SaveButtonVisible = false; CancelButtonVisible = false; //Student.Instance.SyncDataBackground(PrimaryKey); // this._DefaultClass = txtClass.Text; this._DefaultGDNumber = txtGDNumber.Text; this._DefaultMemo = txtMemo.Text; this._DefaultSchoolYear = txtSchoolYear.Text; this._DefaultReason = cboReason.Text; prlp.SetAfterSaveText("畢業學年度", txtSchoolYear.Text); prlp.SetAfterSaveText("畢業資格", cboReason.Text); prlp.SetAfterSaveText("畢業證書字號", txtGDNumber.Text); prlp.SetAfterSaveText("畢業相關訊息", txtMemo.Text); prlp.SetActionBy("學籍", "學生畢業資訊"); prlp.SetAction("修改學生畢業資訊"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); // BindDataToForm(); }
private void SetAfterEditLog() { prlp.SetAfterSaveText("姓名", txtName.Text); prlp.SetAfterSaveText("身分證號", txtSSN.Text); prlp.SetAfterSaveText("生日", txtBirthDate.Text); prlp.SetAfterSaveText("性別", cboGender.Text); prlp.SetAfterSaveText("國籍", cboNationality.Text); prlp.SetAfterSaveText("出生地", txtBirthPlace.Text); prlp.SetAfterSaveText("英文姓名", txtEngName.Text); prlp.SetAfterSaveText("登入帳號", txtLoginID.Text); prlp.SetAfterSaveText("帳號類型", cboAccountType.Text); prlp.SetActionBy("學籍", "學生基本資料"); prlp.SetAction("修改學生基本資料"); prlp.SetDescTitle("姓名:" + _StudRec.Name + ",學號:" + _StudRec.StudentNumber + ","); prlp.SaveLog("", "", "Student", PrimaryKey); }
protected override void OnSaveButtonClick(EventArgs e) { _BeforeEnrollmentRecord.School = txtSchool.Text; _BeforeEnrollmentRecord.SchoolLocation = txtSchoolLocation.Text; _BeforeEnrollmentRecord.ClassName = txtClass.Text; int intSeatNo; if (string.IsNullOrEmpty(txtSeatNo.Text)) { _BeforeEnrollmentRecord.SeatNo = null; } else { if (int.TryParse(txtSeatNo.Text, out intSeatNo)) { _BeforeEnrollmentRecord.SeatNo = intSeatNo; } else { epSeatNo.SetError(txtSeatNo, "請填入數字."); return; } } _BeforeEnrollmentRecord.Memo = txtMemo.Text; JHBeforeEnrollment.Update(_BeforeEnrollmentRecord); listener.Reset(); SaveButtonVisible = false; CancelButtonVisible = SaveButtonVisible; prlp.SetAfterSaveText("學校名稱", txtSchool.Text); prlp.SetAfterSaveText("所在地", txtSchoolLocation.Text); prlp.SetAfterSaveText("班級", txtClass.Text); prlp.SetAfterSaveText("座號", txtSeatNo.Text); prlp.SetAfterSaveText("備註", txtMemo.Text); prlp.SetActionBy("學籍", "學生前級畢業資訊"); prlp.SetAction("修改學生前級畢業資訊"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); }
void bkWorkUpgrd_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { PermRecLogProcess prlp = new PermRecLogProcess(); foreach (DataGridViewRow dgv in dgClassUpgrade.Rows) { if (dgv.Cells[5].Value != null) { prlp.SetBeforeSaveText(dgv.Cells[2].Value.ToString() + "班級名稱", dgv.Cells[2].Value.ToString()); prlp.SetAfterSaveText(dgv.Cells[2].Value.ToString() + "班級名稱", dgv.Cells[4].Value.ToString()); prlp.SetBeforeSaveText(dgv.Cells[2].Value.ToString() + "班級年級", dgv.Cells[1].Value.ToString()); prlp.SetAfterSaveText(dgv.Cells[2].Value.ToString() + "班級年級", dgv.Cells[3].Value.ToString()); } } prlp.SetAction("學籍.班級升級"); prlp.SetActionBy("學籍系統", "班級升級或畢業"); prlp.SetDescTitle("班級調整:"); prlp.SaveLog("", "", "", ""); MessageBox.Show("完成"); this.Close(); }
// 儲存資料 protected override void OnSaveButtonClick(EventArgs e) { _PhoneRecord.Permanent = _PermanentPhone = txtEverPhone.Text; _PhoneRecord.Contact = _ContactPhone = txtContactPhone.Text; _PhoneRecord.Cell = _SMS = txtSMS.Text; if (btnOthers.Text.EndsWith("1")) { _OtherPhone1 = txtOtherPhone.Text; } if (btnOthers.Text.EndsWith("2")) { _OtherPhone2 = txtOtherPhone.Text; } if (btnOthers.Text.EndsWith("3")) { _OtherPhone3 = txtOtherPhone.Text; } _PhoneRecord.Phone1 = _OtherPhone1; _PhoneRecord.Phone2 = _OtherPhone2; _PhoneRecord.Phone3 = _OtherPhone3; prlp.SetAfterSaveText("戶籍電話", _PermanentPhone); prlp.SetAfterSaveText("聯絡電話", _ContactPhone); prlp.SetAfterSaveText("行動電話", _SMS); prlp.SetAfterSaveText("其他電話1", _OtherPhone1); prlp.SetAfterSaveText("其他電話2", _OtherPhone2); prlp.SetAfterSaveText("其他電話3", _OtherPhone3); JHSchool.Data.JHPhone.Update(_PhoneRecord); prlp.SetActionBy("學籍", "學生電話資訊"); prlp.SetAction("修改學生電話資訊"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); Student.Instance.SyncDataBackground(PrimaryKey); prlp.SaveLog("", "", "student", PrimaryKey); BindDataToForm(); }
protected override void OnSaveButtonClick(EventArgs e) { if (!IsValid()) { FISCA.Presentation.Controls.MsgBox.Show("輸入資料未通過驗證,請修正後再行儲存"); return; } _ClassRecord.NamingRule = _NamingRule; // 年級 int GrYear; if (int.TryParse(cboGradeYear.Text, out GrYear)) { _ClassRecord.GradeYear = GrYear; } else { _ClassRecord.GradeYear = null; } // 班名轉型 if (ValidateNamingRule(_NamingRule)) { _ClassRecord.Name = ParseClassName(_NamingRule, GrYear); } else { if (ValidClassName(_ClassRecord.ID, txtClassName.Text)) { _ClassRecord.Name = txtClassName.Text; } else { return; } } _ClassRecord.RefTeacherID = ""; // 教師 foreach (KeyValuePair <string, string> val in _TeacherNameDic) { if (val.Value == cboTeacher.Text) { _ClassRecord.RefTeacherID = val.Key; } } _ClassRecord.DisplayOrder = txtSortOrder.Text; SaveButtonVisible = false; CancelButtonVisible = false; // Log prlp.SetAfterSaveText("班級名稱", txtClassName.Text); prlp.SetAfterSaveText("班級命名規則", _ClassRecord.NamingRule); prlp.SetAfterSaveText("年級", cboGradeYear.Text); prlp.SetAfterSaveText("班導師", cboTeacher.Text); prlp.SetAfterSaveText("排列序號", txtSortOrder.Text); prlp.SetActionBy("學籍", "班級基本資料"); prlp.SetAction("修改班級基本資料"); prlp.SetDescTitle("班級名稱:" + _ClassRecord.Name + ","); prlp.SaveLog("", "", "class", PrimaryKey); JHClass.Update(_ClassRecord); Class.Instance.SyncDataBackground(PrimaryKey); }
private void btnSave_Click(object sender, EventArgs e) { dgv.EndEdit(); if (!IsValid()) { return; } try { List <HC.JHSCETakeRecord> sceUpdateList = new List <HC.JHSCETakeRecord>(); List <HC.JHSCETakeRecord> sceInsertList = new List <HC.JHSCETakeRecord>(); List <HC.JHSCETakeRecord> sceDeleteList = new List <HC.JHSCETakeRecord>(); bool scattendNeedSave = false; foreach (DataGridViewRow row in dgv.Rows) { if (row.IsNewRow) { continue; } if ("" + row.Tag == "課程總成績") { #region 課程總成績 if ("" + row.Cells[chScore.Index].Value != "" + _scattend.Score) { scattendNeedSave = true; decimal d; if (decimal.TryParse("" + row.Cells[chScore.Index].Value, out d)) { _scattend.Score = d; } else { _scattend.Score = null; } } //if ("" + row.Cells[chAssignmentScore.Index].Value != "" + _scattend.Effort) //{ // scattendNeedSave = true; // int i; // if (int.TryParse("" + row.Cells[chScore.Index].Value, out i)) // _scattend.Score = i; // else // _scattend.Score = null; //} if ("" + row.Cells[chText.Index].Value != _scattend.Text) { scattendNeedSave = true; _scattend.Text = "" + row.Cells[chText.Index].Value; } #endregion } else if (row.Tag != null) { #region 評量成績記錄的情況 HC.JHSCETakeRecord sce = row.Tag as HC.JHSCETakeRecord; if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value)) { sce.Score = decimal.Parse("" + row.Cells[chScore.Index].Value); } else { sce.Score = null; } if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value)) { sce.AssignmentScore = decimal.Parse("" + row.Cells[chAssignmentScore.Index].Value); } else { sce.AssignmentScore = null; } sce.Text = "" + row.Cells[chText.Index].Value; if (!sce.Score.HasValue && !sce.AssignmentScore.HasValue && string.IsNullOrEmpty(sce.Text)) { sceDeleteList.Add(sce); } else { sceUpdateList.Add(sce); } #endregion } else { #region 無評量成績記錄的情況 bool needsave = false; if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value)) { needsave = true; } if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value)) { needsave = true; } if (!string.IsNullOrEmpty("" + row.Cells[chText.Index].Value)) { needsave = true; } if (needsave) { JHSCETakeRecord jh = new JHSCETakeRecord(); HC.JHSCETakeRecord sce = new HC.JHSCETakeRecord(jh); sce.RefCourseID = _course.ID; sce.RefExamID = "" + row.Cells[chExamName.Index].Tag; sce.RefSCAttendID = _scattend != null ? _scattend.ID : ""; sce.RefStudentID = _student.ID; if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value)) { sce.Score = decimal.Parse("" + row.Cells[chScore.Index].Value); } else { sce.Score = null; } if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value)) { sce.AssignmentScore = decimal.Parse("" + row.Cells[chAssignmentScore.Index].Value); } else { sce.AssignmentScore = null; } sce.Text = "" + row.Cells[chText.Index].Value; sceInsertList.Add(sce); } #endregion } } if (sceUpdateList.Count > 0) { JHSCETake.Update(sceUpdateList.AsJHSCETakeRecords()); } if (sceInsertList.Count > 0) { JHSCETake.Insert(sceInsertList.AsJHSCETakeRecords()); } if (sceDeleteList.Count > 0) { JHSCETake.Delete(sceDeleteList.AsJHSCETakeRecords()); } if (scattendNeedSave) { JHSCAttend.Update(_scattend); } // log 處理 SetSaveDataToLog(); prlp.SetActionBy("學生", "評量成績輸入"); prlp.SetAction("評量成績輸入"); prlp.SetDescTitle(""); prlp.SaveLog("", "", "Student", _student.ID); SetLoadDataToLog(); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MsgBox.Show("儲存失敗。" + ex.Message); } }
protected override void OnSaveButtonClick(EventArgs e) { //// 當輸入沒有 鄰自動補 //if (!string.IsNullOrEmpty(txtArea.Text)) //{ // if (txtArea.Text.IndexOf("鄰") == -1) // txtArea.Text += "鄰"; //} // 檢查畫面儲存相對應 if (_address_type == AddressType.Permanent) { _StudAddressRec.Permanent.ZipCode = txtZipcode.Text; _StudAddressRec.Permanent.County = cboCounty.Text; _StudAddressRec.Permanent.Town = cboTown.Text; _StudAddressRec.Permanent.District = txtDistrict.Text; _StudAddressRec.Permanent.Area = txtArea.Text; _StudAddressRec.Permanent.Detail = txtDetail.Text; _StudAddressRec.Permanent.Longitude = txtLongtitude.Text; _StudAddressRec.Permanent.Latitude = txtLatitude.Text; } if (_address_type == AddressType.Mailing) { _StudAddressRec.Mailing.ZipCode = txtZipcode.Text; _StudAddressRec.Mailing.County = cboCounty.Text; _StudAddressRec.Mailing.Town = cboTown.Text; _StudAddressRec.Mailing.District = txtDistrict.Text; _StudAddressRec.Mailing.Area = txtArea.Text; _StudAddressRec.Mailing.Detail = txtDetail.Text; _StudAddressRec.Mailing.Longitude = txtLongtitude.Text; _StudAddressRec.Mailing.Latitude = txtLatitude.Text; } if (_address_type == AddressType.Other) { _StudAddressRec.Address1.ZipCode = txtZipcode.Text; _StudAddressRec.Address1.County = cboCounty.Text; _StudAddressRec.Address1.Town = cboTown.Text; _StudAddressRec.Address1.District = txtDistrict.Text; _StudAddressRec.Address1.Area = txtArea.Text; _StudAddressRec.Address1.Detail = txtDetail.Text; _StudAddressRec.Address1.Longitude = txtLongtitude.Text; _StudAddressRec.Address1.Latitude = txtLatitude.Text; } prlp.SetAfterSaveText("戶籍郵遞區號", _StudAddressRec.Permanent.ZipCode); prlp.SetAfterSaveText("戶籍縣市", _StudAddressRec.Permanent.County); prlp.SetAfterSaveText("戶籍鄉鎮市區", _StudAddressRec.Permanent.Town); prlp.SetAfterSaveText("戶籍村里", _StudAddressRec.Permanent.District); prlp.SetAfterSaveText("戶籍鄰", _StudAddressRec.Permanent.Area); prlp.SetAfterSaveText("戶籍其它地址", _StudAddressRec.Permanent.Detail); prlp.SetAfterSaveText("戶籍經度", _StudAddressRec.Permanent.Longitude); prlp.SetAfterSaveText("戶籍緯度", _StudAddressRec.Permanent.Latitude); prlp.SetAfterSaveText("聯絡郵遞區號", _StudAddressRec.Mailing.ZipCode); prlp.SetAfterSaveText("聯絡縣市", _StudAddressRec.Mailing.County); prlp.SetAfterSaveText("聯絡鄉鎮市區", _StudAddressRec.Mailing.Town); prlp.SetAfterSaveText("聯絡村里", _StudAddressRec.Mailing.District); prlp.SetAfterSaveText("聯絡鄰", _StudAddressRec.Mailing.Area); prlp.SetAfterSaveText("聯絡其它地址", _StudAddressRec.Mailing.Detail); prlp.SetAfterSaveText("聯絡經度", _StudAddressRec.Mailing.Longitude); prlp.SetAfterSaveText("聯絡緯度", _StudAddressRec.Mailing.Latitude); prlp.SetAfterSaveText("其它郵遞區號", _StudAddressRec.Address1.ZipCode); prlp.SetAfterSaveText("其它縣市", _StudAddressRec.Address1.County); prlp.SetAfterSaveText("其它鄉鎮市區", _StudAddressRec.Address1.Town); prlp.SetAfterSaveText("其它村里", _StudAddressRec.Address1.District); prlp.SetAfterSaveText("其它鄰", _StudAddressRec.Address1.Area); prlp.SetAfterSaveText("其它其它地址", _StudAddressRec.Address1.Detail); prlp.SetAfterSaveText("其它經度", _StudAddressRec.Address1.Longitude); prlp.SetAfterSaveText("其它緯度", _StudAddressRec.Address1.Latitude); _errors.Clear(); JHAddress.Update(_StudAddressRec); prlp.SetActionBy("學籍", "學生地址資訊"); prlp.SetAction("修改學生地址資訊"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); BindDataToForm(); }
// save private void SemesterHistoryDetail_SaveButtonClick(object sender, EventArgs e) { // 資料檢查 foreach (DataGridViewRow row in dataGridViewX1.Rows) { if (row.IsNewRow) { continue; } foreach (DataGridViewCell cell in row.Cells) { if (cell.ErrorText != "") { MsgBox.Show("資料有疑問無法儲存,請檢查標紅色儲存格.", "儲存失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } JHSchool.Data.JHSemesterHistoryRecord updateSemeHsitoryRec = new JHSchool.Data.JHSemesterHistoryRecord(); updateSemeHsitoryRec.RefStudentID = PrimaryKey; foreach (DataGridViewRow row in dataGridViewX1.Rows) { int SchoolYear = 0, Semester = 0, GradeYear = 0, SchoolDayCount = 0, SeatNo = 0; if (row.IsNewRow) { continue; } K12.Data.SemesterHistoryItem shi = new K12.Data.SemesterHistoryItem(); if (row.Cells[colSchoolYear.Index] != null) { int.TryParse("" + row.Cells[colSchoolYear.Index].Value, out SchoolYear); } if (row.Cells[colSemester.Index] != null) { int.TryParse("" + row.Cells[colSemester.Index].Value, out Semester); } if (row.Cells[colGradeYear.Index] != null) { int.TryParse("" + row.Cells[colGradeYear.Index].Value, out GradeYear); } if (row.Cells[colSchoolDayCount.Index] != null) { int.TryParse("" + row.Cells[colSchoolDayCount.Index].Value, out SchoolDayCount); } if (row.Cells[colSeatNo.Index] != null) { int.TryParse("" + row.Cells[colSeatNo.Index].Value, out SeatNo); } shi.SchoolYear = SchoolYear; shi.Semester = Semester; shi.GradeYear = GradeYear; if (row.Cells[colClassName.Index] != null) { shi.ClassName = row.Cells[colClassName.Index].Value + ""; } if (SeatNo == 0) { shi.SeatNo = null; } else { shi.SeatNo = SeatNo; } if (row.Cells[colTeacherName.Index] != null) { shi.Teacher = row.Cells[colTeacherName.Index].Value + ""; } if (SchoolDayCount == 0) { shi.SchoolDayCount = null; } else { shi.SchoolDayCount = SchoolDayCount; } updateSemeHsitoryRec.SemesterHistoryItems.Add(shi); string logIdxStr = shi.SchoolYear + "" + shi.Semester + "_"; prlp.SetAfterSaveText(logIdxStr + "學年度", shi.SchoolYear + ""); prlp.SetAfterSaveText(logIdxStr + "學期", shi.Semester + ""); prlp.SetAfterSaveText(logIdxStr + "年級", shi.GradeYear + ""); prlp.SetAfterSaveText(logIdxStr + "班級", shi.ClassName); prlp.SetAfterSaveText(logIdxStr + "座號", SeatNo + ""); prlp.SetAfterSaveText(logIdxStr + "班導師", shi.Teacher); prlp.SetAfterSaveText(logIdxStr + "上課天數", SchoolDayCount + ""); } JHSchool.Data.JHSemesterHistory.Update(updateSemeHsitoryRec); prlp.SetActionBy("學籍", "學生學期對照表"); prlp.SetAction("修改學生學期對照表"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); this.CancelButtonVisible = false; this.SaveButtonVisible = false; }
protected override void OnSaveButtonClick(EventArgs e) { // 驗證資料 if (string.IsNullOrEmpty(txtName.Text.Trim())) { epName.SetError(txtName, "姓名不可空白!"); return; } // 檢查帳號是否重複 if (_AllLogIDDic.ContainsKey(txtSTLoginAccount.Text)) { if (_AllLogIDDic[txtSTLoginAccount.Text] != _TeacherRec.ID) { epLoginName.SetError(txtSTLoginAccount, "登入帳號重覆!"); return; } } // 檢查姓名+暱稱是否重複 string checkName = txtName.Text + txtNickname.Text; if (_AllTeacherNameDic.ContainsKey(checkName)) { if (_AllTeacherNameDic[checkName] != _TeacherRec.ID) { epName.SetError(txtName, "姓名+暱稱重覆,請檢查!"); epLoginName.SetError(txtNickname, "姓名+暱稱重覆,請檢查!"); return; } } // 檢查身分證號是否重複 if (_AllIDNumberDict.ContainsKey(txtIDNumber.Text)) { if (_TeacherRec.ID != _AllIDNumberDict[txtIDNumber.Text]) { epIDNumber.SetError(txtIDNumber, "身分證號重複,請檢查!"); return; } } // 回填到 DAL _TeacherRec.AccountType = cboAccountType.Text; _TeacherRec.Category = txtCategory.Text; _TeacherRec.ContactPhone = txtPhone.Text; _TeacherRec.Email = txtEmail.Text; _TeacherRec.Gender = cboGender.Text; _TeacherRec.IDNumber = txtIDNumber.Text; _TeacherRec.TALoginName = txtSTLoginAccount.Text; _TeacherRec.Name = txtName.Text; _TeacherRec.Nickname = txtNickname.Text; _TeacherRec.TAPassword = txtSTLoginPwd.Text; // 存檔 JHTeacher.Update(_TeacherRec); // Save Log prlp.SetAfterSaveText("姓名", txtName.Text); prlp.SetAfterSaveText("身分證號", txtIDNumber.Text); prlp.SetAfterSaveText("性別", cboGender.Text); prlp.SetAfterSaveText("暱稱", txtNickname.Text); prlp.SetAfterSaveText("聯絡電話", txtPhone.Text); prlp.SetAfterSaveText("電子信箱", txtEmail.Text); prlp.SetAfterSaveText("教師類別", txtCategory.Text); prlp.SetAfterSaveText("登入帳號", txtSTLoginAccount.Text); prlp.SetAfterSaveText("登入密碼", txtSTLoginPwd.Text); prlp.SetAfterSaveText("帳號類型", cboAccountType.Text); prlp.SetDescTitle("教師姓名:" + txtName.Text + ","); prlp.SetActionBy("學籍", "教師基本資料"); prlp.SetAction("修改教師基本資料"); prlp.SaveLog("", "", "teacher", PrimaryKey); DataBindToForm(); SaveButtonVisible = false; CancelButtonVisible = false; Teacher.Instance.SyncDataBackground(PrimaryKey); Class.Instance.SyncAllBackground(); ClearErrorMessage(); }
protected override void OnSaveButtonClick(EventArgs e) { Errors.Clear(); objStudent = JHSchool.Data.JHStudent.SelectByID(PrimaryKey); if (chkClassName() == false) { Errors.SetError(cboClass, "班級名稱錯誤!"); return; } int tmpSeatNo = 0; int.TryParse(cboSeatNo.Text, out tmpSeatNo); if (tmpSeatNo < 1 && cboSeatNo.Text.Trim() != "") { Errors.SetError(cboSeatNo, "學生座號錯誤!"); return; } // 檢查班級座號是否重複 if (tmpSeatNo > 0) { if (_ClassSeatNoList.Contains(tmpSeatNo)) { // 是否是自己原本座號 if (this._DefaultSeatNo != cboSeatNo.Text.Trim()) { Errors.SetError(cboSeatNo, "座號重複!"); return; } } } // 更改學生班級 if (_ClassNameIDDic.ContainsKey(cboClass.Text)) { objStudent.RefClassID = _ClassNameIDDic[cboClass.Text]; } // 當選空白時 if ((cboClass.Text == "" && cboSeatNo.Text == "") || cboClass.Text == "<空白>") { objStudent.RefClassID = null; } // 檢查學號是否重複 if (txtStudentNumber.Text != this._DefaultStudNum) { // 判斷是否是空 if (string.IsNullOrEmpty(txtStudentNumber.Text)) { objStudent.StudentNumber = ""; } else { // 取得目前學生狀態 JHSchool.Data.JHStudentRecord.StudentStatus studtStatus = JHSchool.Data.JHStudent.SelectByID(PrimaryKey).Status; List <string> checkData = new List <string>(); // 同狀態下學號不能重複 foreach (JHSchool.Data.JHStudentRecord studRec in JHSchool.Data.JHStudent.SelectAll()) { if (studRec.Status == studtStatus) { checkData.Add(studRec.StudentNumber); } } if (checkData.Contains(txtStudentNumber.Text)) { Errors.SetError(txtStudentNumber, "學號重複!"); return; } objStudent.StudentNumber = txtStudentNumber.Text; } } if (tmpSeatNo > 0) { objStudent.SeatNo = tmpSeatNo; } else { objStudent.SeatNo = null; } JHSchool.Data.JHStudent.Update(objStudent); SaveButtonVisible = false; CancelButtonVisible = false; prlp.SetAfterSaveText("班級", cboClass.Text); prlp.SetAfterSaveText("座號", cboSeatNo.Text); prlp.SetAfterSaveText("學號", txtStudentNumber.Text); prlp.SetActionBy("學籍", "學生班級資訊"); prlp.SetAction("修改學生班級資訊"); prlp.SetDescTitle("學生姓名:" + objStudent.Name + ",學號:" + objStudent.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); this._DefaultClassName = cboClass.Text; this._DefaultSeatNo = cboSeatNo.Text; this._DefaultStudNum = txtStudentNumber.Text; Student.Instance.SyncDataBackground(PrimaryKey); reloadChkdData(); }
protected override void OnSaveButtonClick(EventArgs e) { Errors.Clear(); objStudent = JHSchool.Data.JHStudent.SelectByID(PrimaryKey); // 檢查學號是否重複 if (txtStudentNumber.Text != this._DefaultStudNum) { // 判斷是否是空 if (string.IsNullOrEmpty(txtStudentNumber.Text)) { objStudent.StudentNumber = ""; } else { // 取得目前學生狀態 JHStudentRecord.StudentStatus studtStatus = JHSchool.Data.JHStudent.SelectByID(PrimaryKey).Status; List <string> checkData = new List <string>(); // 同狀態下學號不能重複 foreach (JHSchool.Data.JHStudentRecord studRec in JHSchool.Data.JHStudent.SelectAll()) { if (studRec.Status == studtStatus) { checkData.Add(studRec.StudentNumber); } } if (checkData.Contains(txtStudentNumber.Text)) { Errors.SetError(txtStudentNumber, "學號重複!"); return; } objStudent.StudentNumber = txtStudentNumber.Text; } } JHStudent.Update(objStudent); SaveButtonVisible = false; CancelButtonVisible = false; prlp.SetAfterSaveText("班級", lblClassName.Text); prlp.SetAfterSaveText("座號", lblSeatNo.Text); prlp.SetAfterSaveText("學號", txtStudentNumber.Text); prlp.SetActionBy("學籍", "學生班級資訊"); prlp.SetAction("修改學生班級資訊"); prlp.SetDescTitle("學生姓名:" + objStudent.Name + ",學號:" + objStudent.StudentNumber + ","); prlp.SaveLog("", "", "student", PrimaryKey); this._DefaultClassName = lblClassName.Text; this._DefaultSeatNo = lblSeatNo.Text; this._DefaultStudNum = txtStudentNumber.Text; // Student.Instance.SyncDataBackground(PrimaryKey); reloadChkdData(); }
protected override void OnSaveButtonClick(EventArgs e) { // 回存資料 if (_ParentType == ParentType.Guardian) { _StudParentRec.Custodian.EducationDegree = cboEduDegree.Text; _StudParentRec.Custodian.IDNumber = txtIDNumber.Text; _StudParentRec.Custodian.Job = cboJob.Text; _StudParentRec.Custodian.Name = txtParentName.Text; _StudParentRec.Custodian.Nationality = cboNationality.Text; _StudParentRec.Custodian.Phone = txtParentPhone.Text; _StudParentRec.Custodian.Relationship = cboRelationship.Text; _StudParentRec.Custodian.EMail = txtEMail.Text; } if (_ParentType == ParentType.Father) { _StudParentRec.Father.EducationDegree = cboEduDegree.Text; _StudParentRec.Father.IDNumber = txtIDNumber.Text; _StudParentRec.Father.Job = cboJob.Text; _StudParentRec.Father.Living = cboAlive.Text; _StudParentRec.Father.Name = txtParentName.Text; _StudParentRec.Father.Nationality = cboNationality.Text; _StudParentRec.Father.Phone = txtParentPhone.Text; _StudParentRec.Father.EMail = txtEMail.Text; } if (_ParentType == ParentType.Mother) { _StudParentRec.Mother.EducationDegree = cboEduDegree.Text; _StudParentRec.Mother.IDNumber = txtIDNumber.Text; _StudParentRec.Mother.Job = cboJob.Text; _StudParentRec.Mother.Living = cboAlive.Text; _StudParentRec.Mother.Name = txtParentName.Text; _StudParentRec.Mother.Nationality = cboNationality.Text; _StudParentRec.Mother.Phone = txtParentPhone.Text; _StudParentRec.Mother.EMail = txtEMail.Text; } prlp.SetAfterSaveText("父親姓名", _StudParentRec.Father.Name); prlp.SetAfterSaveText("父親身分證號", _StudParentRec.Father.IDNumber); prlp.SetAfterSaveText("父親電話", _StudParentRec.Father.Phone); prlp.SetAfterSaveText("父親存歿", _StudParentRec.Father.Living); prlp.SetAfterSaveText("父親國籍", _StudParentRec.Father.Nationality); prlp.SetAfterSaveText("父親職業", _StudParentRec.Father.Job); prlp.SetAfterSaveText("父親最高學歷", _StudParentRec.Father.EducationDegree); prlp.SetAfterSaveText("父親電子郵件", _StudParentRec.Father.EMail); prlp.SetAfterSaveText("母親姓名", _StudParentRec.Mother.Name); prlp.SetAfterSaveText("母親身分證號", _StudParentRec.Mother.IDNumber); prlp.SetAfterSaveText("母親電話", _StudParentRec.Mother.Phone); prlp.SetAfterSaveText("母親存歿", _StudParentRec.Mother.Living); prlp.SetAfterSaveText("母親國籍", _StudParentRec.Mother.Nationality); prlp.SetAfterSaveText("母親職業", _StudParentRec.Mother.Job); prlp.SetAfterSaveText("母親最高學歷", _StudParentRec.Mother.EducationDegree); prlp.SetAfterSaveText("母親電子郵件", _StudParentRec.Mother.EMail); prlp.SetAfterSaveText("監護人姓名", _StudParentRec.Custodian.Name); prlp.SetAfterSaveText("監護人身分證號", _StudParentRec.Custodian.IDNumber); prlp.SetAfterSaveText("監護人電話", _StudParentRec.Custodian.Phone); prlp.SetAfterSaveText("監護人關係", _StudParentRec.Custodian.Relationship); prlp.SetAfterSaveText("監護人國籍", _StudParentRec.Custodian.Nationality); prlp.SetAfterSaveText("監護人職業", _StudParentRec.Custodian.Job); prlp.SetAfterSaveText("監護人最高學歷", _StudParentRec.Custodian.EducationDegree); prlp.SetAfterSaveText("監護人電子郵件", _StudParentRec.Custodian.EMail); JHParent.Update(_StudParentRec); prlp.SetActionBy("學籍", "學生父母及監護人資訊"); prlp.SetAction("修改學生父母及監護人資訊"); JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey); prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ","); //Student.Instance.SyncDataBackground(PrimaryKey); Program.CustodianField.Reload(); prlp.SaveLog("", "", "student", PrimaryKey); BindDataToForm(); }