private void button_OnOK_Click(object sender, EventArgs e)
        {
            this.userControl_KindofEmployerStudent_Base1.FillClass();
            String str_ErrMessage;

            str_ErrMessage = this.myClass_KindofEmployerStudent.CheckField();
            if (!string.IsNullOrEmpty(str_ErrMessage))
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = str_ErrMessage;
                return;
            }
            if (this.bool_Add)
            {
                if (Class_KindofEmployerStudent.ExistSecond(this.myClass_KindofEmployerStudent.KindofEmployerIssueID, this.myClass_KindofEmployerStudent.KindofEmployerWelderID, 0, Enum_zwjKindofUpdate.Add))
                {
                    this.DialogResult          = DialogResult.None;
                    this.label_ErrMessage.Text = "焊工编号不能重复!";
                    return;
                }
                else
                {
                    this.myClass_KindofEmployerStudent.AddAndModify(Enum_zwjKindofUpdate.Add);

                    if (this.checkBox_Continuous.Checked)
                    {
                        EventArgs_KindofEmployerIssue my_e = new EventArgs_KindofEmployerIssue(this.myClass_KindofEmployerStudent.KindofEmployerIssueID);
                        Publisher_KindofEmployerIssue.OnEventName(my_e);
                        this.label_ErrMessage.Text = "";
                        this.DialogResult          = DialogResult.None;
                        return;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                        return;
                    }
                }
            }
            else
            {
                if (Class_KindofEmployerStudent.ExistSecond(this.myClass_KindofEmployerStudent.KindofEmployerIssueID, this.myClass_KindofEmployerStudent.KindofEmployerWelderID, this.myClass_KindofEmployerStudent.KindofEmployerStudentID, Enum_zwjKindofUpdate.Modify))
                {
                    this.DialogResult          = DialogResult.None;
                    this.label_ErrMessage.Text = "焊工编号不能重复!";
                    return;
                }
                else
                {
                    this.myClass_KindofEmployerStudent.AddAndModify(Enum_zwjKindofUpdate.Modify);
                }
            }
        }
Exemple #2
0
        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_KindofEmployerStudent myClass_KindofEmployerStudent;

            foreach (DataRow myDataRow in this.myDataTable.Rows)
            {
                myDataRow["WelderRemark"]     = "";
                myClass_KindofEmployerStudent = new Class_KindofEmployerStudent();
                myClass_KindofEmployerStudent.KindofEmployerIssueID  = this.int_KindofEmployerIssueID;
                myClass_KindofEmployerStudent.KindofEmployerWelderID = (int)myDataRow["KindofEmployerWelderID"];
                myClass_KindofEmployerStudent.ExamSubjectID          = this.TextBox_SubjectID.Text;
                if (Class_KindofEmployerStudent.ExistSecond(myClass_KindofEmployerStudent.KindofEmployerIssueID, myClass_KindofEmployerStudent.KindofEmployerWelderID, 0, Enum_zwjKindofUpdate.Add))
                {
                    myDataRow["WelderRemark"] = "学员不能重复!";
                }
                else
                {
                    str_ErrMessage = myClass_KindofEmployerStudent.CheckField();
                    if (string.IsNullOrEmpty(str_ErrMessage))
                    {
                        myClass_KindofEmployerStudent.AddAndModify(Enum_zwjKindofUpdate.Add);
                        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();
        }