Esempio n. 1
0
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            Class_Issue myClass_Issue = new Class_Issue(this.str_IssueNo);
            Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb);
            Class_Ship          myClass_Ship          = new Class_Ship();
            Class_TestCommittee myClass_TestCommittee = new Class_TestCommittee();

            if (myClass_ShipClassification.ShipRestrict)
            {
                myClass_Ship = new Class_Ship(myClass_Issue.ShipboardNo);
                myClass_TestCommittee.TestCommitteeID = myClass_Ship.TestCommitteeID;
            }
            else
            {
                myClass_TestCommittee.TestCommitteeID = myClass_ShipClassification.TestCommitteeID;
            }
            myClass_TestCommittee.FillData();

            Class_QC myClass_QC;
            DataView myDataView_Temp = new DataView(this.myDataTable_Modified);

            myDataView_Temp.Sort = "ExaminingNo";
            foreach (DataRowView myDataRowView in myDataView_Temp)
            {
                myClass_QC             = new Class_QC();
                myClass_QC.ExaminingNo = myDataRowView["ExaminingNo"].ToString();
                myClass_QC.IssuedOn    = (DateTime)myDataRowView["IssuedOn"];
                int.TryParse(myDataRowView["OriginalPeriod"].ToString(), out myClass_QC.OriginalPeriod);
                myClass_QC.PeriodofProlongation = 0;
                myClass_QC.QCSubjectID          = myDataRowView["ExamSubjectID"].ToString();
                myClass_QC.SupervisionPlace     = myDataRowView["SupervisionPlace"].ToString();
                myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Add);
            }
            string str_RegistrationNoRange;

            str_RegistrationNoRange = string.Format("初始存档号码为:{0}\n下一个存档号码为:", myClass_TestCommittee.NextRegistrationNo);
            myClass_TestCommittee.FillData();
            str_RegistrationNoRange += myClass_TestCommittee.NextRegistrationNo;
            MessageBox.Show(str_RegistrationNoRange);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Esempio n. 2
0
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.TextBox_SupervisionPlace.Text))
            {
                MessageBox.Show("必须输入考察地点!");
                this.DialogResult = DialogResult.None;
                return;
            }
            if (this.myDataTable_NotValid.Rows.Count > 0)
            {
                if (MessageBox.Show("有数据不能导入,是否只导入合格的数据?", "确认窗口", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                }
                else
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }
            Class_QC myClass_QC;

            foreach (DataRow myDataRow in this.myDataTable.Rows)
            {
                myClass_QC               = new Class_QC();
                myClass_QC.ExaminingNo   = myDataRow["WelderMarkNo"].ToString();
                myClass_QC.CertificateNo = myDataRow["CerNo"].ToString();
                myClass_QC.isQCValid     = true;
                DateTime.TryParse(myDataRow["IssuedOn"].ToString(), out myClass_QC.IssuedOn);
                DateTime.TryParse(myDataRow["ValidDate"].ToString(), out myClass_QC.ValidUntil);
                if (myClass_QC.ValidUntil.Year - myClass_QC.IssuedOn.Year > 20)
                {
                    myClass_QC.OriginalPeriod = 100;
                }
                else
                {
                    myClass_QC.OriginalPeriod = myClass_QC.ValidUntil.Year - myClass_QC.IssuedOn.Year;
                }
                myClass_QC.SupervisionPlace = this.TextBox_SupervisionPlace.Text;
                myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Add);
            }
        }
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            this.CheckData_DataTable();
            if (this.myDataTable.Select("Len(ErrMessage)>0").Length > 0)
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = "有数据不合法,请查看 ErrMessage 字段返回信息! ";
                return;
            }
            else
            {
                if (MessageBox.Show("确认导入吗?", "确认窗口", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }

            Class_Welder  myClass_Welder;
            Class_Student myClass_Student;
            Class_Issue   myClass_Issue;
            //string str_ErrMessage;
            bool bool_WelderFilled;

            foreach (DataRow myDataRow in this.myDataTable.Rows)
            {
                //myDataRow["ErrMessage"] = "";
                //str_ErrMessage = "";
                myClass_Issue = new Class_Issue(myDataRow["IssueNo"].ToString().Trim());

                myClass_Welder = new Class_Welder();
                myClass_Welder.IdentificationCard = myDataRow["IdentificationCard"].ToString().Trim();
                bool_WelderFilled = myClass_Welder.FillData();

                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         = myDataRow["WelderEmployerHPID"].ToString();
                myClass_Welder.myClass_BelongUnit.DepartmentHPID       = myDataRow["WelderDepartmentHPID"].ToString();
                myClass_Welder.myClass_BelongUnit.WorkPlaceHPID        = myDataRow["WelderWorkPlaceHPID"].ToString();
                myClass_Welder.myClass_BelongUnit.LaborServiceTeamHPID = myDataRow["WelderLaborServiceTeamHPID"].ToString();

                //str_ErrMessage = myClass_Welder.CheckField();
                //if (!string.IsNullOrEmpty(str_ErrMessage))
                //{
                //    myDataRow["ErrMessage"] = str_ErrMessage;
                //    continue;
                //}

                if (bool_WelderFilled)
                {
                    myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Modify);
                }
                else
                {
                    myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Add);
                }
                Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(myClass_Issue.ShipClassificationAb);
                if (!Class_TestCommitteeRegistrationNo.ExistSecond(myClass_ShipClassification.TestCommitteeID, myClass_Welder.IdentificationCard, Enum_zwjKindofUpdate.Exist))
                {
                    Class_TestCommittee myClass_TestCommittee = new Class_TestCommittee(myClass_ShipClassification.TestCommitteeID);
                    if (System.Text.RegularExpressions.Regex.IsMatch(myDataRow["RegistrationNo"].ToString().Trim(), myClass_TestCommittee.RegistrationNoRegex))
                    {
                        myClass_TestCommittee.NextRegistrationNo = myDataRow["RegistrationNo"].ToString().Trim();
                        myClass_TestCommittee.AddAndModify(Enum_zwjKindofUpdate.Modify);
                    }
                }

                myClass_ShipClassification.NextExaminingNo   = myDataRow["ExaminingNo"].ToString().Trim();
                myClass_ShipClassification.NextCertificateNo = myDataRow["CertificateNo"].ToString().Trim();
                myClass_ShipClassification.AddAndModify(Enum_zwjKindofUpdate.Modify);
                myClass_Student = new Class_Student();
                myClass_Student.IdentificationCard = myClass_Welder.IdentificationCard;
                myClass_Student.IssueNo            = myClass_Issue.IssueNo;
                myClass_Student.SubjectID          = myDataRow["ExamSubjectID"].ToString().Trim();
                myClass_Student.ExamStatus         = "顺利考试";
                int.TryParse(myDataRow["TheoryResult"].ToString(), out myClass_Student.TheoryResult);
                myClass_Student.SkillResult = true;
                myClass_Student.myClass_WeldingParameter = myClass_Issue.myClass_WeldingParameter;
                if (!string.IsNullOrEmpty(myDataRow["StudentMaterial"].ToString().Trim()))
                {
                    myClass_Student.myClass_WeldingParameter.Material = myDataRow["StudentMaterial"].ToString().Trim();
                }
                if (!string.IsNullOrEmpty(myDataRow["StudentWeldingConsumable"].ToString().Trim()))
                {
                    myClass_Student.myClass_WeldingParameter.WeldingConsumable = myDataRow["StudentWeldingConsumable"].ToString().Trim();
                }
                myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add);

                Class_QC myClass_QC = new Class_QC();
                myClass_QC.ExaminingNo = myClass_Student.ExaminingNo;
                myClass_QC.isQCValid   = true;
                DateTime.TryParse(myDataRow["IssuedOn"].ToString().Trim(), out myClass_QC.IssuedOn);
                int.TryParse(myDataRow["OriginalPeriod"].ToString(), out myClass_QC.OriginalPeriod);
                int.TryParse(myDataRow["PeriodofProlongation"].ToString(), out myClass_QC.PeriodofProlongation);
                myClass_QC.SupervisionPlace = "沪东造船";
                myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Add);

                //str_ErrMessage = myClass_Student.CheckField();
                //if (!string.IsNullOrEmpty(str_ErrMessage))
                //{
                //    myDataRow["ErrMessage"] = str_ErrMessage;
                //    continue;
                //}
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }