コード例 #1
0
        //查看详细
        private void ViewDetail(bool flag, string vin)
        {
            //ColumnView cv = (ColumnView)gcCLJBXX.FocusedView;
            //DataRowView dr = (DataRowView)cv.GetFocusedRow();
            //if (dr == null)
            //{
            //    return;
            //}
            //string vin = (string)dr.Row.ItemArray[0];
            DataTable dtBasic = OracleHelper.ExecuteDataSet(OracleHelper.conn, String.Format(@"select * from FC_CLJBXX where vin = '{0}'", vin), null).Tables[0];
            DataTable dtParam = OracleHelper.ExecuteDataSet(OracleHelper.conn, String.Format(@"select e.* from RLLX_PARAM_ENTITY e, RLLX_PARAM RPE where e.vin = '{0}' and e.PARAM_CODE=RPE.PARAM_CODE and RPE.STATUS='1'", vin), null).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("btnbaocunshangbao", false);
            jvf.setVisible("btnCancel", true);
            jvf.setVisible("btnPrint", true);
            jvf.ShowDialog();
            if (jvf.DialogResult == DialogResult.Cancel)
            {
                this.refrashCurrentPage();
            }
        }
コード例 #2
0
ファイル: SearchLocalForm.cs プロジェクト: qwdingyu/C-
        //双击查看详细
        private void gvCLJBXX_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];
            DataTable dtJbxx = OracleHelper.ExecuteDataSet(OracleHelper.conn, String.Format(@"select * from FC_CLJBXX where vin = '{0}'", vin), null).Tables[0];
            DataTable dtRlxx = OracleHelper.ExecuteDataSet(OracleHelper.conn, String.Format(@"select * from RLLX_PARAM_ENTITY where vin = '{0}'", vin), null).Tables[0];
            // 弹出详细信息窗口,可修改
            JbxxViewForm jvf = new JbxxViewForm()
            {
                status = "1"
            };

            if (dtJbxx.Rows.Count > 0)
            {
                for (int i = 0; i < dtJbxx.Columns.Count; i++)
                {
                    DataColumn dc = dtJbxx.Columns[i];
                    Control[]  c  = jvf.Controls.Find("tb" + dc.ColumnName, true);
                    if (c.Length > 0)
                    {
                        if (c[0] is TextEdit)
                        {
                            c[0].Text = dtJbxx.Rows[0].ItemArray[i].ToString();
                            continue;
                        }
                        if (c[0] is ComboBoxEdit)
                        {
                            ComboBoxEdit cb = c[0] as ComboBoxEdit;
                            cb.Text = dtJbxx.Rows[0].ItemArray[i].ToString();
                            if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" ||
                                cb.Text == "双燃料" || cb.Text == "纯电动" || cb.Text == "非插电式混合动力" || cb.Text == "插电式混合动力" || cb.Text == "燃料电池")
                            {
                                string rlval;
                                if (cb.Text == "汽油" || cb.Text == "柴油" || cb.Text == "两用燃料" || cb.Text == "双燃料")
                                {
                                    rlval = "传统能源";
                                }
                                else
                                {
                                    rlval = cb.Text;
                                }
                                // 构建燃料参数控件
                                jvf.getParamList(rlval, true);
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < dtRlxx.Rows.Count; i++)
            {
                DataRow   drrlxx = dtRlxx.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 ComboBoxEdit)
                    {
                        ComboBoxEdit cb = c[0] as 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.ShowDialog();
            if (jvf.DialogResult == DialogResult.Cancel)
            {
                this.refrashCurrentPage();
            }
        }