private void girdView2DataLoading(DataTable dt)
        {
            gridControl2.DataSource = dt;
            gridView2.BestFitColumns();

            //MessageBox.Show(gridView2.Columns.Count.ToString());

            for (int i = 1; i < gridView2.Columns.Count; i++)
            {
                gridView2.Columns[i].OptionsColumn.ReadOnly = true;  //设置成只读状态
            }

            GridCheckMarksSelection selection = new GridCheckMarksSelection(gridView2); // 增加CHECKBOX

            selection.CheckMarkColumn.VisibleIndex = 0;
            selection.SelectionChanged            += selection_SelectionChanged;
        }
Esempio n. 2
0
        /// <summary>
        /// 添加数据到GridView
        /// 某些列ReadOnly
        /// </summary>
        private void add()
        {
            DataTable table = gridControl1.DataSource as DataTable;

            if (table == null)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("Fct Code", typeof(string)));
                dt.Columns.Add(new DataColumn("Plant", typeof(string)));
                dt.Columns.Add(new DataColumn("材料", typeof(string)));
                dt.Columns.Add(new DataColumn("条形码", typeof(string)));
                dt.Columns.Add(new DataColumn("申请数", typeof(string)));
                dt.Columns.Add(new DataColumn("生产计划数", typeof(string)));
                dt.Columns.Add(new DataColumn("厂家在库", typeof(string)));
                dt.Columns.Add(new DataColumn("材料描述", typeof(string)));
                dt.Columns.Add(new DataColumn("创建日期", typeof(string)));
                dt.Columns.Add(new DataColumn("创建时间", typeof(string)));
                dt.Columns.Add(new DataColumn("创建人", typeof(string)));
                dt.Columns.Add(new DataColumn("创建IP", typeof(string)));

                dt.Rows.Add(getField());
                gridControl1.DataSource = dt;

                GridCheckMarksSelection selection = new GridCheckMarksSelection(gridView1);
                selection.CheckMarkColumn.VisibleIndex = 0;
                selection.SelectionChanged            += grdCheckSelect_SelectionChanged;
                gridView1.Columns["Fct Code"].OptionsColumn.ReadOnly = true;
                gridView1.Columns["Plant"].OptionsColumn.ReadOnly    = true;
                gridView1.Columns["条形码"].OptionsColumn.ReadOnly      = true;
                gridView1.Columns["材料"].OptionsColumn.ReadOnly       = true;
                gridView1.Columns["申请数"].OptionsColumn.ReadOnly      = true;
                gridView1.Columns["生产计划数"].OptionsColumn.ReadOnly    = true;
                gridView1.Columns["厂家在库"].OptionsColumn.ReadOnly     = true;
                gridView1.Columns["材料描述"].OptionsColumn.ReadOnly     = true;
                gridView1.Columns["创建日期"].OptionsColumn.ReadOnly     = true;
                gridView1.Columns["创建时间"].OptionsColumn.ReadOnly     = true;
                gridView1.Columns["创建人"].OptionsColumn.ReadOnly      = true;
                gridView1.Columns["创建IP"].OptionsColumn.ReadOnly     = true;
            }
            else
            {
                table.Rows.Add(getField());
                gridControl1.DataSource = table;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 后台查询数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    getVariable(); //获取变量信息
                    if (vend4.Equals(""))
                    {
                        SecuGlobal.showNG(panelStatus, lblStatus, "vendor code 4 为空");
                        return;
                    }

                    SecuGlobal.GridViewInitial(gridView1, gridControl1);

                    DataTable dt = OracleHelper.ExecuteDataTable(getSql(ls_plant, vend4, ls_sdate, ls_edate));  //ls_plant - %

                    if (dt == null)
                    {
                        SecuGlobal.showOK(panelStatus, lblStatus, "没有查询到符合条件的数据");
                        return;
                    }

                    dt = setDtHeader(dt); //更改标题栏和显示顺序
                    gridControl1.DataSource = dt;
                    gridView1.BestFitColumns();

                    gridView1.Columns["申请单号"].SummaryItem.SummaryType   = SummaryItemType.Count;
                    gridView1.Columns["申请单号"].SummaryItem.DisplayFormat = "All:{0:f0} ";

                    GridCheckMarksSelection selection      = new GridCheckMarksSelection(gridView1); // 增加CHECKBOX
                    selection.CheckMarkColumn.VisibleIndex = 0;
                    selection.SelectionChanged            += selection_SelectionChanged;

                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                });
            }
            catch (Exception err)
            {
                SecuGlobal.showNG(panelStatus, lblStatus, err.Message);
            }
        }
        /// <summary>
        /// 报废未返回序列号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker4_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    btnQuery.Enabled = false;

                    DataTable dt = null;
                    dt           = OracleHelper.ExecuteDataTable(getSql4(vendorCode));
                    dt           = setDtHeader4(dt);

                    gridControl4.DataSource = dt;
                    grdSN.BestFitColumns();

                    GridCheckMarksSelection grdCheckSelect      = new GridCheckMarksSelection(grdSN);
                    grdCheckSelect.CheckMarkColumn.VisibleIndex = 0;
                    grdCheckSelect.SelectionChanged            += grdCheckSelect_SelectionChanged;

                    for (int i = 1; i < grdSN.Columns.Count; i++)
                    {
                        grdSN.Columns[i].OptionsColumn.ReadOnly = true;
                    }


                    grdSN.Columns["Serial No"].SummaryItem.SummaryType   = SummaryItemType.Count;
                    grdSN.Columns["Serial No"].SummaryItem.DisplayFormat = "All: {0:f0} ";

                    btnQuery.Enabled = true;
                    SecuGlobal.showOK(panelStatus, lblStatus, "OK");
                });
            }
            catch (Exception err)
            {
                //XtraMessageBox.Show(this, "System error[ShowData]: " + err.Message);
                SecuGlobal.showNG(panelStatus, lblStatus, err.Message);
            }
        }