private void btn_Dutyadd_Click(object sender, EventArgs e) { Form_PlanAdd addOrEdit = new Form_PlanAdd("add"); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("添加", addOrEdit.planInfo); RefreshDataGridView(); } }
private void btn_DutyEdit_Click(object sender, EventArgs e) { if (dgvPlanInfos.SelectedRows.Count < 1) { MessageBox.Show("请选中一行数据!"); return; } CADS.Model.PlanManageInfoList planInfo = new CADS.Model.PlanManageInfoList(); planInfo.ID = Convert.ToInt32(dgvPlanInfos.CurrentRow.Cells[0].Value); planInfo.PlanID = dgvPlanInfos.CurrentRow.Cells[1].Value.ToString(); planInfo.PlanTitle = dgvPlanInfos.CurrentRow.Cells[2].Value.ToString(); planInfo.Description = dgvPlanInfos.CurrentRow.Cells[3].Value.ToString(); planInfo.Path = dgvPlanInfos.CurrentRow.Cells[4].Value.ToString(); Form_PlanAdd addOrEdit = new Form_PlanAdd("edit", planInfo); addOrEdit.ShowDialog(); if (addOrEdit.DialogResult == DialogResult.OK) { OpreationDB("编辑", addOrEdit.planInfo); RefreshDataGridView(); } }