private void btn_Add_Click(object sender, EventArgs e) { Form_GeographyEnvAdd addOrEdit = new Form_GeographyEnvAdd("add", null); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("添加", addOrEdit.geographyEnvInfo); RefreshDataGridView(); } }
private void btn_Edit_Click(object sender, EventArgs e) { if (DataView.SelectedRows.Count < 1) { MessageBox.Show("请选中一行数据!"); return; } CADS.Model.GeographyEnvInfoList geographyEnvInfo = new CADS.Model.GeographyEnvInfoList(); geographyEnvInfo.ID = Convert.ToInt32(DataView.CurrentRow.Cells[0].Value); geographyEnvInfo.ZoneID = DataView.CurrentRow.Cells[1].Value.ToString(); geographyEnvInfo.ZoneScale = DataView.CurrentRow.Cells[2].Value.ToString(); geographyEnvInfo.GeographyEnv = DataView.CurrentRow.Cells[3].Value.ToString(); geographyEnvInfo.RoadTransport = DataView.CurrentRow.Cells[4].Value.ToString(); geographyEnvInfo.WaterSystem = DataView.CurrentRow.Cells[5].Value.ToString(); geographyEnvInfo.Description = DataView.CurrentRow.Cells[6].Value.ToString(); Form_GeographyEnvAdd addOrEdit = new Form_GeographyEnvAdd("edit", geographyEnvInfo); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("编辑", addOrEdit.geographyEnvInfo); RefreshDataGridView(); } }