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

            str_ErrMessage = myClass_WeldingConsumable.CheckField();
            if (str_ErrMessage != null)
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = str_ErrMessage;
                return;
            }
            if (this.bool_Add)
            {
                if (!Class_WeldingConsumable.ExistAndCanDeleteAndDelete(this.myClass_WeldingConsumable.WeldingConsumable, Enum_zwjKindofUpdate.Exist))
                {
                    this.myClass_WeldingConsumable.AddAndModify(Enum_zwjKindofUpdate.Add);
                }
                else
                {
                    this.label_ErrMessage.Text = "该焊接材料名已添加!";
                    this.DialogResult          = DialogResult.None;
                    return;
                }
            }
            else
            {
                this.myClass_WeldingConsumable.AddAndModify(Enum_zwjKindofUpdate.Modify);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 private void Form_WeldingConsumableUpdate_Load(object sender, EventArgs e)
 {
     if (!(this.bool_Add || Class_WeldingConsumable.ExistAndCanDeleteAndDelete(myClass_WeldingConsumable.WeldingConsumable, 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_WeldingConsumableBase1.InitControl(this.myClass_WeldingConsumable, this.bool_Add);
 }
        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;
            DateTime      myDateTime;

            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 (!Class_Material.ExistAndCanDeleteAndDelete(myDataRow["StudentMaterial"].ToString(), Enum_zwjKindofUpdate.Exist))
                {
                    str_ErrMessage = "母材数据有误!";
                }
                if (!Class_WeldingConsumable.ExistAndCanDeleteAndDelete(myDataRow["StudentWeldingConsumable"].ToString(), Enum_zwjKindofUpdate.Exist))
                {
                    str_ErrMessage = "焊接材料数据有误!";
                }

                if (!DateTime.TryParse(myDataRow["IssuedOn"].ToString().Trim(), out myDateTime))
                {
                    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;
                }
            }
        }