Beispiel #1
0
 private void Form_QC_Update_Load(object sender, EventArgs e)
 {
     if (this.bool_Add)
     {
         if (Class_QC.ExistAndCanDeleteAndDelete(myClass_QC.ExaminingNo, Enum_zwjKindofUpdate.Exist))
         {
             MessageBox.Show("已存在证书,不能添加!");
             this.DialogResult = DialogResult.Cancel;
             this.Close();
             return;
         }
         else
         {
             Class_Student myClass_Student = new Class_Student();
             myClass_Student.ExaminingNo = this.myClass_QC.ExaminingNo;
             if (myClass_Student.FillData())
             {
                 if (!myClass_Student.isPassed)
                 {
                     MessageBox.Show("该学员不合格!");
                     this.DialogResult = DialogResult.Cancel;
                     this.Close();
                     return;
                 }
             }
             else
             {
                 MessageBox.Show("不存在该项,可能已删除!");
                 this.DialogResult = DialogResult.Cancel;
                 this.Close();
                 return;
             }
         }
     }
     else
     {
         if (!Class_QC.ExistAndCanDeleteAndDelete(myClass_QC.ExaminingNo, 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_QCBase1.InitControl(this.myClass_QC, this.bool_Add);
 }
Beispiel #2
0
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            this.userControl_QCBase1.FillClass();
            String str_ErrMessage;

            str_ErrMessage = this.myClass_QC.CheckField();
            if (str_ErrMessage != null)
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = str_ErrMessage;
                return;
            }
            if (this.bool_Add)
            {
                if (Class_QC.ExistAndCanDeleteAndDelete(this.myClass_QC.ExaminingNo, Enum_zwjKindofUpdate.Exist))
                {
                    this.label_ErrMessage.Text = "证书已添加!";
                    this.DialogResult          = DialogResult.None;
                    return;
                }
                if ((!string.IsNullOrEmpty(this.myClass_QC.CertificateNo)) && Class_QC.ExistSecond(this.myClass_QC.CertificateNo, null, Enum_zwjKindofUpdate.Exist))
                {
                    this.label_ErrMessage.Text = "证号不能重复!";
                    this.DialogResult          = DialogResult.None;
                    return;
                }
                if (!this.myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Add))
                {
                    this.label_ErrMessage.Text = "添加不成功,可能是证号重复!";
                    this.DialogResult          = DialogResult.None;
                    return;
                }
            }
            else
            {
                if (Class_QC.ExistSecond(this.myClass_QC.CertificateNo, this.myClass_QC.ExaminingNo, Enum_zwjKindofUpdate.Modify))
                {
                    this.DialogResult          = DialogResult.None;
                    this.label_ErrMessage.Text = "证号不能重复!";
                    return;
                }
                this.myClass_QC.AddAndModify(Enum_zwjKindofUpdate.Modify);
            }
        }
Beispiel #3
0
        private void InitDataGridView2015()
        {
            OpenFileDialog myForm = new OpenFileDialog();

            myForm.Filter           = "data files (*.data)|*.data|All files (*.*)|*.*";
            myForm.RestoreDirectory = true;
            if (myForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            DataTable myDataTable_Temp = new DataTable();

            ADODB.Recordset rs = new ADODB.Recordset();
            rs.Open(myForm.FileName, Type.Missing, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, 0);
            OleDbDataAdapter myAdapter = new OleDbDataAdapter();

            myAdapter.Fill(myDataTable_Temp, rs);
            rs.Close();

            this.myDataTable          = myDataTable_Temp.Clone();
            this.myDataTable_NotValid = myDataTable_Temp.Clone();
            bool bool_Valid;

            foreach (DataRow myDataRow in myDataTable_Temp.Rows)
            {
                bool_Valid = true;
                if (string.IsNullOrEmpty(myDataRow["CerNo"].ToString()))
                {
                    bool_Valid = false;
                }
                if (!Class_Student.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist))
                {
                    bool_Valid = false;
                }
                else
                {
                    if (Class_QC.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist))
                    {
                        bool_Valid = false;
                    }
                    else
                    {
                        if (Class_QC.ExistSecond(myDataRow["CerNo"].ToString(), null, Enum_zwjKindofUpdate.Add))
                        {
                            bool_Valid = false;
                        }
                        else
                        {
                        }
                    }
                }
                if (bool_Valid)
                {
                    this.myDataTable.ImportRow(myDataRow);
                }
                else
                {
                    this.myDataTable_NotValid.ImportRow(myDataRow);
                }
            }
            this.dataGridView_Data.DataSource     = this.myDataTable;
            this.dataGridView_NotValid.DataSource = this.myDataTable_NotValid;
            this.label_Data.Text     = string.Format("可以导入的数据,{0}", this.dataGridView_Data.RowCount);
            this.label_NotValid.Text = string.Format("不能导入的数据,{0}", this.dataGridView_NotValid.RowCount);
        }
Beispiel #4
0
        private void InitDataGridView()
        {
            OpenFileDialog myForm = new OpenFileDialog();

            myForm.Filter           = "Access files (*.mdb)|*.mdb";
            myForm.RestoreDirectory = true;
            if (myForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string str_Conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + myForm.FileName + ";Persist Security Info=True";
            string str_SQL;

            str_SQL = "Select * From TB_Certificate_Info";
            DataTable        myDataTable_Temp = new DataTable();
            OleDbDataAdapter myAdapter        = new OleDbDataAdapter(str_SQL, str_Conn);

            myAdapter.Fill(myDataTable_Temp);

            this.myDataTable          = myDataTable_Temp.Clone();
            this.myDataTable_NotValid = myDataTable_Temp.Clone();
            bool bool_Valid;

            foreach (DataRow myDataRow in myDataTable_Temp.Rows)
            {
                bool_Valid = true;
                if (string.IsNullOrEmpty(myDataRow["CerNo"].ToString()))
                {
                    bool_Valid = false;
                }
                if (!Class_Student.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist))
                {
                    bool_Valid = false;
                }
                else
                {
                    if (Class_QC.ExistAndCanDeleteAndDelete(myDataRow["WelderMarkNo"].ToString(), Enum_zwjKindofUpdate.Exist))
                    {
                        bool_Valid = false;
                    }
                    else
                    {
                        if (Class_QC.ExistSecond(myDataRow["CerNo"].ToString(), null, Enum_zwjKindofUpdate.Add))
                        {
                            bool_Valid = false;
                        }
                        else
                        {
                        }
                    }
                }
                if (bool_Valid)
                {
                    this.myDataTable.ImportRow(myDataRow);
                }
                else
                {
                    this.myDataTable_NotValid.ImportRow(myDataRow);
                }
            }
            this.dataGridView_Data.DataSource     = this.myDataTable;
            this.dataGridView_NotValid.DataSource = this.myDataTable_NotValid;
            this.label_Data.Text     = string.Format("可以导入的数据,{0}", this.dataGridView_Data.RowCount);
            this.label_NotValid.Text = string.Format("不能导入的数据,{0}", this.dataGridView_NotValid.RowCount);
        }