private void EditReport() { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } PSP_ForecastReports report = Itop.Common.DataConverter.RowToObject <PSP_ForecastReports>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); FormForecastReport frm = new FormForecastReport(); frm.IsEdit = true; frm.Psp_ForecastReport = report; frm.Text = "修改预测"; if (frm.ShowDialog() == DialogResult.OK) { Itop.Common.DataConverter.ObjectToRow(frm.Psp_ForecastReport, gridView1.GetDataRow(gridView1.FocusedRowHandle)); } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormForecastReport frm = new FormForecastReport(); frm.IsEdit = false; frm.TypeFlag = typeFlag; frm.Text = "添加新预测"; if (frm.ShowDialog() == DialogResult.OK) { DataRow newRow = dataTable.NewRow(); Itop.Common.DataConverter.ObjectToRow(frm.Psp_ForecastReport, newRow); dataTable.Rows.Add(newRow); gridView1.FocusedRowHandle = gridView1.RowCount - 1; } }
private void EditReport() { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } PSP_ForecastReports report = Itop.Common.DataConverter.RowToObject<PSP_ForecastReports>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); FormForecastReport frm = new FormForecastReport(); frm.IsEdit = true; frm.Psp_ForecastReport = report; frm.Text = "修改预测"; if (frm.ShowDialog() == DialogResult.OK) { Itop.Common.DataConverter.ObjectToRow(frm.Psp_ForecastReport, gridView1.GetDataRow(gridView1.FocusedRowHandle)); } }