Ejemplo n.º 1
0
        private void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e)
        {
            GridView _gv = (GridView)e.View;

            _gv.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(_gv_CustomDrawRowIndicator);
            GridColumn _gcm = _gv.Columns.ColumnByFieldName("MAINID");

            if (_gcm != null)
            {
                _gv.Columns.Remove(_gcm);
            }
            DataView _source = _gv.DataSource as DataView;
            string   _tName  = _source.Table.TableName;

            foreach (GridColumn _gc in _gv.Columns)
            {
                //待改进
                MDQuery_TableColumn _tc = MC_QueryModel.GetColumnDefineByAlias(this.QueryRequest, _tName, _gc.FieldName);
                if (_tc != null)
                {
                    _gc.Caption = _tc.ColumnTitle;
                    _gc.Width   = _tc.DisplayLength;
                }
            }
            this.RaiseViewRegistered(e);
        }
Ejemplo n.º 2
0
        //子记录表注册显示
        private void gridControl2_ViewRegistered(object sender, ViewOperationEventArgs e)
        {
            GridView _gv = e.View as GridView;

            _gv.ViewCaption             = "详细信息";
            _gv.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(_gv_CustomDrawRowIndicator);
            GridColumn _gcm = _gv.Columns.ColumnByFieldName("MAINID");

            if (_gcm != null)
            {
                _gv.Columns.Remove(_gcm);
            }
            DataView _source = _gv.DataSource as DataView;
            string   _tName  = _source.Table.TableName;

            foreach (GridColumn _gc in _gv.Columns)
            {
                //待改进
                MDQuery_TableColumn _tc = MC_QueryModel.GetColumnDefineByAlias(this.QueryRequest, _tName, _gc.FieldName);
                if (_tc != null)
                {
                    _gc.Caption = _tc.ColumnTitle;
                    _gc.Width   = _tc.DisplayLength;
                }
                else
                {
                    _gc.Caption = _source.Table.Columns[_gc.FieldName].Caption;
                }
                _gc.BestFit();
                _gc.OptionsColumn.ReadOnly = true;
            }
            _gv.IndicatorWidth = _gv.RowCount.ToString().Length * 10 + 20;
            this.RaiseViewRegistered(e);
        }
Ejemplo n.º 3
0
        public void RefreshBySaveRequest(MDModel_QueryModel _qv, MDQuery_Request _request)
        {
            this.xtraScrollableControl1.Controls.Clear();
            foreach (MDQuery_ConditionItem _item in _request.ConditionItems)
            {
                switch (_item.Column.ColumnType)
                {
                case QueryColumnType.TableColumn:
                    MDModel_Table_Column _cdefine = MC_QueryModel.GetColumnDefineByAlias(_qv, _item.Column.TableName, _item.Column.ColumnAlias);
                    AddSavedCondition(_cdefine, _item);
                    break;

                case QueryColumnType.CalculationColumn:
                case QueryColumnType.StatisticsColumn:
                    MDModel_Table_Column _ccdefine = new MDModel_Table_Column();
                    _ccdefine.ColumnDataType  = _item.Column.ColumnDataType;
                    _ccdefine.ColumnTitle     = _item.Column.ColumnTitle;
                    _ccdefine.ColumnAlgorithm = _item.Column.ColumnAlgorithm;
                    _ccdefine.ColumnName      = "";
                    _ccdefine.ColumnType      = _item.Column.ColumnType;
                    _ccdefine.TableName       = _item.Column.TableName;
                    _ccdefine.DisplayLength   = _item.Column.DisplayLength;
                    _ccdefine.DisplayFormat   = _item.Column.DisplayFormat;
                    AddSavedCondition(_ccdefine, _item);
                    break;
                }
            }
            this.textEdit1.EditValue = _request.ConditionExpressions;
        }