private void button_OnOK_Click(object sender, EventArgs e) { this.userControl_StudentBase1.FillClass(); String str_ErrMessage; str_ErrMessage = this.myClass_Student.CheckField(); if (str_ErrMessage != null) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = str_ErrMessage; return; } if (this.bool_Add) { if (Class_Student.ExistSecond(this.myClass_Student.IssueNo, this.myClass_Student.IdentificationCard, null, Enum_zwjKindofUpdate.Add)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "身份证号码不能重复!"; return; } else { if (!this.myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add)) { this.label_ErrMessage.Text = "添加不成功,可能是考编号重复!"; this.DialogResult = DialogResult.None; return; } else { if (this.checkBox_Continuous.Checked) { EventArgs_Issue my_e = new EventArgs_Issue(this.myClass_Student.IssueNo, false); Publisher_Issue.OnEventName(my_e); this.label_ErrMessage.Text = ""; this.DialogResult = DialogResult.None; return; } else { this.DialogResult = DialogResult.OK; return; } } } } else { if (Class_Student.ExistSecond(this.myClass_Student.IssueNo, this.myClass_Student.IdentificationCard, this.myClass_Student.ExaminingNo, Enum_zwjKindofUpdate.Modify)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "身份证号码不能重复!"; return; } else { this.myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Modify); } } }
private void button_OnOK_Click(object sender, EventArgs e) { if (this.myDataTable == null) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "没有添加焊工!"; return; } string str_ErrMessage; Class_Student myClass_Student; foreach (DataRow myDataRow in this.myDataTable.Rows) { myDataRow["WelderRemark"] = ""; myClass_Student = new Class_Student(); myClass_Student.IssueNo = this.str_IssueNo; this.FillWeldingParameterClass(myClass_Student.myClass_WeldingParameter); myClass_Student.IdentificationCard = myDataRow["IdentificationCard"].ToString(); myClass_Student.ExamStatus = "顺利考试"; myClass_Student.SubjectID = this.TextBox_SubjectID.Text; if (Class_Student.ExistSecond(myClass_Student.IssueNo, myClass_Student.IdentificationCard, null, Enum_zwjKindofUpdate.Add)) { myDataRow["WelderRemark"] = "身份证号码不能重复!"; } else { str_ErrMessage = myClass_Student.CheckField(); if (string.IsNullOrEmpty(str_ErrMessage)) { if (!myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add)) { myDataRow["WelderRemark"] = "添加不成功,可能是考编号重复!"; } else { this.bool_Updated = true; } } else { myDataRow["WelderRemark"] = str_ErrMessage; } } } DataRow[] myDataRowRange = this.myDataTable.Select("WelderRemark = '' or WelderRemark is null"); if (myDataRowRange.Length < this.myDataTable.Rows.Count) { this.label_ErrMessage.Text = "有数据不合法!请查看备注信息"; this.DialogResult = DialogResult.None; } foreach (DataRow myDataRow in myDataRowRange) { myDataRow.Delete(); } this.myDataTable.AcceptChanges(); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_Template"></param> /// <param name="bool_Add"></param> public void InitControl(Class_ReviveQC myClass_ReviveQC, bool bool_Add) { Class_Public.InitializeComboBox(this.ComboBox_ExamStatus, Enum_DataTable.ExamStatus.ToString(), "ExamStatus", "ExamStatus"); Class_Public.InitializeComboBox(this.comboBox_Flaw, Enum_DataTableSecond.Flaw.ToString(), "Flaw", "Flaw"); this.ComboBox_ExamStatus.SelectedValue = "顺利考试"; this.comboBox_Flaw.SelectedValue = "-"; this.myClass_ReviveQC = myClass_ReviveQC; if (bool_Add) { this.button_StudentQuery.Visible = true; this.myClass_QC = new Class_QC(); if (myClass_ReviveQCDefault != null) { if (myClass_ReviveQCDefault.SkillTeacherID != null) { Class_CustomUser myClass_CustomUser = new Class_CustomUser(); myClass_CustomUser.UserGUID = myClass_ReviveQCDefault.SkillTeacherID; if (myClass_CustomUser.FillData()) { this.textBox_SkillTeacher.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } } if (myClass_ReviveQCDefault.SkillExamDate > DateTime.MinValue) { this.dateTimePicker_SkillExamDate.Value = myClass_ReviveQCDefault.SkillExamDate; } } } else { this.button_StudentQuery.Visible = false; Class_Student myClass_Student = new Class_Student(this.myClass_ReviveQC.ExaminingNo); this.InitControlStudent(myClass_Student); this.textBox_ReviveQCID.Text = this.myClass_ReviveQC.ReviveQCID.ToString(); Class_CustomUser myClass_CustomUser = new Class_CustomUser(); myClass_CustomUser.UserGUID = this.myClass_ReviveQC.SkillTeacherID; if (myClass_CustomUser.FillData()) { this.textBox_SkillTeacher.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } this.dateTimePicker_SkillExamDate.Value = this.myClass_ReviveQC.SkillExamDate; this.ComboBox_ExamStatus.SelectedValue = this.myClass_ReviveQC.ExamStatus; this.comboBox_Flaw.SelectedValue = this.myClass_ReviveQC.Flaw; this.textBox_ReviveQCRemark.Text = this.myClass_ReviveQC.ReviveQCRemark; this.CheckBox_isPassed.Checked = this.myClass_ReviveQC.isPassed; this.checkBox_FaceDT.Checked = this.myClass_ReviveQC.FaceDT; this.checkBox_RT.Checked = this.myClass_ReviveQC.RT; this.checkBox_BendDT.Checked = this.myClass_ReviveQC.BendDT; this.checkBox_DisjunctionDT.Checked = this.myClass_ReviveQC.DisjunctionDT; this.checkBox_MacroExamination.Checked = this.myClass_ReviveQC.MacroExamination; this.checkBox_Impact.Checked = this.myClass_ReviveQC.Impact; this.checkBox_OtherDT.Checked = this.myClass_ReviveQC.OtherDT; this.checkBox_UT.Checked = this.myClass_ReviveQC.UT; } }
public void InitControlStudent(Class_Student myClass_Student) { Class_Welder myClass_Welder = new Class_Welder(myClass_Student.IdentificationCard); this.TextBox_Welder.Text = string.Format("{0},{1},{2},{3}", myClass_Welder.WelderName, myClass_Welder.IdentificationCard, myClass_Welder.Sex, myClass_Welder.WelderEnglishName); Class_Employer myClass_Employer = new Class_Employer(myClass_Welder.myClass_BelongUnit.EmployerHPID); Class_Department myClass_Department = new Class_Department(myClass_Welder.myClass_BelongUnit.DepartmentHPID); Class_WorkPlace myClass_WorkPlace = new Class_WorkPlace(myClass_Welder.myClass_BelongUnit.WorkPlaceHPID); Class_LaborServiceTeam myClass_LaborServiceTeam = new Class_LaborServiceTeam(myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID); this.TextBox_Employer.Text = string.Format("{0}->{1}->{2},{3}", myClass_Employer.Employer, myClass_Department.Department, myClass_WorkPlace.WorkPlace, myClass_LaborServiceTeam.LaborServiceTeam); this.TextBox_WorkerID.Text = myClass_Welder.myClass_BelongUnit.WorkerID; this.TextBox_Schooling.Text = myClass_Welder.Schooling; this.textBox_WeldingBeginning.Text = myClass_Welder.WeldingBeginning.ToShortDateString(); Class_Issue myClass_Issue = new Class_Issue(myClass_Student.IssueNo); Class_WeldingSubject myClass_WeldingSubject = new Class_WeldingSubject(myClass_Student.SubjectID); this.textBox_ExaminingNo.Text = myClass_Student.ExaminingNo; this.textBox_IssueNo.Text = myClass_Student.IssueNo; this.textBox_TheoryResult.Text = string.Format("{0}/{1}", myClass_Student.TheoryResult, myClass_Student.TheoryMakeupResult); this.textBox_SkillResult.Text = string.Format("{0}/{1}", myClass_Student.SkillResult ? "√" : "×", myClass_Student.SkillMakeupResult ? "√" : "×"); this.textBox_WeldingProcess.Text = string.Format("{0}({1},{2},{3})", myClass_Issue.WeldingProcessAb, myClass_Student.myClass_WeldingParameter.Material, myClass_Student.myClass_WeldingParameter.WeldingConsumable, myClass_Student.myClass_WeldingParameter.Assemblage); this.TextBox_Subject.Text = string.Format("{0},{1},{2},{3},{4}({5})", myClass_WeldingSubject.Subject, myClass_WeldingSubject.WeldingClass, myClass_WeldingSubject.JointType, myClass_WeldingSubject.WorkPieceType, myClass_WeldingSubject.WeldingProject, myClass_WeldingSubject.SubjectID); this.TextBox_Thickness.Text = myClass_Student.myClass_WeldingParameter.Thickness.ToString(); this.TextBox_ExternalDiameter.Text = myClass_Student.myClass_WeldingParameter.ExternalDiameter.ToString(); this.TextBox_StudentRemark.Text = myClass_Student.StudentRemark; this.myClass_QC = new Class_QC(myClass_Student.ExaminingNo); this.textBox_CertificateNo.Text = myClass_QC.CertificateNo; this.textBox_IssuedOn.Text = myClass_QC.IssuedOn.ToShortDateString(); if ((int)this.NumericUpDown_OriginalPeriod.Minimum <= myClass_QC.OriginalPeriod && (int)this.NumericUpDown_OriginalPeriod.Maximum >= myClass_QC.OriginalPeriod) { this.NumericUpDown_OriginalPeriod.Value = myClass_QC.OriginalPeriod; } if ((int)this.numericUpDown_PeriodofProlongation.Minimum <= myClass_QC.PeriodofProlongation && (int)this.numericUpDown_PeriodofProlongation.Maximum >= myClass_QC.PeriodofProlongation) { this.numericUpDown_PeriodofProlongation.Value = myClass_QC.PeriodofProlongation; } if ((int)this.numericUpDown_SupervisionCycle.Minimum <= myClass_QC.SupervisionCycle && (int)this.numericUpDown_SupervisionCycle.Maximum >= myClass_QC.SupervisionCycle) { this.numericUpDown_SupervisionCycle.Value = myClass_QC.SupervisionCycle; } this.TextBox_QCRemark.Text = myClass_QC.QCRemark; this.checkBox_isQCValid.Checked = myClass_QC.isQCValid; this.checkBox_SupervisionFirst.Checked = myClass_QC.SupervisionFirst; this.checkBox_SupervisionSecond.Checked = myClass_QC.SupervisionSecond; this.checkBox_SupervisionThird.Checked = myClass_QC.SupervisionThird; this.checkBox_SupervisionFourth.Checked = myClass_QC.SupervisionFourth; this.checkBox_SupervisionFifth.Checked = myClass_QC.SupervisionFifth; this.checkBox_SupervisionSixth.Checked = myClass_QC.SupervisionSixth; this.checkBox_SupervisionSeventh.Checked = myClass_QC.SupervisionSeventh; this.checkBox_SupervisionEighth.Checked = myClass_QC.SupervisionEighth; }
private void Form_QC_Update_Load(object sender, EventArgs e) { if (this.bool_Add) { if (Class_QC.ExistAndCanDeleteAndDelete(myClass_QC.ExaminingNo, Enum_zwjKindofUpdate.Exist)) { MessageBox.Show("已存在证书,不能添加!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } else { Class_Student myClass_Student = new Class_Student(); myClass_Student.ExaminingNo = this.myClass_QC.ExaminingNo; if (myClass_Student.FillData()) { if (!myClass_Student.isPassed) { MessageBox.Show("该学员不合格!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } } else { MessageBox.Show("不存在该项,可能已删除!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } } } else { if (!Class_QC.ExistAndCanDeleteAndDelete(myClass_QC.ExaminingNo, Enum_zwjKindofUpdate.Exist)) { MessageBox.Show("不存在该项,可能已删除!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } } this.label_ErrMessage.Text = ""; if (!Class_zwjPublic.myBackColor.IsEmpty) { this.BackColor = Class_zwjPublic.myBackColor; } this.userControl_QCBase1.InitControl(this.myClass_QC, this.bool_Add); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_Student"></param> /// <param name="bool_Add"></param> public void InitControl(Class_Student myClass_Student, bool bool_Add) { Class_Public.InitializeComboBox(this.ComboBox_Assemblage, Enum_DataTable.Assemblage.ToString(), "Assemblage", "Assemblage"); Class_Public.InitializeComboBox(this.ComboBox_KindofExam, Enum_DataTable.KindofExam.ToString(), "KindofExam", "KindofExam"); Class_Public.InitializeComboBox(this.ComboBox_WeldingProcess, Enum_DataTable.WeldingProcess.ToString(), "WeldingProcessAb", "WeldingProcess"); Class_Public.InitializeComboBox(this.ComboBox_ExamStatus, Enum_DataTable.ExamStatus.ToString(), "ExamStatus", "ExamStatus"); this.ComboBox_ExamStatus.SelectedValue = "顺利考试"; this.TextBox_IssueNo.Text = myClass_Student.IssueNo; Class_Issue myClass_Issue = new Class_Issue(myClass_Student.IssueNo); this.ComboBox_WeldingProcess.SelectedValue = myClass_Issue.WeldingProcessAb; this.myClass_Student = myClass_Student; if (bool_Add) { Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb); if (myClass_ShipClassification.ShipRestrict) { Class_Ship myClass_Ship = new Class_Ship(myClass_Issue.ShipboardNo); this.MaskedTextBox_ExaminingNo.Text = myClass_Ship.NextSkillExaminingNo; } else { this.MaskedTextBox_ExaminingNo.Text = myClass_ShipClassification.NextExaminingNo; } if (myClass_StudentDefault != null) { this.InitControlWeldingSubject(new Class_WeldingSubject(myClass_StudentDefault.SubjectID)); } this.InitControlWeldingParameter(myClass_Issue.myClass_WeldingParameter); } else { this.TextBox_StudentRemark.Text = myClass_Student.StudentRemark; this.textBox_WPSNo.Text = myClass_Student.WPSNo; this.MaskedTextBox_ExaminingNo.Text = this.myClass_Student.ExaminingNo; this.ComboBox_ExamStatus.SelectedValue = this.myClass_Student.ExamStatus; this.NumericUpDown_TheoryResult.Value = this.myClass_Student.TheoryResult; this.NumericUpDown_TheoryMakeupResult.Value = this.myClass_Student.TheoryMakeupResult; this.CheckBox_SkillResult.Checked = this.myClass_Student.SkillResult; this.CheckBox_SkillMakeupResult.Checked = this.myClass_Student.SkillMakeupResult; this.InitControlWeldingParameter(this.myClass_Student.myClass_WeldingParameter); this.InitControlWelder(new Class_Welder(this.myClass_Student.IdentificationCard)); this.InitControlWeldingSubject(new Class_WeldingSubject(this.myClass_Student.SubjectID)); } }
private void Form_Student_Update_Load(object sender, EventArgs e) { if (!(this.bool_Add || Class_Student.ExistAndCanDeleteAndDelete(myClass_Student.ExaminingNo, Enum_zwjKindofUpdate.Exist))) { MessageBox.Show("不存在该项,可能已删除!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } this.label_ErrMessage.Text = ""; if (!Class_zwjPublic.myBackColor.IsEmpty) { this.BackColor = Class_zwjPublic.myBackColor; } this.checkBox_Continuous.Visible = this.bool_Add; this.userControl_StudentBase1.InitControl(this.myClass_Student, this.bool_Add); }
/// <summary> /// 更新数据到对象中 /// </summary> public void FillClass() { this.FillWeldingParameterClass(this.myClass_Student.myClass_WeldingParameter); myClass_Student.IdentificationCard = this.MaskedTextBox_IdentificationCard.Text; myClass_Student.ExamStatus = this.ComboBox_ExamStatus.SelectedValue.ToString(); myClass_Student.SubjectID = this.TextBox_SubjectID.Text; myClass_Student.TheoryResult = (int)this.NumericUpDown_TheoryResult.Value; myClass_Student.TheoryMakeupResult = (int)this.NumericUpDown_TheoryMakeupResult.Value; myClass_Student.SkillResult = this.CheckBox_SkillResult.Checked; myClass_Student.SkillMakeupResult = this.CheckBox_SkillMakeupResult.Checked; myClass_Student.StudentRemark = this.TextBox_StudentRemark.Text; myClass_Student.WPSNo = this.textBox_WPSNo.Text; if (myClass_StudentDefault == null) { myClass_StudentDefault = new Class_Student(); } myClass_StudentDefault.SubjectID = myClass_Student.SubjectID; }
private void button_StudentQuery_Click(object sender, EventArgs e) { string str_ExaminingNo = ""; Form_InputBox myForm = new Form_InputBox(); myForm.str_DefaultResponse = this.textBox_ExaminingNo.Text; myForm.str_Prompt = "请输入考试编号:"; myForm.str_Title = "输入考试编号"; if (myForm.ShowDialog() == DialogResult.OK) { str_ExaminingNo = myForm.str_DefaultResponse; } else { return; } Class_QC myClass_QC = new Class_QC(); myClass_QC.ExaminingNo = str_ExaminingNo; if (myClass_QC.FillData()) { if (myClass_QC.ValidUntil > DateTime.Today) { Class_Student myClass_Student = new Class_Student(str_ExaminingNo); this.InitControlStudent(myClass_Student); } else { MessageBox.Show(string.Format("考试编号为“{0}”的焊工证书已过有效期,不能重新启用!", str_ExaminingNo)); } } else { MessageBox.Show(string.Format("没有找到考试编号为“{0}”焊工证书!", str_ExaminingNo)); } }
private void button_OnOK_Click(object sender, EventArgs e) { this.CheckData_DataTable(); if (this.myDataTable.Select("Len(ErrMessage)>0").Length > 0) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "有数据不合法,请查看 ErrMessage 字段返回信息! "; return; } else { if (MessageBox.Show("确认导入吗?", "确认窗口", MessageBoxButtons.OKCancel) != DialogResult.OK) { this.DialogResult = DialogResult.None; return; } } Class_Welder myClass_Welder; Class_Student myClass_Student; Class_Issue myClass_Issue = new Class_Issue(this.str_IssueNo); //string str_ErrMessage; bool bool_WelderFilled; foreach (DataRow myDataRow in this.myDataTable.Rows) { //myDataRow["ErrMessage"] = ""; //str_ErrMessage = ""; myClass_Welder = new Class_Welder(); myClass_Welder.IdentificationCard = myDataRow["IdentificationCard"].ToString().Trim(); bool_WelderFilled = myClass_Welder.FillData(); myClass_Welder.WelderName = myDataRow["WelderName"].ToString().Trim(); myClass_Welder.Schooling = myDataRow["Schooling"].ToString().Trim(); myClass_Welder.Sex = myDataRow["Sex"].ToString().Trim(); DateTime.TryParse(myDataRow["WeldingBeginning"].ToString().Trim(), out myClass_Welder.WeldingBeginning); myClass_Welder.myClass_BelongUnit.WorkerID = myDataRow["WelderWorkerID"].ToString().Trim(); myClass_Welder.myClass_BelongUnit.EmployerHPID = myDataRow["WelderEmployerHPID"].ToString(); myClass_Welder.myClass_BelongUnit.DepartmentHPID = myDataRow["WelderDepartmentHPID"].ToString(); myClass_Welder.myClass_BelongUnit.WorkPlaceHPID = myDataRow["WelderWorkPlaceHPID"].ToString(); myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID = myDataRow["WelderLaborServiceTeamHPID"].ToString(); //str_ErrMessage = myClass_Welder.CheckField(); //if (!string.IsNullOrEmpty(str_ErrMessage)) //{ // myDataRow["ErrMessage"] = str_ErrMessage; // continue; //} if (bool_WelderFilled) { myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Modify); } else { myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Add); } myClass_Student = new Class_Student(); myClass_Student.IdentificationCard = myClass_Welder.IdentificationCard; myClass_Student.IssueNo = this.str_IssueNo; myClass_Student.SubjectID = myDataRow["ExamSubjectID"].ToString().Trim(); myClass_Student.ExamStatus = "顺利考试"; myClass_Student.myClass_WeldingParameter = myClass_Issue.myClass_WeldingParameter; myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add); //str_ErrMessage = myClass_Student.CheckField(); //if (!string.IsNullOrEmpty(str_ErrMessage)) //{ // myDataRow["ErrMessage"] = str_ErrMessage; // continue; //} } this.DialogResult = DialogResult.OK; this.Close(); }
private void CheckData_DataTable() { Class_Welder myClass_Welder; Class_Student myClass_Student; Class_Issue myClass_Issue = new Class_Issue(this.str_IssueNo); string str_ErrMessage; foreach (DataRow myDataRow in this.myDataTable.Rows) { myDataRow["ErrMessage"] = ""; str_ErrMessage = ""; myClass_Welder = new Class_Welder(); myClass_Welder.IdentificationCard = myDataRow["IdentificationCard"].ToString().Trim(); myClass_Welder.WelderName = myDataRow["WelderName"].ToString().Trim(); myClass_Welder.Schooling = myDataRow["Schooling"].ToString().Trim(); myClass_Welder.Sex = myDataRow["Sex"].ToString().Trim(); DateTime.TryParse(myDataRow["WeldingBeginning"].ToString().Trim(), out myClass_Welder.WeldingBeginning); myClass_Welder.myClass_BelongUnit.WorkerID = myDataRow["WelderWorkerID"].ToString().Trim(); //myClass_Welder.myClass_BelongUnit.EmployerHPID = Class_Employer.GetEmployerHPID(myDataRow["WelderBelongEmployer"].ToString()); myClass_Welder.myClass_BelongUnit.EmployerHPID = Class_Employer.GetEmployerHPIDbyDataTable(myDataRow["WelderEmployer"].ToString().Trim()); myDataRow["WelderEmployerHPID"] = myClass_Welder.myClass_BelongUnit.EmployerHPID; if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.EmployerHPID)) { str_ErrMessage = "公司数据有误!"; } else { if (!string.IsNullOrEmpty(myDataRow["WelderDepartment"].ToString().Trim())) { //myClass_Welder.myClass_BelongUnit.DepartmentHPID = Class_Department.GetDepartmentHPID(myClass_Welder.myClass_BelongUnit.EmployerHPID, myDataRow["WelderBelongDepartment"].ToString()); myClass_Welder.myClass_BelongUnit.DepartmentHPID = Class_Department.GetDepartmentHPIDbyDataTable(myClass_Welder.myClass_BelongUnit.EmployerHPID, myDataRow["WelderDepartment"].ToString().Trim()); myDataRow["WelderDepartmentHPID"] = myClass_Welder.myClass_BelongUnit.DepartmentHPID; if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.DepartmentHPID)) { str_ErrMessage = "部门数据有误!"; } else { if (!string.IsNullOrEmpty(myDataRow["WelderWorkPlace"].ToString().Trim())) { //myClass_Welder.myClass_BelongUnit.WorkPlaceHPID = Class_WorkPlace.GetWorkPlaceHPID(myClass_Welder.myClass_BelongUnit.DepartmentHPID, myDataRow["WelderBelongWorkPlace"].ToString()); myClass_Welder.myClass_BelongUnit.WorkPlaceHPID = Class_WorkPlace.GetWorkPlaceHPIDbyDataTable(myClass_Welder.myClass_BelongUnit.DepartmentHPID, myDataRow["WelderWorkPlace"].ToString().Trim()); myDataRow["WelderWorkPlaceHPID"] = myClass_Welder.myClass_BelongUnit.WorkPlaceHPID; if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.WorkPlaceHPID)) { str_ErrMessage = "作业区数据有误!"; } } } } if (!string.IsNullOrEmpty(myDataRow["WelderLaborServiceTeam"].ToString().Trim())) { //myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID = Class_LaborServiceTeam.GetLaborServiceTeamHPID(myClass_Welder.myClass_BelongUnit.EmployerHPID, myDataRow["WelderBelongLaborServiceTeam"].ToString()); myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID = Class_LaborServiceTeam.GetLaborServiceTeamHPIDbyDataTable(myClass_Welder.myClass_BelongUnit.EmployerHPID, myDataRow["WelderLaborServiceTeam"].ToString().Trim()); myDataRow["WelderLaborServiceTeamHPID"] = myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID; if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID)) { str_ErrMessage = "劳务队数据有误!"; } } } if (!string.IsNullOrEmpty(str_ErrMessage)) { myDataRow["ErrMessage"] = str_ErrMessage; continue; } else { str_ErrMessage = myClass_Welder.CheckField(); if (!string.IsNullOrEmpty(str_ErrMessage)) { myDataRow["ErrMessage"] = str_ErrMessage; continue; } string str_WelderName_Temp = Class_Welder.GetWelderName(myClass_Welder.IdentificationCard); if (!string.IsNullOrEmpty(str_WelderName_Temp) && str_WelderName_Temp != myClass_Welder.WelderName) { myDataRow["ErrMessage"] = "姓名与数据库中该焊工不符!"; continue; } } myClass_Student = new Class_Student(); myClass_Student.IdentificationCard = myClass_Welder.IdentificationCard; myClass_Student.IssueNo = this.str_IssueNo; myClass_Student.SubjectID = myDataRow["ExamSubjectID"].ToString().Trim(); myClass_Student.ExamStatus = "顺利考试"; myClass_Student.myClass_WeldingParameter = myClass_Issue.myClass_WeldingParameter; str_ErrMessage = myClass_Student.CheckField(); if (!string.IsNullOrEmpty(str_ErrMessage)) { myDataRow["ErrMessage"] = str_ErrMessage; continue; } } }
private void button_OnOK_Click(object sender, EventArgs e) { this.CheckData_DataTable(); if (this.myDataTable.Select("Len(ErrMessage)>0").Length > 0) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "有数据不合法,请查看 ErrMessage 字段返回信息! "; return; } else { if (MessageBox.Show("确认导入吗?", "确认窗口", MessageBoxButtons.OKCancel) != DialogResult.OK) { this.DialogResult = DialogResult.None; return; } } Class_Welder myClass_Welder; Class_Student myClass_Student; Class_Issue myClass_Issue; //string str_ErrMessage; bool bool_WelderFilled; foreach (DataRow myDataRow in this.myDataTable.Rows) { //myDataRow["ErrMessage"] = ""; //str_ErrMessage = ""; myClass_Issue = new Class_Issue(myDataRow["IssueNo"].ToString().Trim()); myClass_Welder = new Class_Welder(); myClass_Welder.IdentificationCard = myDataRow["IdentificationCard"].ToString().Trim(); bool_WelderFilled = myClass_Welder.FillData(); myClass_Welder.WelderName = myDataRow["WelderName"].ToString().Trim(); myClass_Welder.Schooling = myDataRow["Schooling"].ToString().Trim(); myClass_Welder.Sex = myDataRow["Sex"].ToString().Trim(); DateTime.TryParse(myDataRow["WeldingBeginning"].ToString().Trim(), out myClass_Welder.WeldingBeginning); myClass_Welder.myClass_BelongUnit.WorkerID = myDataRow["WelderWorkerID"].ToString().Trim(); myClass_Welder.myClass_BelongUnit.EmployerHPID = myDataRow["WelderEmployerHPID"].ToString(); myClass_Welder.myClass_BelongUnit.DepartmentHPID = myDataRow["WelderDepartmentHPID"].ToString(); myClass_Welder.myClass_BelongUnit.WorkPlaceHPID = myDataRow["WelderWorkPlaceHPID"].ToString(); myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID = myDataRow["WelderLaborServiceTeamHPID"].ToString(); //str_ErrMessage = myClass_Welder.CheckField(); //if (!string.IsNullOrEmpty(str_ErrMessage)) //{ // myDataRow["ErrMessage"] = str_ErrMessage; // continue; //} if (bool_WelderFilled) { myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Modify); } else { myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Add); } Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb); if (!Class_TestCommitteeRegistrationNo.ExistSecond(myClass_ShipClassification.TestCommitteeID, myClass_Welder.IdentificationCard, Enum_zwjKindofUpdate.Exist)) { Class_TestCommittee myClass_TestCommittee = new Class_TestCommittee(myClass_ShipClassification.TestCommitteeID); if (System.Text.RegularExpressions.Regex.IsMatch(myDataRow["RegistrationNo"].ToString().Trim(), myClass_TestCommittee.RegistrationNoRegex)) { myClass_TestCommittee.NextRegistrationNo = myDataRow["RegistrationNo"].ToString().Trim(); myClass_TestCommittee.AddAndModify(Enum_zwjKindofUpdate.Modify); } } myClass_ShipClassification.NextExaminingNo = myDataRow["ExaminingNo"].ToString().Trim(); myClass_ShipClassification.NextCertificateNo = myDataRow["CertificateNo"].ToString().Trim(); myClass_ShipClassification.AddAndModify(Enum_zwjKindofUpdate.Modify); myClass_Student = new Class_Student(); myClass_Student.IdentificationCard = myClass_Welder.IdentificationCard; myClass_Student.IssueNo = myClass_Issue.IssueNo; myClass_Student.SubjectID = myDataRow["ExamSubjectID"].ToString().Trim(); myClass_Student.ExamStatus = "顺利考试"; int.TryParse(myDataRow["TheoryResult"].ToString(), out myClass_Student.TheoryResult); myClass_Student.SkillResult = true; myClass_Student.myClass_WeldingParameter = myClass_Issue.myClass_WeldingParameter; if (!string.IsNullOrEmpty(myDataRow["StudentMaterial"].ToString().Trim())) { myClass_Student.myClass_WeldingParameter.Material = myDataRow["StudentMaterial"].ToString().Trim(); } if (!string.IsNullOrEmpty(myDataRow["StudentWeldingConsumable"].ToString().Trim())) { myClass_Student.myClass_WeldingParameter.WeldingConsumable = myDataRow["StudentWeldingConsumable"].ToString().Trim(); } myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add); Class_QC myClass_QC = new Class_QC(); myClass_QC.ExaminingNo = myClass_Student.ExaminingNo; myClass_QC.isQCValid = true; DateTime.TryParse(myDataRow["IssuedOn"].ToString().Trim(), out myClass_QC.IssuedOn); int.TryParse(myDataRow["OriginalPeriod"].ToString(), out myClass_QC.OriginalPeriod); int.TryParse(myDataRow["PeriodofProlongation"].ToString(), out myClass_QC.PeriodofProlongation); myClass_QC.SupervisionPlace = "沪东造船"; myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Add); //str_ErrMessage = myClass_Student.CheckField(); //if (!string.IsNullOrEmpty(str_ErrMessage)) //{ // myDataRow["ErrMessage"] = str_ErrMessage; // continue; //} } this.DialogResult = DialogResult.OK; this.Close(); }
private void toolStripMenuItem_RowTransferToIssue_Click(object sender, EventArgs e) { //Form_InputBox myForm = new Form_InputBox(); //myForm.str_DefaultResponse = this.str_IssueNo; //myForm.str_Prompt = "请输入班级编号:"; //myForm.str_Title = "输入班级编号"; //if (myForm.ShowDialog() == DialogResult.OK) //{ // this.str_IssueNo = myForm.str_DefaultResponse; //} //else //{ // return; //} Form_Issue_Query myForm = new Form_Issue_Query(); myForm.myClass_Issue = new Class_Issue(); if (!string.IsNullOrEmpty(this.str_IssueNo)) { myForm.myClass_Issue.IssueNo = this.str_IssueNo; myForm.myClass_Issue.FillData(); } if (myForm.ShowDialog() == DialogResult.OK) { this.str_IssueNo = myForm.myClass_Issue.IssueNo; } else { return; } if (Class_Issue.ExistAndCanDeleteAndDelete(this.str_IssueNo, Enum_zwjKindofUpdate.Exist)) { Class_KindofEmployerStudent myClass_KindofEmployerStudent = new Class_KindofEmployerStudent((int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerStudentID"].Value); Class_KindofEmployerWelder myClass_KindofEmployerWelder = new Class_KindofEmployerWelder(myClass_KindofEmployerStudent.KindofEmployerWelderID); Class_Student myClass_Student = new Class_Student(); myClass_Student.IssueNo = this.str_IssueNo; myClass_Student.IdentificationCard = myClass_KindofEmployerWelder.IdentificationCard; myClass_Student.SubjectID = myClass_KindofEmployerStudent.ExamSubjectID; Class_Issue myClass_Issue = new Class_Issue(myClass_Student.IssueNo); myClass_Student.myClass_WeldingParameter = myClass_Issue.myClass_WeldingParameter; myClass_Student.myClass_WeldingParameter.KindofExam = myClass_KindofEmployerStudent.StudentKindofExam; Class_KindofEmployerIssue myClass_KindofEmployerIssue = new Class_KindofEmployerIssue(myClass_KindofEmployerStudent.KindofEmployerIssueID); myClass_Student.WPSNo = myClass_KindofEmployerIssue.IssueWPSNo; string str_ReturnMessage; str_ReturnMessage = myClass_Student.CheckField(); if (string.IsNullOrEmpty(str_ReturnMessage)) { Class_KindofEmployerWelder.TransferWelder(myClass_KindofEmployerStudent.KindofEmployerWelderID); myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add); if (string.IsNullOrEmpty(myClass_Student.ExaminingNo)) { MessageBox.Show("编入班级失败,可能是下一个考编号设置错误!"); } else { Class_KindofEmployerStudent.ExistAndCanDeleteAndDelete(myClass_KindofEmployerStudent.KindofEmployerStudentID, Enum_zwjKindofUpdate.Delete); this.myEventArgs_KindofEmployerIssue.bool_JustFill = false; Publisher_KindofEmployerIssue.OnEventName(this.myEventArgs_KindofEmployerIssue); MessageBox.Show(string.Format("编入班级成功,班级编号为 {0},考编号为 {1}", this.str_IssueNo, myClass_Student.ExaminingNo)); } } else { MessageBox.Show(string.Format("编入班级失败,{0}!", str_ReturnMessage)); } } else { MessageBox.Show(string.Format("不存在班级编号为 {0} 的班级!", this.str_IssueNo)); } }
private void InitDataGridView2015() { OpenFileDialog myForm = new OpenFileDialog(); myForm.Filter = "data files (*.data)|*.data|All files (*.*)|*.*"; myForm.RestoreDirectory = true; if (myForm.ShowDialog() != DialogResult.OK) { return; } DataTable myDataTable_Temp = new DataTable(); ADODB.Recordset rs = new ADODB.Recordset(); rs.Open(myForm.FileName, Type.Missing, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, 0); OleDbDataAdapter myAdapter = new OleDbDataAdapter(); myAdapter.Fill(myDataTable_Temp, rs); rs.Close(); this.myDataTable = myDataTable_Temp.Clone(); this.myDataTable_NotValid = myDataTable_Temp.Clone(); bool bool_Valid; foreach (DataRow myDataRow in myDataTable_Temp.Rows) { bool_Valid = true; if (string.IsNullOrEmpty(myDataRow["CerNo"].ToString())) { bool_Valid = false; } if (!Class_Student.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist)) { bool_Valid = false; } else { if (Class_QC.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist)) { bool_Valid = false; } else { if (Class_QC.ExistSecond(myDataRow["CerNo"].ToString(), null, Enum_zwjKindofUpdate.Add)) { bool_Valid = false; } else { } } } if (bool_Valid) { this.myDataTable.ImportRow(myDataRow); } else { this.myDataTable_NotValid.ImportRow(myDataRow); } } this.dataGridView_Data.DataSource = this.myDataTable; this.dataGridView_NotValid.DataSource = this.myDataTable_NotValid; this.label_Data.Text = string.Format("可以导入的数据,{0}", this.dataGridView_Data.RowCount); this.label_NotValid.Text = string.Format("不能导入的数据,{0}", this.dataGridView_NotValid.RowCount); }
private void InitDataGridView() { OpenFileDialog myForm = new OpenFileDialog(); myForm.Filter = "Access files (*.mdb)|*.mdb"; myForm.RestoreDirectory = true; if (myForm.ShowDialog() != DialogResult.OK) { return; } string str_Conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + myForm.FileName + ";Persist Security Info=True"; string str_SQL; str_SQL = "Select * From TB_Certificate_Info"; DataTable myDataTable_Temp = new DataTable(); OleDbDataAdapter myAdapter = new OleDbDataAdapter(str_SQL, str_Conn); myAdapter.Fill(myDataTable_Temp); this.myDataTable = myDataTable_Temp.Clone(); this.myDataTable_NotValid = myDataTable_Temp.Clone(); bool bool_Valid; foreach (DataRow myDataRow in myDataTable_Temp.Rows) { bool_Valid = true; if (string.IsNullOrEmpty(myDataRow["CerNo"].ToString())) { bool_Valid = false; } if (!Class_Student.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist)) { bool_Valid = false; } else { if (Class_QC.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist)) { bool_Valid = false; } else { if (Class_QC.ExistSecond(myDataRow["CerNo"].ToString(), null, Enum_zwjKindofUpdate.Add)) { bool_Valid = false; } else { } } } if (bool_Valid) { this.myDataTable.ImportRow(myDataRow); } else { this.myDataTable_NotValid.ImportRow(myDataRow); } } this.dataGridView_Data.DataSource = this.myDataTable; this.dataGridView_NotValid.DataSource = this.myDataTable_NotValid; this.label_Data.Text = string.Format("可以导入的数据,{0}", this.dataGridView_Data.RowCount); this.label_NotValid.Text = string.Format("不能导入的数据,{0}", this.dataGridView_NotValid.RowCount); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_QC"></param> /// <param name="bool_Add"></param> public void InitControl(Class_QC myClass_QC, bool bool_Add) { this.myClass_QC = myClass_QC; Class_Public.InitializeComboBox(this.ComboBox_Assemblage, Enum_DataTable.Assemblage.ToString(), "Assemblage", "Assemblage"); Class_Public.InitializeComboBox(this.ComboBox_KindofExam, Enum_DataTable.KindofExam.ToString(), "KindofExam", "KindofExam"); Class_Public.InitializeComboBox(this.ComboBox_WeldingProcess, Enum_DataTable.WeldingProcess.ToString(), "WeldingProcessAb", "WeldingProcess"); Class_Public.InitializeComboBox(this.ComboBox_ExamStatus, Enum_DataTable.ExamStatus.ToString(), "ExamStatus", "ExamStatus"); Class_Student myClass_Student = new Class_Student(myClass_QC.ExaminingNo); this.TextBox_IssueNo.Text = myClass_Student.IssueNo; this.TextBox_StudentRemark.Text = myClass_Student.StudentRemark; this.MaskedTextBox_ExaminingNo.Text = myClass_Student.ExaminingNo; this.ComboBox_ExamStatus.SelectedValue = myClass_Student.ExamStatus; this.NumericUpDown_TheoryResult.Value = myClass_Student.TheoryResult; this.NumericUpDown_TheoryMakeupResult.Value = myClass_Student.TheoryMakeupResult; this.CheckBox_SkillResult.Checked = myClass_Student.SkillResult; this.CheckBox_SkillMakeupResult.Checked = myClass_Student.SkillMakeupResult; Class_Issue myClass_Issue = new Class_Issue(myClass_Student.IssueNo); this.ComboBox_WeldingProcess.SelectedValue = myClass_Issue.WeldingProcessAb; this.InitControlWelder(new Class_Welder(myClass_Student.IdentificationCard)); this.InitControlWeldingParameter(myClass_Student.myClass_WeldingParameter); this.InitControlWeldingSubject(new Class_WeldingSubject(myClass_Student.SubjectID)); if (string.IsNullOrEmpty(this.myClass_QC.QCSubjectID)) { this.myClass_QC.QCSubjectID = myClass_Student.SubjectID; } if (bool_Add) { if (myClass_Issue.IssueIssuedOn != DateTime.MinValue) { this.dateTimePicker_IssuedOn.Value = myClass_Issue.IssueIssuedOn; } else if (Properties.Settings.Default.IssuedOn != DateTime.MinValue) { this.dateTimePicker_IssuedOn.Value = Properties.Settings.Default.IssuedOn; } string str_CertificateNo; Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb); if (myClass_ShipClassification.ShipRestrict) { Class_Ship myClass_Ship = new Class_Ship(myClass_Issue.ShipboardNo); str_CertificateNo = myClass_Ship.NextCertificateNo; } else { str_CertificateNo = myClass_ShipClassification.NextCertificateNo; } this.Button_CertificateNoModify.Visible = false; this.MaskedTextBox_CertificateNo.ReadOnly = !string.IsNullOrEmpty(str_CertificateNo); this.MaskedTextBox_CertificateNo.Text = str_CertificateNo; if (myClass_QCDefault != null) { } } else { this.Button_CertificateNoModify.Visible = true; this.MaskedTextBox_CertificateNo.ReadOnly = true; this.MaskedTextBox_CertificateNo.Text = this.myClass_QC.CertificateNo; this.TextBox_SupervisionPlace.Text = this.myClass_QC.SupervisionPlace; this.dateTimePicker_IssuedOn.Value = this.myClass_QC.IssuedOn; if (this.myClass_QC.OriginalPeriod > 0) { this.NumericUpDown_OriginalPeriod.Value = this.myClass_QC.OriginalPeriod; } if ((int)this.numericUpDown_PeriodofProlongation.Minimum <= this.myClass_QC.PeriodofProlongation && (int)this.numericUpDown_PeriodofProlongation.Maximum >= this.myClass_QC.PeriodofProlongation) { this.numericUpDown_PeriodofProlongation.Value = this.myClass_QC.PeriodofProlongation; } this.TextBox_QCRemark.Text = this.myClass_QC.QCRemark; if ((int)this.numericUpDown_SupervisionCycle.Minimum <= this.myClass_QC.SupervisionCycle && (int)this.numericUpDown_SupervisionCycle.Maximum >= this.myClass_QC.SupervisionCycle) { this.numericUpDown_SupervisionCycle.Value = this.myClass_QC.SupervisionCycle; } this.checkBox_isQCValid.Checked = this.myClass_QC.isQCValid; this.checkBox_SupervisionFirst.Checked = this.myClass_QC.SupervisionFirst; this.checkBox_SupervisionSecond.Checked = this.myClass_QC.SupervisionSecond; this.checkBox_SupervisionThird.Checked = this.myClass_QC.SupervisionThird; this.checkBox_SupervisionFourth.Checked = this.myClass_QC.SupervisionFourth; this.checkBox_SupervisionFifth.Checked = this.myClass_QC.SupervisionFifth; this.checkBox_SupervisionSixth.Checked = this.myClass_QC.SupervisionSixth; this.checkBox_SupervisionSeventh.Checked = this.myClass_QC.SupervisionSeventh; this.checkBox_SupervisionEighth.Checked = this.myClass_QC.SupervisionEighth; } }