Exemplo n.º 1
0
        private void button_OnOK_Click(object sender, EventArgs e)
        {
            this.userControl_WeldingSubjectPositionBase1.FillClass();
            String str_ErrMessage;

            str_ErrMessage = this.myClass_WeldingSubjectPosition.CheckField();
            if (str_ErrMessage != null)
            {
                this.DialogResult          = DialogResult.None;
                this.label_ErrMessage.Text = str_ErrMessage;
                return;
            }
            if (this.bool_Add)
            {
                if (!Class_WeldingSubjectPosition.ExistAndCanDeleteAndDelete(this.myClass_WeldingSubjectPosition.SubjectID, myClass_WeldingSubjectPosition.WeldingPosition, Enum_zwjKindofUpdate.Exist))
                {
                    this.myClass_WeldingSubjectPosition.AddAndModify(Enum_zwjKindofUpdate.Add);
                }
                else
                {
                    this.label_ErrMessage.Text = "该考试项目已添加!";
                    this.DialogResult          = DialogResult.None;
                    return;
                }
            }
            else
            {
                this.myClass_WeldingSubjectPosition.AddAndModify(Enum_zwjKindofUpdate.Modify);
            }
        }
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItem_DataGridViewRowDelete_Click(object sender, EventArgs e)
 {
     if (Class_WeldingSubjectPosition.ExistAndCanDeleteAndDelete(this.myEventArgs_WeldingSubject.str_SubjectID, this.dataGridView_Data.CurrentRow.Cells["WeldingPosition"].Value.ToString(), Enum_zwjKindofUpdate.CanDelete))
     {
         if (MessageBox.Show("确认删除吗?", "确认窗口", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             Class_WeldingSubjectPosition.ExistAndCanDeleteAndDelete(this.myEventArgs_WeldingSubject.str_SubjectID, this.dataGridView_Data.CurrentRow.Cells["WeldingPosition"].Value.ToString(), Enum_zwjKindofUpdate.Delete);
             this.RefreshData(false);
         }
     }
     else
     {
         MessageBox.Show("不能删除!");
     }
 }
Exemplo n.º 3
0
 private void Form_WeldingSubjectPositionUpdate_Load(object sender, EventArgs e)
 {
     if (!(this.bool_Add || Class_WeldingSubjectPosition.ExistAndCanDeleteAndDelete(myClass_WeldingSubjectPosition.SubjectID, myClass_WeldingSubjectPosition.WeldingPosition, 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_WeldingSubjectPositionBase1.InitControl(this.myClass_WeldingSubjectPosition, this.bool_Add);
 }