// 查看详细 private void dgvCljbxx_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)gcCljbxx.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string vin = (string)dr.Row.ItemArray[0]; // 获取此VIN的详细信息,带入窗口 string sql = @"select * from FC_CLJBXX where vin = @vin"; OleDbParameter[] param = { new OleDbParameter("@vin", vin) }; DataSet ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, sql, param); DataTable dt = ds.Tables[0]; // 弹出详细信息窗口,可修改 JbxxViewForm jvf = new JbxxViewForm("UPLOADOT"); jvf.status = "1"; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Columns.Count; i++) { DataColumn dc = dt.Columns[i]; Control[] c = jvf.Controls.Find("tb" + dc.ColumnName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = dt.Rows[0].ItemArray[i].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = dt.Rows[0].ItemArray[i].ToString(); if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料" || cb.Text == "纯电动" || cb.Text == "非插电式混合动力" || cb.Text == "插电式混合动力" || cb.Text == "燃料电池") { string rlval = cb.Text; if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料") { rlval = "传统能源"; } // 构建燃料参数控件 jvf.getParamList(rlval, true); } } } } } // 获取燃料信息 string rlsql = @"select e.* from RLLX_PARAM_ENTITY e where e.vin = @vin"; ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, rlsql, param); dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { DataRow drrlxx = dt.Rows[i]; string cName = drrlxx.ItemArray[1].ToString(); Control[] c = jvf.Controls.Find(cName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = drrlxx.ItemArray[3].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = drrlxx.ItemArray[3].ToString(); } } } (jvf.Controls.Find("tc", true)[0] as XtraTabControl).SelectedTabPageIndex = 0; jvf.MaximizeBox = false; jvf.MinimizeBox = false; Utils.SetFormMid(jvf); jvf.formClosingEventHandel += new FormClosingEventHandler(refrashBySubForm); jvf.ShowDialog(); }
// 查看详细 private void ViewDetail(bool flag) { ColumnView cv = (ColumnView)gcCljbxx.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string vin = (string)dr.Row.ItemArray[0]; // 获取此VIN的详细信息,带入窗口 string sql = @"select * from FC_CLJBXX where vin = @vin"; OleDbParameter[] param = { new OleDbParameter("@vin", vin) }; DataSet ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, sql, param); DataTable dtBasic = ds.Tables[0]; // 获取燃料信息 string rlsql = @"select e.* from RLLX_PARAM_ENTITY e, RLLX_PARAM RPE where e.vin = @vin and e.PARAM_CODE=RPE.PARAM_CODE and RPE.STATUS='1'"; ds = AccessHelper.ExecuteDataSet(AccessHelper.conn, rlsql, param); DataTable dtParam = ds.Tables[0]; // 弹出详细信息窗口,可修改 JbxxViewForm jvf = new JbxxViewForm(dtBasic, dtParam, true, flag); if (flag) { jvf.status = "1"; } else { jvf.status = "2"; } if (dtBasic.Rows.Count > 0) { for (int i = 0; i < dtBasic.Columns.Count; i++) { DataColumn dc = dtBasic.Columns[i]; Control[] c = jvf.Controls.Find("tb" + dc.ColumnName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = dtBasic.Rows[0].ItemArray[i].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = dtBasic.Rows[0].ItemArray[i].ToString(); if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料" || cb.Text == "纯电动" || cb.Text == "非插电式混合动力" || cb.Text == "插电式混合动力" || cb.Text == "燃料电池") { string rlval = cb.Text; if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料") { rlval = "传统能源"; } // 构建燃料参数控件 jvf.getParamList(rlval, true); } } } } } for (int i = 0; i < dtParam.Rows.Count; i++) { DataRow drrlxx = dtParam.Rows[i]; string cName = drrlxx.ItemArray[1].ToString(); Control[] c = jvf.Controls.Find(cName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = drrlxx.ItemArray[3].ToString(); continue; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cb = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cb.Text = drrlxx.ItemArray[3].ToString(); } } } (jvf.Controls.Find("tc", true)[0] as XtraTabControl).SelectedTabPageIndex = 0; jvf.MaximizeBox = false; jvf.MinimizeBox = false; Utils.SetFormMid(jvf); jvf.setVisible("btnbaocun", true); jvf.setVisible("btnbaocunshangbao", false); jvf.setVisible("btnCancel", true); jvf.setVisible("btnPrint", true); jvf.formClosingEventHandel += new FormClosingEventHandler(refrashBySubForm); jvf.ShowDialog(); }