//双击行 private void gcOCN_RLLXPARAM_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)gcOCN_RLLXPARAM.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } if (dr.Row["OPERATION"].Equals("4")) { MessageBox.Show(String.Format("OCN为{0}:已经删除,无法进行此操作!", dr.Row["SC_OCN"]), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } RLLXParamForm rllxParamForm = new RLLXParamForm() { Text = "燃料参数修改" }; this.setControlValue(rllxParamForm, "teSC_OCN", dr.Row["SC_OCN"].ToString(), true); this.setControlValue(rllxParamForm, "cbeRLLX", dr.Row["RLLX"].ToString(), true); this.setControlValue(rllxParamForm, "labVERSION", "燃料参数版本号:V" + dr.Row["VERSION"], true); rllxParamForm.ShowDialog(); if (rllxParamForm.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } }
// 新增 private void barBtnAdd_ItemClick(object sender, ItemClickEventArgs e) { using (RLLXParamForm rllxParamForm = new RLLXParamForm()) { rllxParamForm.ShowDialog(); if (rllxParamForm.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } } }
// 修改 private void barBtnEdit_ItemClick(object sender, ItemClickEventArgs e) { if (this.gvOCN_RLLXPARAM.DataSource == null) { MessageBox.Show("没有可以操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.gvOCN_RLLXPARAM.PostEditor(); var dataSource = (DataView)this.gvOCN_RLLXPARAM.DataSource; var dtSelected = dataSource.Table.Copy(); dtSelected.Clear(); if (dataSource != null && dataSource.Table.Rows.Count > 0) { for (int i = 0; i < dataSource.Table.Rows.Count; i++) { bool result = false; bool.TryParse(dataSource.Table.Rows[i]["check"].ToString(), out result); if (result) { dtSelected.Rows.Add(dataSource.Table.Rows[i].ItemArray); } } } if (dtSelected.AsDataView().ToTable(true, new string[] { "SC_OCN", "VERSION" }).Rows.Count != 1) { MessageBox.Show(String.Format("每次只能操作一组记录,您选择了{0}组!", dtSelected.AsDataView().ToTable(true, new string[] { "SC_OCN" }).Rows.Count), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dtSelected.Rows[0]["OPERATION"].Equals("4")) { MessageBox.Show(String.Format("OCN为{0}:已经删除,无法进行此操作!", dtSelected.Rows[0]["SC_OCN"]), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } RLLXParamForm rllxParamForm = new RLLXParamForm() { Text = "燃料参数修改" }; this.setControlValue(rllxParamForm, "teSC_OCN", dtSelected.Rows[0]["SC_OCN"].ToString(), true); this.setControlValue(rllxParamForm, "cbeRLLX", dtSelected.Rows[0]["RLLX"].ToString(), true); this.setControlValue(rllxParamForm, "labOPERATION", "原操作类型号:V" + dtSelected.Rows[0]["OPERATION"], true); this.setControlValue(rllxParamForm, "labVERSION", "燃料参数版本号:V" + dtSelected.Rows[0]["VERSION"], true); rllxParamForm.ShowDialog(); if (rllxParamForm.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } }