private void button_Modify_Click(object sender, EventArgs e) { if (this.myDataTable_Modified.Rows.Count > 0) { MessageBox.Show("请先重置后再进行填充操作!"); return; } if (string.IsNullOrEmpty(this.MaskedTextBox_NextCertificateNo.Text)) { MessageBox.Show("证号起始不能为空!"); return; } if (string.IsNullOrEmpty(this.TextBox_SupervisionPlace.Text)) { MessageBox.Show("考察地点不能为空!"); return; } Class_Issue myClass_Issue = new Class_Issue(this.str_IssueNo); Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb); Class_Ship myClass_Ship = new Class_Ship(); if (myClass_ShipClassification.ShipRestrict) { myClass_Ship = new Class_Ship(myClass_Issue.ShipboardNo); } DataRow myDataRow; DataRow myNewRow; DataView myDataView_Temp = new DataView(this.myDataTable_Origin); myDataView_Temp.RowFilter = "Checked = true and ((TheoryResultNeed=true and (TheoryResult>=PassScore or TheoryMakeupResult>=PassScore)) or TheoryResultNeed=false) and ((SkillResultNeed=true and (SkillResult Or SkillMakeupResult)) or SkillResultNeed=false) And CertificateNo is Null"; myDataView_Temp.Sort = "ExaminingNo"; foreach (DataRowView myDataRowView in myDataView_Temp) { //if (Class_QC.ExistAndCanDeleteAndDelete (this.MaskedTextBox_NextCertificateNo.Text, Enum_zwjKindofUpdate.Exist)) //{ // MessageBox.Show("该证号已使用!"); // return; //} if (Class_QC.ExistSecond(this.MaskedTextBox_NextCertificateNo.Text, null, Enum_zwjKindofUpdate.Add)) { MessageBox.Show("该证号已使用!"); return; } myDataRow = myDataTable_Origin.Rows.Find(myDataRowView["ExaminingNo"].ToString()); this.myDataTable_Modified.ImportRow(myDataRow); myNewRow = myDataTable_Modified.Rows.Find(myDataRowView["ExaminingNo"].ToString()); myNewRow["CertificateNo"] = this.MaskedTextBox_NextCertificateNo.Text; myNewRow["SupervisionPlace"] = this.TextBox_SupervisionPlace.Text; myNewRow["OriginalPeriod"] = this.NumericUpDown_OriginalPeriod.Value; myNewRow["PeriodofValidity"] = this.NumericUpDown_OriginalPeriod.Value; myNewRow["IssuedOn"] = this.DateTimePicker_IssuedOn.Value; if (myClass_ShipClassification.ShipRestrict) { this.MaskedTextBox_NextCertificateNo.Text = Class_Tools.GetNextSequence(this.MaskedTextBox_NextCertificateNo.Text, myClass_Ship.CertificateNoSignificantDigit); } else { this.MaskedTextBox_NextCertificateNo.Text = Class_Tools.GetNextSequence(this.MaskedTextBox_NextCertificateNo.Text, myClass_ShipClassification.CertificateNoSignificantDigit); } } this.label_Modified.Text = string.Format("新证书:({0})", this.dataGridView_Modified.RowCount); MessageBox.Show("填充完毕!"); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_GXTheoryIssue"></param> /// <param name="bool_Add"></param> public void InitControl(Class_GXTheoryIssue myClass_GXTheoryIssue, bool bool_Add) { this.myClass_GXTheoryIssue = myClass_GXTheoryIssue; Class_Public.InitializeComboBox(this.ComboBox_KindofExam, Enum_DataTable.KindofExam.ToString(), "KindofExam", "KindofExam"); Class_Public.InitializeComboBox(this.ComboBox_WeldingProcess, Enum_DataTable.WeldingProcess.ToString(), "WeldingProcessAb", "WeldingProcessAb"); this.textBox_ShipClassificationAb.Text = this.myClass_GXTheoryIssue.ShipClassificationAb; this.TextBox_ShipboardNo.Text = this.myClass_GXTheoryIssue.ShipboardNo; if (bool_Add) { Class_Ship myClass_Ship = new Class_Ship(this.myClass_GXTheoryIssue.ShipboardNo); this.MaskedTextBox_IssueNo.Text = myClass_Ship.NextTheoryIssueNo; if (myClass_GXTheoryIssueDefault != null) { this.ComboBox_WeldingProcess.SelectedValue = myClass_GXTheoryIssueDefault.WeldingProcessAb; this.ComboBox_KindofExam.SelectedValue = myClass_GXTheoryIssueDefault.KindofExam; this.TextBox_PlaceofTest.Text = myClass_GXTheoryIssueDefault.PlaceofTest; this.textBox_KindofEmployer.Text = myClass_GXTheoryIssueDefault.KindofEmployer; Class_Employer myClass_Employer = new Class_Employer(myClass_GXTheoryIssueDefault.EmployerHPID); this.textBox_Employer.Text = string.Format("{0}:{1}", myClass_Employer.EmployerHPID, myClass_Employer.Employer); this.myClass_GXTheoryIssue.KindofEmployer = myClass_GXTheoryIssueDefault.KindofEmployer; this.myClass_GXTheoryIssue.EmployerHPID = myClass_GXTheoryIssueDefault.EmployerHPID; } Class_CustomUser myClass_CustomUser = new Class_CustomUser(); if (!string.IsNullOrEmpty(Properties.Settings.Default.TheoryTeacherID)) { myClass_CustomUser.UserGUID = new Guid(Properties.Settings.Default.TheoryTeacherID); if (myClass_CustomUser.FillData()) { this.textBox_TheoryTeacherID.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } } if (!string.IsNullOrEmpty(Properties.Settings.Default.ArchiveTeacherID)) { myClass_CustomUser.UserGUID = new Guid(Properties.Settings.Default.ArchiveTeacherID); if (myClass_CustomUser.FillData()) { this.textBox_ArchiveTeacherID.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } } } else { this.MaskedTextBox_IssueNo.Text = myClass_GXTheoryIssue.IssueNo; this.TextBox_IssueRemark.Text = myClass_GXTheoryIssue.IssueRemark; this.DateTimePicker_SignUpDate.Value = myClass_GXTheoryIssue.SignUpDate; this.textBox_KindofEmployer.Text = myClass_GXTheoryIssue.KindofEmployer; Class_Employer myClass_Employer = new Class_Employer(myClass_GXTheoryIssue.EmployerHPID); this.textBox_Employer.Text = string.Format("{0}:{1}", myClass_Employer.EmployerHPID, myClass_Employer.Employer); this.ComboBox_WeldingProcess.SelectedValue = myClass_GXTheoryIssue.WeldingProcessAb; this.ComboBox_KindofExam.SelectedValue = myClass_GXTheoryIssue.KindofExam; Class_CustomUser myClass_CustomUser = new Class_CustomUser(); myClass_CustomUser.UserGUID = myClass_GXTheoryIssue.TheoryTeacherID; if (myClass_CustomUser.FillData()) { this.textBox_TheoryTeacherID.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } myClass_CustomUser.UserGUID = myClass_GXTheoryIssue.ArchiveTeacherID; if (myClass_CustomUser.FillData()) { this.textBox_ArchiveTeacherID.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } this.TextBox_PlaceofTest.Text = myClass_GXTheoryIssue.PlaceofTest; if (myClass_GXTheoryIssue.TheoryExamDate != DateTime.MinValue) { this.MaskedTextBox_TheoryExamDate.Text = myClass_GXTheoryIssue.TheoryExamDate.ToString("yyyy-MM-dd"); } if (myClass_GXTheoryIssue.TheoryMakeupDate != DateTime.MinValue) { this.MaskedTextBox_TheoryMakeupDate.Text = myClass_GXTheoryIssue.TheoryMakeupDate.ToString("yyyy-MM-dd"); } if (myClass_GXTheoryIssue.DateBeginningofTrain != DateTime.MinValue) { this.MaskedTextBox_DateBeginningofTrain.Text = myClass_GXTheoryIssue.DateBeginningofTrain.ToString("yyyy-MM-dd"); } if (myClass_GXTheoryIssue.DateEndingofTrain != DateTime.MinValue) { this.MaskedTextBox_DateEndingofTrain.Text = myClass_GXTheoryIssue.DateEndingofTrain.ToString("yyyy-MM-dd"); } this.CheckBox_TheoryTrained.Checked = Class_DataValidateTool.CheckUintBit(this.myClass_GXTheoryIssue.IssueStatus, 0); this.CheckBox_TheoryExam.Checked = Class_DataValidateTool.CheckUintBit(this.myClass_GXTheoryIssue.IssueStatus, 1); this.CheckBox_TheoryExamMakeup.Checked = Class_DataValidateTool.CheckUintBit(this.myClass_GXTheoryIssue.IssueStatus, 4); this.CheckBox_Finished.Checked = Class_DataValidateTool.CheckUintBit(this.myClass_GXTheoryIssue.IssueStatus, 31); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_Ship"></param> /// <param name="bool_Add"></param> public void InitControl(Class_Ship myClass_Ship, bool bool_Add) { for (int i = 0; i <= 25; i++) { this.ComboBox_Leter.Items.Add((char )(97 + i)); } this.ComboBox_Leter.Text = "a"; Class_Public.InitializeComboBox(this.ComboBox_TestCommitteeID, Enum_DataTable.TestCommittee.ToString(), "TestCommitteeID", "TestCommitteeID"); this.myClass_Ship = myClass_Ship; if (bool_Add) { if (myClass_ShipDefault != null) { this.ComboBox_TestCommitteeID.SelectedValue = myClass_ShipDefault.TestCommitteeID; this.MaskedTextBox_NextSkillIssueNo.Text = myClass_ShipDefault.NextSkillIssueNo; this.MaskedTextBox_NextSkillExaminingNo.Text = myClass_ShipDefault.NextSkillExaminingNo; this.MaskedTextBox_NextCertificateNo.Text = myClass_ShipDefault.NextCertificateNo; this.MaskedTextBox_NextTheoryIssueNo.Text = myClass_ShipDefault.NextTheoryIssueNo; this.MaskedTextBox_NextTheoryExaminingNo.Text = myClass_ShipDefault.NextTheoryExaminingNo; if (myClass_ShipDefault.SkillIssueNoSignificantDigit >= this.NumericUpDown_SkillIssueNoSignificantDigit.Minimum && myClass_ShipDefault.SkillIssueNoSignificantDigit <= this.NumericUpDown_SkillIssueNoSignificantDigit.Maximum) { this.NumericUpDown_SkillIssueNoSignificantDigit.Value = myClass_ShipDefault.SkillIssueNoSignificantDigit; } if (myClass_ShipDefault.SkillExaminingNoSignificantDigit >= this.NumericUpDown_SkillExaminingNoSignificantDigit.Minimum && myClass_ShipDefault.SkillExaminingNoSignificantDigit <= this.NumericUpDown_SkillExaminingNoSignificantDigit.Maximum) { this.NumericUpDown_SkillExaminingNoSignificantDigit.Value = myClass_ShipDefault.SkillExaminingNoSignificantDigit; } if (myClass_ShipDefault.CertificateNoSignificantDigit >= this.NumericUpDown_CertificateNoSignificantDigit.Minimum && myClass_ShipDefault.CertificateNoSignificantDigit <= this.NumericUpDown_CertificateNoSignificantDigit.Maximum) { this.NumericUpDown_CertificateNoSignificantDigit.Value = myClass_ShipDefault.CertificateNoSignificantDigit; } if (myClass_ShipDefault.TheoryIssueNoSignificantDigit >= this.NumericUpDown_TheoryIssueNoSignificantDigit.Minimum && myClass_ShipDefault.TheoryIssueNoSignificantDigit <= this.NumericUpDown_TheoryIssueNoSignificantDigit.Maximum) { this.NumericUpDown_TheoryIssueNoSignificantDigit.Value = myClass_ShipDefault.TheoryIssueNoSignificantDigit; } if (myClass_ShipDefault.TheoryExaminingNoSignificantDigit >= this.NumericUpDown_TheoryExaminingNoSignificantDigit.Minimum && myClass_ShipDefault.TheoryExaminingNoSignificantDigit <= this.NumericUpDown_TheoryExaminingNoSignificantDigit.Maximum) { this.NumericUpDown_TheoryExaminingNoSignificantDigit.Value = myClass_ShipDefault.TheoryExaminingNoSignificantDigit; } this.TextBox_SkillIssueNoRegex.Text = myClass_ShipDefault.SkillIssueNoRegex; this.TextBox_SkillExaminingNoRegex.Text = myClass_ShipDefault.SkillExaminingNoRegex; this.TextBox_CertificateNoRegex.Text = myClass_ShipDefault.CertificateNoRegex; this.TextBox_TheoryIssueNoRegex.Text = myClass_ShipDefault.TheoryIssueNoRegex; this.TextBox_TheoryExaminingNoRegex.Text = myClass_ShipDefault.TheoryExaminingNoRegex; } } else { this.TextBox_ShipboardNo.ReadOnly = true; this.TextBox_ShipboardNo.Text = this.myClass_Ship.ShipboardNo; this.TextBox_ModelNo.Text = this.myClass_Ship.ModelNo; this.ComboBox_Leter.Text = this.myClass_Ship.ShipLetter; this.TextBox_ShipCompetence.Text = this.myClass_Ship.ShipCompetence; this.TextBox_ShipRemark.Text = this.myClass_Ship.ShipRemark; if (myClass_Ship.ShipIndex >= this.numericUpDown_ShipIndex.Minimum && myClass_Ship.ShipIndex <= this.numericUpDown_ShipIndex.Maximum) { this.numericUpDown_ShipIndex.Value = this.myClass_Ship.ShipIndex; } this.ComboBox_TestCommitteeID.SelectedValue = this.myClass_Ship.TestCommitteeID; this.MaskedTextBox_NextSkillIssueNo.Text = this.myClass_Ship.NextSkillIssueNo; this.MaskedTextBox_NextSkillExaminingNo.Text = this.myClass_Ship.NextSkillExaminingNo; this.MaskedTextBox_NextCertificateNo.Text = this.myClass_Ship.NextCertificateNo; this.MaskedTextBox_NextTheoryIssueNo.Text = this.myClass_Ship.NextTheoryIssueNo; this.MaskedTextBox_NextTheoryExaminingNo.Text = this.myClass_Ship.NextTheoryExaminingNo; if (myClass_Ship.SkillIssueNoSignificantDigit >= this.NumericUpDown_SkillIssueNoSignificantDigit.Minimum && myClass_Ship.SkillIssueNoSignificantDigit <= this.NumericUpDown_SkillIssueNoSignificantDigit.Maximum) { this.NumericUpDown_SkillIssueNoSignificantDigit.Value = myClass_Ship.SkillIssueNoSignificantDigit; } if (myClass_Ship.SkillExaminingNoSignificantDigit >= this.NumericUpDown_SkillExaminingNoSignificantDigit.Minimum && myClass_Ship.SkillExaminingNoSignificantDigit <= this.NumericUpDown_SkillExaminingNoSignificantDigit.Maximum) { this.NumericUpDown_SkillExaminingNoSignificantDigit.Value = myClass_Ship.SkillExaminingNoSignificantDigit; } if (myClass_Ship.CertificateNoSignificantDigit >= this.NumericUpDown_CertificateNoSignificantDigit.Minimum && myClass_Ship.CertificateNoSignificantDigit <= this.NumericUpDown_CertificateNoSignificantDigit.Maximum) { this.NumericUpDown_CertificateNoSignificantDigit.Value = myClass_Ship.CertificateNoSignificantDigit; } if (myClass_Ship.TheoryIssueNoSignificantDigit >= this.NumericUpDown_TheoryIssueNoSignificantDigit.Minimum && myClass_Ship.TheoryIssueNoSignificantDigit <= this.NumericUpDown_TheoryIssueNoSignificantDigit.Maximum) { this.NumericUpDown_TheoryIssueNoSignificantDigit.Value = myClass_Ship.TheoryIssueNoSignificantDigit; } if (myClass_Ship.TheoryExaminingNoSignificantDigit >= this.NumericUpDown_TheoryExaminingNoSignificantDigit.Minimum && myClass_Ship.TheoryExaminingNoSignificantDigit <= this.NumericUpDown_TheoryExaminingNoSignificantDigit.Maximum) { this.NumericUpDown_TheoryExaminingNoSignificantDigit.Value = myClass_Ship.TheoryExaminingNoSignificantDigit; } this.TextBox_SkillIssueNoRegex.Text = this.myClass_Ship.SkillIssueNoRegex; this.TextBox_SkillExaminingNoRegex.Text = this.myClass_Ship.SkillExaminingNoRegex; this.TextBox_CertificateNoRegex.Text = this.myClass_Ship.CertificateNoRegex; this.TextBox_TheoryIssueNoRegex.Text = this.myClass_Ship.TheoryIssueNoRegex; this.TextBox_TheoryExaminingNoRegex.Text = this.myClass_Ship.TheoryExaminingNoRegex; if (myClass_Ship.ShipIndex >= this.numericUpDown_ShipIndex.Minimum && myClass_Ship.ShipIndex <= this.numericUpDown_ShipIndex.Maximum) { this.numericUpDown_ShipIndex.Value = myClass_Ship.ShipIndex; } } }
/// <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; } }