Beispiel #1
0
        private void CheckData_DataTable()
        {
            Class_Welder myClass_Welder;
            string       str_ErrMessage;

            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["WelderBelongWorkerID"].ToString().Trim();

                //myClass_Welder.myClass_BelongUnit.EmployerHPID = Class_Employer.GetEmployerHPID(myDataRow["WelderBelongEmployer"].ToString());
                myClass_Welder.myClass_BelongUnit.EmployerHPID = Class_Employer.GetEmployerHPIDbyDataTable(myDataRow["WelderBelongEmployer"].ToString().Trim());
                myDataRow["WelderBelongEmployerHPID"]          = myClass_Welder.myClass_BelongUnit.EmployerHPID;
                if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.EmployerHPID))
                {
                    str_ErrMessage = "公司数据有误!";
                }
                else
                {
                    if (!string.IsNullOrEmpty(myDataRow["WelderBelongDepartment"].ToString()))
                    {
                        //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["WelderBelongDepartment"].ToString().Trim());
                        myDataRow["WelderBelongDepartmentHPID"]          = myClass_Welder.myClass_BelongUnit.DepartmentHPID;
                        if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.DepartmentHPID))
                        {
                            str_ErrMessage = "部门数据有误!";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(myDataRow["WelderBelongWorkPlace"].ToString()))
                            {
                                //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["WelderBelongWorkPlace"].ToString().Trim());
                                myDataRow["WelderBelongWorkPlaceHPID"]          = myClass_Welder.myClass_BelongUnit.WorkPlaceHPID;
                                if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.WorkPlaceHPID))
                                {
                                    str_ErrMessage = "作业区数据有误!";
                                }
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(myDataRow["WelderBelongLaborServiceTeam"].ToString()))
                    {
                        //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["WelderBelongLaborServiceTeam"].ToString().Trim());
                        myDataRow["WelderBelongLaborServiceTeamHPID"]          = myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID;
                        if (string.IsNullOrEmpty(myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID))
                        {
                            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;
                    }
                }

                if (!Class_Schooling.ExistAndCanDeleteAndDelete(myClass_Welder.Schooling, Enum_zwjKindofUpdate.Exist))
                {
                    myDataRow["ErrMessage"] = "学历有误!";
                    continue;
                }

                if (!string.IsNullOrEmpty(this.str_WorkPlaceHPID))
                {
                    if (myClass_Welder.myClass_BelongUnit.WorkPlaceHPID != this.str_WorkPlaceHPID)
                    {
                        myDataRow["ErrMessage"] = "作业区超出导入数据范围,请重新选择导入单位!";
                        continue;
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.str_DepartmentHPID))
                    {
                        if (myClass_Welder.myClass_BelongUnit.DepartmentHPID != this.str_DepartmentHPID)
                        {
                            myDataRow["ErrMessage"] = "部门超出导入数据范围,请重新选择导入单位!";
                            continue;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(this.str_EmployerHPID))
                        {
                            if (myClass_Welder.myClass_BelongUnit.EmployerHPID != this.str_EmployerHPID)
                            {
                                myDataRow["ErrMessage"] = "公司超出导入数据范围,请重新选择导入单位!";
                                continue;
                            }
                        }
                    }
                }
                //if (Class_WelderBelong.GetWelderBelong(myClass_Welder.IdentificationCard, this.str_EmployerHPID, this.str_DepartmentHPID, this.str_WorkPlaceHPID).Rows.Count > 1)
                //{
                //    myDataRow["ErrMessage"] = "数据库中该单位下该焊工有两条记录!";
                //    continue;
                //}
                //if (Class_WelderBelong.GetWelderBelong(myClass_Welder.IdentificationCard, this.str_EmployerHPID, this.str_DepartmentHPID, this.str_WorkPlaceHPID).Rows.Count > 0)
                //{
                //    myDataRow["ErrMessage"] = "数据库中该单位下已存在该焊工!";
                //    continue;
                //}
            }
        }
Beispiel #2
0
        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;

            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 (!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;
                }
            }
        }