/// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="myClass_GXTheoryStudent"></param>
        /// <param name="bool_Add"></param>
        public void InitControl(Class_GXTheoryStudent myClass_GXTheoryStudent, bool bool_Add)
        {
            Class_Public.InitializeComboBox(this.ComboBox_KindofExam, Enum_DataTable.KindofExam.ToString(), "KindofExam", "KindofExam");
            Class_Public.InitializeComboBox(this.ComboBox_ExamStatus, Enum_DataTable.ExamStatus.ToString(), "ExamStatus", "ExamStatus");
            this.ComboBox_ExamStatus.SelectedValue = "顺利考试";
            this.TextBox_IssueNo.Text    = myClass_GXTheoryStudent.IssueNo;
            this.myClass_GXTheoryStudent = myClass_GXTheoryStudent;
            if (bool_Add)
            {
                Class_GXTheoryIssue myClass_GXTheoryIssue = new Class_GXTheoryIssue(myClass_GXTheoryStudent.IssueNo);
                this.textBox_WeldingProcessAb.Text     = myClass_GXTheoryIssue.WeldingProcessAb;
                this.ComboBox_KindofExam.SelectedValue = myClass_GXTheoryIssue.KindofExam;
                Class_Ship myClass_Ship = new Class_Ship(myClass_GXTheoryIssue.ShipboardNo);
                this.MaskedTextBox_ExaminingNo.Text = myClass_Ship.NextTheoryExaminingNo;
                if (myClass_GXTheoryStudentDefault != null)
                {
                    this.InitControlWeldingSubject(new Class_WeldingSubject(myClass_GXTheoryStudentDefault.SubjectID));
                }
            }
            else
            {
                this.TextBox_StudentRemark.Text             = myClass_GXTheoryStudent.StudentRemark;
                this.MaskedTextBox_ExaminingNo.Text         = this.myClass_GXTheoryStudent.ExaminingNo;
                this.ComboBox_ExamStatus.SelectedValue      = this.myClass_GXTheoryStudent.ExamStatus;
                this.NumericUpDown_TheoryResult.Value       = this.myClass_GXTheoryStudent.TheoryResult;
                this.NumericUpDown_TheoryMakeupResult.Value = this.myClass_GXTheoryStudent.TheoryMakeupResult;

                this.InitControlWelder(new Class_Welder(this.myClass_GXTheoryStudent.IdentificationCard));
                this.InitControlWeldingSubject(new Class_WeldingSubject(this.myClass_GXTheoryStudent.SubjectID));
            }
        }
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            this.userControl_GXTheoryStudent_Base1.FillClass();
            String str_ErrMessage;

            str_ErrMessage = this.myClass_GXTheoryStudent.CheckField();
            if (str_ErrMessage != null)
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = str_ErrMessage;
                return;
            }
            if (this.bool_Add)
            {
                if (Class_GXTheoryStudent.ExistSecond(this.myClass_GXTheoryStudent.IssueNo, this.myClass_GXTheoryStudent.IdentificationCard, null, Enum_zwjKindofUpdate.Add))
                {
                    this.DialogResult          = DialogResult.None;
                    this.label_ErrMessage.Text = "身份证号码不能重复!";
                    return;
                }
                else
                {
                    if (!this.myClass_GXTheoryStudent.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_GXTheoryStudent.IssueNo, true);
                            Publisher_Issue.OnEventName(my_e);
                            this.DialogResult          = DialogResult.None;
                            this.label_ErrMessage.Text = "";
                            return;
                        }
                        else
                        {
                            this.DialogResult = DialogResult.OK;
                            return;
                        }
                    }
                }
            }
            else
            {
                if (Class_GXTheoryStudent.ExistSecond(this.myClass_GXTheoryStudent.IssueNo, this.myClass_GXTheoryStudent.IdentificationCard, this.myClass_GXTheoryStudent.ExaminingNo, Enum_zwjKindofUpdate.Modify))
                {
                    this.DialogResult          = DialogResult.None;
                    this.label_ErrMessage.Text = "身份证号码不能重复!";
                    return;
                }
                else
                {
                    this.myClass_GXTheoryStudent.AddAndModify(Enum_zwjKindofUpdate.Modify);
                }
            }
        }
示例#3
0
        private void toolStripMenuItem_RowTransferToGXTheoryIssue_Click(object sender, EventArgs e)
        {
            Form_GXTheoryIssue_Query myForm = new Form_GXTheoryIssue_Query();

            myForm.myClass_GXTheoryIssue = new Class_GXTheoryIssue();
            if (!string.IsNullOrEmpty(this.str_IssueNo))
            {
                myForm.myClass_GXTheoryIssue.IssueNo = this.str_IssueNo;
                myForm.myClass_GXTheoryIssue.FillData();
            }
            if (myForm.ShowDialog() == DialogResult.OK)
            {
                this.str_IssueNo = myForm.myClass_GXTheoryIssue.IssueNo;
            }
            else
            {
                return;
            }

            if (Class_GXTheoryIssue.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_GXTheoryStudent       myClass_GXTheoryStudent       = new Class_GXTheoryStudent();
                myClass_GXTheoryStudent.IssueNo            = this.str_IssueNo;
                myClass_GXTheoryStudent.IdentificationCard = myClass_KindofEmployerWelder.IdentificationCard;
                myClass_GXTheoryStudent.SubjectID          = myClass_KindofEmployerStudent.ExamSubjectID;
                Class_GXTheoryIssue myClass_GXTheoryIssue = new Class_GXTheoryIssue(myClass_GXTheoryStudent.IssueNo);
                myClass_GXTheoryStudent.KindofExam = myClass_GXTheoryIssue.KindofExam;
                string str_ReturnMessage;
                str_ReturnMessage = myClass_GXTheoryStudent.CheckField();
                if (string.IsNullOrEmpty(str_ReturnMessage))
                {
                    Class_KindofEmployerWelder.TransferWelder(myClass_KindofEmployerStudent.KindofEmployerWelderID);
                    myClass_GXTheoryStudent.AddAndModify(Enum_zwjKindofUpdate.Add);
                    if (string.IsNullOrEmpty(myClass_GXTheoryStudent.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_GXTheoryStudent.ExaminingNo));
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("编入理论班级失败,{0}!", str_ReturnMessage));
                }
            }
            else
            {
                MessageBox.Show(string.Format("不存在理论班级编号为 {0} 的班级!", this.str_IssueNo));
            }
        }
        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_GXTheoryStudent myClass_GXTheoryStudent;
            Class_GXTheoryIssue   myClass_GXTheoryIssue = new Class_GXTheoryIssue(this.str_IssueNo);

            foreach (DataRow myDataRow in this.myDataTable.Rows)
            {
                myDataRow["WelderRemark"]                  = "";
                myClass_GXTheoryStudent                    = new Class_GXTheoryStudent();
                myClass_GXTheoryStudent.IssueNo            = this.str_IssueNo;
                myClass_GXTheoryStudent.IdentificationCard = myDataRow["IdentificationCard"].ToString();
                myClass_GXTheoryStudent.ExamStatus         = "顺利考试";
                myClass_GXTheoryStudent.KindofExam         = myClass_GXTheoryIssue.KindofExam;
                if (Class_GXTheoryStudent.ExistSecond(myClass_GXTheoryStudent.IssueNo, myClass_GXTheoryStudent.IdentificationCard, null, Enum_zwjKindofUpdate.Add))
                {
                    myDataRow["WelderRemark"] = "身份证号码不能重复!";
                }
                else
                {
                    str_ErrMessage = myClass_GXTheoryStudent.CheckField();
                    if (string.IsNullOrEmpty(str_ErrMessage))
                    {
                        if (!myClass_GXTheoryStudent.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>
        public void FillClass()
        {
            myClass_GXTheoryStudent.IdentificationCard = this.MaskedTextBox_IdentificationCard.Text;
            myClass_GXTheoryStudent.KindofExam         = this.ComboBox_KindofExam.SelectedValue.ToString();
            myClass_GXTheoryStudent.ExamStatus         = this.ComboBox_ExamStatus.SelectedValue.ToString();
            myClass_GXTheoryStudent.TheoryResult       = (int)this.NumericUpDown_TheoryResult.Value;
            myClass_GXTheoryStudent.TheoryMakeupResult = (int)this.NumericUpDown_TheoryMakeupResult.Value;
            myClass_GXTheoryStudent.StudentRemark      = this.TextBox_StudentRemark.Text;
            myClass_GXTheoryStudent.SubjectID          = this.TextBox_SubjectID.Text;

            if (myClass_GXTheoryStudentDefault == null)
            {
                myClass_GXTheoryStudentDefault = new Class_GXTheoryStudent();
            }
            myClass_GXTheoryStudentDefault.SubjectID = myClass_GXTheoryStudent.SubjectID;
        }
 private void Form_GXTheoryStudent_Update_Load(object sender, EventArgs e)
 {
     if (!(this.bool_Add || Class_GXTheoryStudent.ExistAndCanDeleteAndDelete(myClass_GXTheoryStudent.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_GXTheoryStudent_Base1.InitControl(this.myClass_GXTheoryStudent, this.bool_Add);
 }