示例#1
0
        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);
                }
            }
        }
示例#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_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();
        }