private void toolStripMenuItem_DataGridViewRowAdd_Click(object sender, EventArgs e) { Class_ShipClassification myClass_ShipClassification; if (string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipClassificationAb)) { MessageBox.Show("请先选择船级社!"); return; } else { myClass_ShipClassification = new Class_ShipClassification(this.myEventArgs_ShipClassification.str_ShipClassificationAb); if (myClass_ShipClassification.ShipRestrict && string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipboardNo)) { MessageBox.Show("请先选择船号!"); return; } } if (this.myEventArgs_ShipClassification.bool_GXTheory) { Form_GXTheoryIssue_Update myForm = new Form_GXTheoryIssue_Update(); myForm.myClass_GXTheoryIssue = new Class_GXTheoryIssue(); myForm.bool_Add = true; myForm.myClass_GXTheoryIssue.ShipClassificationAb = this.myEventArgs_ShipClassification.str_ShipClassificationAb; myForm.myClass_GXTheoryIssue.ShipboardNo = this.myEventArgs_ShipClassification.str_ShipboardNo; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(true); Class_DataControlBind.SetDataGridViewSelectedPosition("IssueNo", myForm.myClass_GXTheoryIssue.IssueNo, this.dataGridView_Data); } } else { Form_Issue_Update myForm = new Form_Issue_Update(); myForm.myClass_Issue = new Class_Issue(); myForm.bool_Add = true; myForm.myClass_Issue.ShipClassificationAb = this.myEventArgs_ShipClassification.str_ShipClassificationAb; myForm.myClass_Issue.ShipboardNo = this.myEventArgs_ShipClassification.str_ShipboardNo; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(true); Class_DataControlBind.SetDataGridViewSelectedPosition("IssueNo", myForm.myClass_Issue.IssueNo, this.dataGridView_Data); } } }
/// <summary> /// 修改数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem_DataGridViewRowModify_Click(object sender, EventArgs e) { if (this.myEventArgs_ShipClassification.bool_GXTheory) { Form_GXTheoryIssue_Update myForm = new Form_GXTheoryIssue_Update(); myForm.myClass_GXTheoryIssue = new Class_GXTheoryIssue(); myForm.myClass_GXTheoryIssue.IssueNo = this.dataGridView_Data.CurrentRow.Cells["IssueNo"].Value.ToString(); if (myForm.myClass_GXTheoryIssue.FillData()) { myForm.bool_Add = false; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(true); } } else { MessageBox.Show("该行数据已被删除!"); } } else { Form_Issue_Update myForm = new Form_Issue_Update(); myForm.myClass_Issue = new Class_Issue(); myForm.myClass_Issue.IssueNo = this.dataGridView_Data.CurrentRow.Cells["IssueNo"].Value.ToString(); if (myForm.myClass_Issue.FillData()) { myForm.bool_Add = false; if (myForm.ShowDialog() == DialogResult.OK) { this.RefreshData(true); } } else { MessageBox.Show("该行数据已被删除!"); } } }