//删除关系 private void btnDelete_Click(object sender, EventArgs e) { pageStatus = RecordStatus.View; SetFormControlerStatus(); SetFormControlerData(); if (MessageBox.Show("您确定要删除所选系统吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { selectSource = dataGridView_relation.CurrentRow.Cells[1].Value.ToString(); selectTarget = dataGridView_relation.CurrentRow.Cells[2].Value.ToString(); if (RelationOperator.DeleteRelationInfo(selectSource, selectTarget)) { RelationEditForm_Load(sender, e); } } else { selectSource = dataGridView_relation.CurrentRow.Cells[1].Value.ToString(); selectTarget = dataGridView_relation.CurrentRow.Cells[2].Value.ToString(); DataRow dr = relationdata.Tables[RelationData.RELATION_TABLE].Select(RelationData.SOURCENAME_FIELD + "='" + selectSource + "' and " + RelationData.TARGETNAME_FIELD + "='" + selectTarget + "'")[0]; name.Text = dr[RelationData.NAME_FIELD].ToString(); source.Text = dr[RelationData.SOURCENAME_FIELD].ToString(); target.Text = dr[RelationData.TARGETNAME_FIELD].ToString(); type.Text = dr[RelationData.TYPE_FIELD].ToString(); comboBox_Type.Text = dr[RelationData.TYPE_FIELD].ToString(); comment.Text = dr[RelationData.COMMENT_FIELD].ToString(); if (dr[RelationData.BIDIRECTION_FIELD].ToString() == "0") { radioButton_single.Checked = true; radioButton_bidirection.Checked = false; } else { radioButton_single.Checked = false; radioButton_bidirection.Checked = true; } if (dr[RelationData.SHOW_FIELD].ToString() == "1") { checkBox_showRelationName.Checked = true; } else { checkBox_showRelationName.Checked = false; } } }