//初始化详细信息 public void setControlValue(JbxxViewForm jvf, string cName, String val, bool enable) { if (cName == null || "" == cName) { return; } Control[] c = jvf.Controls.Find(cName, true); if (c.Length > 0) { if (c[0] is TextEdit) { c[0].Text = val; } if (c[0] is DevExpress.XtraEditors.ComboBoxEdit) { DevExpress.XtraEditors.ComboBoxEdit cbe = c[0] as DevExpress.XtraEditors.ComboBoxEdit; cbe.Text = val; if (cbe.Text == "汽油" || cbe.Text == "柴油" || cbe.Text == "两用燃料" || cbe.Text == "双燃料" || cbe.Text == "纯电动" || cbe.Text == "非插电式混合动力" || cbe.Text == "插电式混合动力" || cbe.Text == "燃料电池") { string rlval = cbe.Text; if (cbe.Text == "汽油" || cbe.Text == "柴油" || cbe.Text == "两用燃料" || cbe.Text == "双燃料") { rlval = "传统能源"; } // 构建燃料参数控件 jvf.getParamList(rlval, false); } } c[0].Enabled = enable; } }
// 查看详细 private void dgvCljbxx_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)dgvCljbxx.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(); 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; jvf.setVisible("btnbaocun", false); jvf.setVisible("btnbaocunshangbao", false); Utils.SetFormMid(jvf); jvf.formClosingEventHandel += new FormClosingEventHandler(refrashBySubForm); jvf.ShowDialog(); }