private void btn_Edit_Click(object sender, EventArgs e) { if (DataView.SelectedRows.Count < 1) { MessageBox.Show("请选中一行数据!"); return; } CADS.Model.MessManageInfoList MessManageInfo = new CADS.Model.MessManageInfoList(); MessManageInfo.ID = Convert.ToInt32(DataView.CurrentRow.Cells[0].Value); MessManageInfo.MessID = DataView.CurrentRow.Cells[1].Value.ToString(); MessManageInfo.Receiver = DataView.CurrentRow.Cells[2].Value.ToString(); MessManageInfo.ReceiveOrg = DataView.CurrentRow.Cells[3].Value.ToString(); MessManageInfo.MessType = DataView.CurrentRow.Cells[4].Value.ToString(); MessManageInfo.IsHandle = DataView.CurrentRow.Cells[5].Value.ToString(); MessManageInfo.MessTitle = DataView.CurrentRow.Cells[6].Value.ToString(); MessManageInfo.MessContent = DataView.CurrentRow.Cells[7].Value.ToString(); MessManageInfo.Attachment = DataView.CurrentRow.Cells[8].Value.ToString(); Form_MsSearchAdd addOrEdit = new Form_MsSearchAdd("edit", MessManageInfo); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("编辑", addOrEdit.MessManageInfo); RefreshDataGridView(); } }
private void btn_Add_Click(object sender, EventArgs e) { Form_MsSearchAdd addOrEdit = new Form_MsSearchAdd("add", null); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("添加", addOrEdit.MessManageInfo); RefreshDataGridView(); } }