Пример #1
0
/// <summary>
/// Get unbound data
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void PivotGridControl_CustomUnboundFieldData(object sender, DevExpress.XtraPivotGrid.CustomFieldDataEventArgs e)
        {
            MobiusDataType  mdt = null;
            NumberMx        nex;
            StringMx        sex;
            DateTimeMx      dex;
            QualifiedNumber qn;
            double          dVal;
            string          cid;
            int             iVal, rti, dri, dri2;

            //int t0 = TimeOfDay.Milliseconds();

            if (PivotGrid.DataSource == null)
            {
                return;
            }

            PivotGridFieldContext fc = GetPivotGridFieldContext(e.Field);

            dri = e.ListSourceRowIndex;
            object vo = Dtm.GetColumnValueWithRowDuplication(fc.ResultsField, dri);

            if (vo != null)
            {
                Type voType = vo.GetType();
                if (MobiusDataType.IsMobiusDataType(vo))
                {
                    if (vo is QualifiedNumber)
                    {
                        qn = vo as QualifiedNumber;
                        if (!Lex.IsDefined(qn.Qualifier))                         // if no qualifier then just use double NumberValue
                        {
                            vo = qn.NumberValue;
                        }
                    }

                    else                     // otherwise convert to a primitive
                    {
                        vo = MobiusDataType.ConvertToPrimitiveValue(vo);
                    }
                }

                if (vo is DateTime)
                {
                    vo = ((DateTime)vo).ToBinary();                     // handle DateTimes as int64 (longs) to avoid performance hit in Dx code
                }
            }

            e.Value = vo;

            return;
        }
Пример #2
0
        public DataTableMx _table;         // associated DataTableMx

        /// <summary>
        /// Get/set a single element in the ItemArray object array
        /// </summary>
        /// <param name="columnIndex"></param>
        /// <returns></returns>

        public object this[int columnIndex]
        {
            get
            {
                if (_itemArray == null)
                {
                    DebugMx.InvalidConditionException("_itemArray == null");
                }

                if (columnIndex < 0 || columnIndex >= _itemArray.Length)
                {
                    DebugMx.InvalidConditionException("columnIndex = " + columnIndex + " out of range for DataRow of size = " + _itemArray.Length);
                }

                object o = _itemArray[columnIndex];
                if (o == null || o is DBNull)
                {
                    return(o);
                }

                else if (Table == null || Table.UseNativeDataTypes)
                {
                    return(o);
                }

                else
                {
                    return(MobiusDataType.ConvertToPrimitiveValue(o));
                }
            }

            set
            {
                _itemArray[columnIndex] = value;
                RowState = DataRowState.Modified;                 // say the row is now modified
                _table.CallDataChangedEventHandlers(ListChangedType.ItemChanged, this);
            }
        }