private void Button_WelderModify_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.MaskedTextBox_IdentificationCard.Text)) { MessageBox.Show("没有焊工信息修改!"); return; } Form_KindofEmployerWelder_Update myForm = new Form_KindofEmployerWelder_Update(); myForm.bool_Add = false; myForm.myClass_KindofEmployerWelder = new Class_KindofEmployerWelder(int.Parse(this.TextBox_KindofEmployerWelderID.Text)); if (myForm.ShowDialog() == DialogResult.OK) { this.myClass_KindofEmployerStudent.KindofEmployerWelderID = myForm.myClass_KindofEmployerWelder.KindofEmployerWelderID; this.InitControlWelder(myForm.myClass_KindofEmployerWelder); } }
/// <summary> /// 添加数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem_DataGridViewRowAdd_Click(object sender, EventArgs e) { if (this.myEventArgs_KindofEmployer == null) { return; } Form_KindofEmployerWelder_Update myForm = new Form_KindofEmployerWelder_Update(); myForm.myClass_KindofEmployerWelder = new Class_KindofEmployerWelder(); myForm.myClass_KindofEmployerWelder.KindofEmployer = this.myEventArgs_KindofEmployer.str_KindofEmployer; myForm.bool_Add = true; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(false); Class_DataControlBind.SetDataGridViewSelectedPosition("KindofEmployerWelderID", myForm.myClass_KindofEmployerWelder.KindofEmployerWelderID.ToString(), this.dataGridView_Data); } }
/// <summary> /// 修改数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem_DataGridViewRowModify_Click(object sender, EventArgs e) { Form_KindofEmployerWelder_Update myForm = new Form_KindofEmployerWelder_Update(); myForm.myClass_KindofEmployerWelder = new Class_KindofEmployerWelder(); myForm.myClass_KindofEmployerWelder.KindofEmployerWelderID = (int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerWelderID"].Value; if (myForm.myClass_KindofEmployerWelder.FillData()) { myForm.bool_Add = false; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(true); } } else { MessageBox.Show("该行数据已被删除!"); } }