Example #1
0
        internal Item(IntPtr ItemPointer, DFSBase DFS, int Number)
        {
            ItemNumber = Number;
            _dfs       = DFS;
            int item_type  = 0;
            int data_type  = 0;
            int value_type = 0;

            IntPtr name = new IntPtr();
            IntPtr Eum  = new IntPtr();

            this.ItemPointer = ItemPointer;
            DfsDLLAccess.dfsGetItemInfo_(ItemPointer, out item_type, ref name, ref Eum, out data_type);
            DfsDLLAccess.dfsGetItemValueType(ItemPointer, out value_type);
            NumberOfElements = (int)DfsDLLAccess.dfsGetItemElements(ItemPointer);


            valueType     = (DataValueType)value_type;
            _name         = (Marshal.PtrToStringAnsi(name));
            eumUnitString = Marshal.PtrToStringAnsi(Eum);
            if (item_type != 0)
            {
                _eumitem = (eumItem)item_type;
            }
        }
        internal static Tuple <DataValueType, DataValueType, bool, object> GetSeriesKey(StackedColumnSeries series)
        {
            DataValueType dataValueType = series.ActualYValueType;

            if (dataValueType == DataValueType.Auto)
            {
                if (series.ChartArea != null)
                {
                    XYSeries xySeries = (XYSeries)Enumerable.FirstOrDefault <ColumnSeries>(Enumerable.OfType <ColumnSeries>((IEnumerable)series.ChartArea.GetSeries()), (Func <ColumnSeries, bool>)(s => s.ActualYValueType != DataValueType.Auto));
                    if (xySeries != null)
                    {
                        dataValueType = xySeries.ActualYValueType;
                    }
                }
                if (dataValueType == DataValueType.Auto && series.ActualYDataRange.HasData)
                {
                    dataValueType = ValueHelper.GetDataValueType((object)series.ActualYDataRange.Minimum);
                }
                else
                {
                    series.UpdateActualValueTypes();
                    dataValueType = series.ActualYValueType;
                }
            }
            if (dataValueType == DataValueType.Integer)
            {
                dataValueType = DataValueType.Float;
            }
            return(new Tuple <DataValueType, DataValueType, bool, object>(dataValueType, series.ActualXValueType, series.IsHundredPercent, series.GroupingKey));
        }
Example #3
0
        public static ValueAggregator GetAggregator(DataValueType valueType)
        {
            switch (valueType)
            {
            case DataValueType.Auto:
                return((ValueAggregator) new DefaultValueAggregator());

            case DataValueType.Category:
                return((ValueAggregator) new CategoryValueAggregator());

            case DataValueType.Integer:
                return((ValueAggregator) new Int64ValueAggregator());

            case DataValueType.Float:
                return((ValueAggregator) new DoubleValueAggregator());

            case DataValueType.DateTime:
            case DataValueType.Date:
                return((ValueAggregator) new DateTimeValueAggregator());

            case DataValueType.Time:
            case DataValueType.TimeSpan:
                return((ValueAggregator) new TimeValueAggregator());

            case DataValueType.DateTimeOffset:
                return((ValueAggregator) new DateTimeOffsetValueAggregator());

            default:
                throw new NotSupportedException();
            }
        }
Example #4
0
            public override Scale Create(DataValueType valueType)
            {
                DateTimeScale dateTimeScale = new DateTimeScale();

                dateTimeScale.ValueType = valueType;
                return((Scale)dateTimeScale);
            }
Example #5
0
 public ExpressionNode(
     RedILNodeType nodeType,
     DataValueType dataType)
     : base(nodeType)
 {
     DataType = dataType;
 }
Example #6
0
    internal Item(IntPtr ItemPointer, DFSBase DFS, int Number)
    {
      ItemNumber = Number;
      _dfs = DFS;
      int item_type = 0;
      int data_type = 0;
      int value_type = 0;
      
      IntPtr name = new IntPtr();
      IntPtr Eum = new IntPtr();

      this.ItemPointer = ItemPointer;
      DfsDLLAccess.dfsGetItemInfo_(ItemPointer, out item_type, ref name, ref Eum, out data_type);
      DfsDLLAccess.dfsGetItemValueType(ItemPointer, out value_type);
      NumberOfElements =(int) DfsDLLAccess.dfsGetItemElements(ItemPointer);

      DataType = (DfsSimpleType)data_type;
      valueType = (DataValueType)value_type;
      _name = (Marshal.PtrToStringAnsi(name));
      eumUnitString = Marshal.PtrToStringAnsi(Eum);
      if(item_type!=0)
        _eumitem = (eumItem)item_type;


    }
Example #7
0
 public PredictionOfCurrencyDataManager(DataParameter dataParameter, DataProcessingMethods dataProcessingMethods,
                                        DataValueType dataType, string nameOfCollectorForPredict, List <IDataCollector> collectors)
 {
     Collectors            = collectors;
     DataParameter         = dataParameter;
     DataProcessingMethods = dataProcessingMethods;
     DataType = dataType;
     NameOfCollectorForPredict = nameOfCollectorForPredict;
     Names = new string[Collectors.Count];
     for (var i = 0; i < Collectors.Count; i++)
     {
         Names[i] = Collectors[i].GetType().Name;
     }
     DataValueTypeConverter = new Dictionary <DataValueType, Func <PredictionOfCurrencyDataTable, PredictionOfCurrencyDataTable> > {
         { DataValueType.Absolute, x => x },
         { DataValueType.Relative, ConvertInRelative },
         { DataValueType.RelativePercentage, ConvertInRelativePercentage }
     };
     DataProcessingMethodsConverter = new Dictionary <DataProcessingMethods, Func <PredictionOfCurrencyDataTable, PredictionOfCurrencyDataTable> > {
         { DataProcessingMethods.None, x => x },
         { DataProcessingMethods.Normalize, Normalize },
         { DataProcessingMethods.Scale, Scale },
         { DataProcessingMethods.NormalizeAndScale, NormalizeAndScale },
     };
 }
Example #8
0
            public override Scale Create(DataValueType valueType)
            {
                CategoryScale categoryScale = new CategoryScale();

                categoryScale.ValueType = valueType;
                return((Scale)categoryScale);
            }
Example #9
0
        public static bool CheckUniformDataType <T>(ObservableCollection <T> collection, DependencyProperty property)
        {
            DataValueType dataValueType1 = DataValueType.Auto;

            foreach (T obj1 in (Collection <T>)collection)
            {
                DependencyObject dependencyObject = (object)obj1 as DependencyObject;
                if (dependencyObject != null)
                {
                    object obj2 = dependencyObject.GetValue(property);
                    if (obj2 != null)
                    {
                        DataValueType dataValueType2 = ValueHelper.GetDataValueType(obj2);
                        if (dataValueType1 == DataValueType.Auto)
                        {
                            dataValueType1 = dataValueType2;
                        }
                        else if (dataValueType1 != dataValueType2)
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Example #10
0
        public static bool HasPositivesAndNegatives(IEnumerable <object> values)
        {
            DataValueType   dataValueType      = ValueHelper.GetDataValueType(values);
            ValueAggregator positiveAggregator = ValueAggregator.GetPositiveAggregator(dataValueType);
            ValueAggregator negativeAggregator = ValueAggregator.GetNegativeAggregator(dataValueType);
            bool            flag1 = false;
            bool            flag2 = false;

            foreach (object obj in values)
            {
                bool flag3 = positiveAggregator.CanPlot(obj);
                bool flag4 = negativeAggregator.CanPlot(obj);
                if (flag3 != flag4)
                {
                    if (flag3)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag1 = true;
                    }
                    if (flag2 && flag1)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #11
0
        private static string DatatTableColumn(string param, IEnumerable <DataTableColunmEntity> value)
        {
            var dataValueType = new DataValueType();
            var tmpClass      = string.Empty;

            foreach (var item in value)
            {
                if (!string.IsNullOrEmpty(item.KEY_TYPE))
                {
                    if (param == item.TABLE_NAME)
                    {
                        tmpClass = tmpClass + Environment.NewLine +
                                   (@"[PrimaryKey]" + Environment.NewLine +
                                    "public " + dataValueType.ColumnTypes(item.DATA_TYPE == "date" ? "DateTime" : item.DATA_TYPE) + " " + item.COLUMN_NAME + " { get; set; }" + Environment.NewLine);
                    }
                }
                else
                {
                    if (param == item.TABLE_NAME)
                    {
                        tmpClass = tmpClass + Environment.NewLine +
                                   (@"public " + dataValueType.ColumnTypes(item.DATA_TYPE == "date" ? "DateTime" : item.DATA_TYPE) + " " + item.COLUMN_NAME + " { get; set; }" + Environment.NewLine);
                    }
                }

                //Log.LogItem(item.TABLE_NAME, "Entity Classları oluşturuldu");
            }
            tmpClass += @"" + Environment.NewLine +
                        "}" + Environment.NewLine +
                        "}";
            return(tmpClass);
        }
Example #12
0
            public override Scale Create(DataValueType valueType)
            {
                NumericScale numericScale = new NumericScale();

                numericScale.ValueType = valueType;
                return((Scale)numericScale);
            }
Example #13
0
        private static DataValueType DecideValueType(BinaryExpressionOperator op, DataValueType left, DataValueType right)
        {
            if (op.IsArithmetic())
            {
                if (left == DataValueType.Integer && right == DataValueType.Integer)
                {
                    return(DataValueType.Integer);
                }
                else if (left == DataValueType.Boolean && right == DataValueType.Boolean)
                {
                    return(DataValueType.Boolean);
                }
                else if (left == DataValueType.Float || right == DataValueType.Float)
                {
                    return(DataValueType.Float);
                }
                else if (left == DataValueType.String || right == DataValueType.String)
                {
                    return(DataValueType.String);
                }
            }
            else if (op.IsLogical() || op.IsRelational())
            {
                return(DataValueType.Boolean);
            }

            return(DataValueType.Unknown);
        }
Example #14
0
 public override bool CanProject(DataValueType valueType)
 {
     if (valueType != DataValueType.Float && valueType != DataValueType.Integer)
     {
         return(valueType == DataValueType.Auto);
     }
     return(true);
 }
Example #15
0
 public CallRedisMethodNode(
     string method,
     DataValueType type,
     ExpressionNode caller,
     IList <ExpressionNode> arguments)
     : this((ConstantValueNode)method, type, caller, arguments)
 {
 }
Example #16
0
 public override bool CanProject(DataValueType valueType)
 {
     if (valueType != DataValueType.Date && valueType != DataValueType.DateTime && (valueType != DataValueType.Time && valueType != DataValueType.DateTimeOffset))
     {
         return(valueType == DataValueType.Auto);
     }
     return(true);
 }
Example #17
0
 public override bool CanProject(DataValueType valueType)
 {
     if (valueType != DataValueType.Category)
     {
         return(valueType == DataValueType.Auto);
     }
     return(true);
 }
 /// <summary>
 /// Fills columns of the new entity by values from the source <paramref name="sourceEntity"/>.
 /// </summary>
 /// <param name="sourceEntity">The entity, from which column values will be copied.</param>
 /// <param name="newEntity">The entity, to which column values will be copied.</param>
 /// <param name="recipientEntityId">The recipient id, which data will be linked to.</param>
 /// <param name="refColumnName">Reference column name.</param>
 /// <param name="entitySchemaName">The new entity schema name for <paramref name="recipientEntityId"/>.</param>
 protected virtual void FillEntityColumnValues(Entity sourceEntity, Entity newEntity, Guid recipientEntityId,
                                               string refColumnName, string entitySchemaName)
 {
     newEntity.SetDefColumnValues();
     foreach (var column in sourceEntity.Schema.Columns)
     {
         if (!column.IsValueCloneable)
         {
             continue;
         }
         DataValueType dataValueType = column.DataValueType;
         if (dataValueType.IsLookup)
         {
             object columnValue;
             object displayColumnValue;
             string columnValueName        = column.ColumnValueName;
             string displayColumnValueName = column.DisplayColumnValueName;
             if (column.Name == refColumnName)
             {
                 Entity entity = _userConnection.EntitySchemaManager
                                 .GetInstanceByName(entitySchemaName).CreateEntity(_userConnection);
                 entity.FetchFromDB(recipientEntityId);
                 columnValue        = entity.GetColumnValue(entity.Schema.PrimaryColumn.Name);
                 displayColumnValue = entity.GetColumnValue(entity.Schema.PrimaryDisplayColumn.Name);
             }
             else
             {
                 columnValue        = sourceEntity.GetColumnValue(columnValueName);
                 displayColumnValue = sourceEntity.GetColumnValue(displayColumnValueName);
             }
             newEntity.SetColumnValue(columnValueName, columnValue);
             newEntity.SetColumnValue(displayColumnValueName, displayColumnValue);
             continue;
         }
         string columnName = column.Name;
         object value      = sourceEntity.GetColumnValue(columnName);
         if (!dataValueType.IsBinary)
         {
             if (columnName != sourceEntity.Schema.GetPrimaryColumnName())
             {
                 newEntity.SetColumnValue(columnName, value);
                 continue;
             }
         }
         else
         {
             var byteArray = value as byte[];
             if (byteArray != null)
             {
                 newEntity.SetBytesValue(columnName, byteArray);
             }
             else
             {
                 newEntity.SetStreamValue(columnName, value as Stream);
             }
         }
     }
 }
        public virtual Select ProcessDynamicFolder(Guid folderId)
        {
            var           dataValueTypeManager   = (DataValueTypeManager)UserConnection.AppManagerProvider.GetManager("DataValueTypeManager");
            DataValueType dateTimeDataValueType  = dataValueTypeManager.GetInstanceByName("DateTime");
            DataValueType guidDataValueType      = dataValueTypeManager.GetInstanceByName("Guid");
            DataValueType intDataValueType       = dataValueTypeManager.GetInstanceByName("Integer");
            EntitySchema  targetSchema           = UserConnection.EntitySchemaManager.GetInstanceByUId(TargetSchemaUId);
            IEntitySchemaQueryFilterItem filters = CommonUtilities.GetFolderEsqFilters(
                UserConnection, folderId, TargetFolderSchemaUId, TargetSchemaUId, true);
            var esq = new EntitySchemaQuery(targetSchema);

            if (RootSchemaName.Equals("BulkEmail") || RootSchemaName.Equals("BulkEmailSplit"))
            {
                esq.AddColumn(RootSchemaRecordRId, intDataValueType).SetForcedQueryColumnValueAlias("RootSchemaRecordId");
                esq.AddColumn("Email");
            }
            else
            {
                esq.AddColumn(RootSchemaRecordId, guidDataValueType).SetForcedQueryColumnValueAlias("RootSchemaRecordId");;
                esq.AddColumn(DefResponseId, guidDataValueType);
                esq.AddColumn(true, dataValueTypeManager.GetInstanceByName("Boolean"));
                esq.AddColumn(UserConnection.CurrentUser.ContactId, guidDataValueType);
                esq.AddColumn(UserConnection.CurrentUser.ContactId, guidDataValueType);
                esq.AddColumn("Id").SetForcedQueryColumnValueAlias("ContactRecordId");
                if (IsSetCampaignFirstStep == true && RootSchemaName == "Campaign")
                {
                    var campaignFirstStepId = GetCampaignFirstStep(RootSchemaRecordId);
                    esq.AddColumn(campaignFirstStepId, guidDataValueType).SetForcedQueryColumnValueAlias("CurrentStepId");
                }
            }
            if (filters != null)
            {
                esq.Filters.Add(filters);
            }
            Select folderQuery = esq.GetSelectQuery(UserConnection);
            Select resultSelect;

            switch (RootSchemaName)
            {
            case "Event":
                resultSelect = GetContactInEventDynamicFolderProcessingQuery(folderQuery);
                break;

            case "BulkEmailSplit":
            case "BulkEmail":
                resultSelect = GetContactInBulkEmailDynamicFolderProcessingQuery(folderQuery);
                break;

            case "Campaign":
                resultSelect = GetContactInCampaignDynamicFolderProcessingQuery(folderQuery);
                break;

            default:
                resultSelect = null;
                break;
            }
            return(resultSelect);
        }
Example #20
0
 // Standard constructor for most DataValueTypes
 public ValueReference(string n, int index, DataValueType t, bool editable=true)
 {
     valueIndex = index;
     ValueType = t;
     Name = n;
     Editable = editable;
     if (t == DataValueType.ByteBits || t == DataValueType.ByteBit)
         throw new Exception("Wrong constructor");
 }
Example #21
0
        private static object GetQueryValue(object rawValue, DataValueType dataValueType)
        {
            if (DataValueTypeUtilities.IsDateDataValueType(dataValueType) && rawValue != null)
            {
                return($"\"{((DateTime)rawValue):yyyy-MM-ddTHH:mm:ss.fff}\"");
            }

            return(rawValue);
        }
Example #22
0
 public TableKeyAccessNode(
     ExpressionNode table,
     ExpressionNode key,
     DataValueType type)
     : base(RedILNodeType.TableKeyAccess, type)
 {
     Table = table;
     Key   = key;
 }
Example #23
0
 public void Update(Dictionary <string, List <IValidator> > conditions, List <object> row)
 {
     if (!ValidateDataTypes(row))
     {
         throw new DataValueTypeException("Incorrect data types! Expected: " +
                                          Entity.Schema.Columns.Select(x => DataValueType.GetType(x.DataValueType).Name).Aggregate((x, y) => $"{x}, {y}"));
     }
     _storage.Update(Entity, conditions, row);
 }
Example #24
0
 // Constructor for DataValueType.ByteBits
 public ValueReference(string n, int index, int startBit, int endBit, DataValueType t, bool editable=true)
 {
     valueIndex = index;
     ValueType = t;
     Name = n;
     this.startBit = startBit;
     this.endBit = endBit;
     Editable = editable;
 }
Example #25
0
        private static BaseExpression CreateDefaultCreateParameterExpression(DataValueType dataValueType)
        {
            var type  = DataValueTypeUtilities.ConvertDataValueTypeToType(dataValueType);
            var value = type.IsValueType
                                ? Activator.CreateInstance(type)
                                : null;

            return(CreateParameterExpression(value, dataValueType));
        }
Example #26
0
 public CallLuaFunctionNode(
     LuaFunction name,
     DataValueType type,
     IList <ExpressionNode> arguments)
     : base(RedILNodeType.CallLuaFunction, type)
 {
     Name      = name;
     Arguments = arguments;
 }
Example #27
0
        private static DataValueType DeduceType(DataValueType left, DataValueType right)
        {
            if (left == DataValueType.Float || right == DataValueType.Float)
            {
                return(DataValueType.Float);
            }

            return(left);
        }
Example #28
0
 // Constructor for DataValueType.ByteBits
 public ValueReference(string n, int index, int startBit, int endBit, DataValueType t, bool editable = true)
 {
     valueIndex    = index;
     ValueType     = t;
     Name          = n;
     this.startBit = startBit;
     this.endBit   = endBit;
     Editable      = editable;
 }
Example #29
0
 public UniformOperatorNode(
     DataValueType dataType,
     BinaryExpressionOperator op,
     IList <ExpressionNode> children)
     : base(RedILNodeType.UniformExpression, dataType)
 {
     Operator = op;
     Children = children;
 }
Example #30
0
 // Constructor which takes a ConstantsMapping, affecting the interface
 // that will be used
 public ValueReference(string n, int index, int startBit, int endBit, DataValueType t, bool editable, string constantsMappingString)
 {
     valueIndex    = index;
     ValueType     = t;
     Name          = n;
     this.startBit = startBit;
     this.endBit   = endBit;
     Editable      = editable;
     this.constantsMappingString = constantsMappingString;
 }
Example #31
0
        protected override DataValueType GetYValueType(IEnumerable <DataPoint> dataPoints)
        {
            DataValueType dataValueType = base.GetYValueType(dataPoints);

            if (dataValueType == DataValueType.Integer && this.IsHundredPercent)
            {
                dataValueType = DataValueType.Float;
            }
            return(dataValueType);
        }
Example #32
0
 // Constructor which takes a ConstantsMapping, affecting the interface
 // that will be used
 public ValueReference(string n, int index, int startBit, int endBit, DataValueType t, bool editable, string constantsMappingString)
 {
     valueIndex = index;
     ValueType = t;
     Name = n;
     this.startBit = startBit;
     this.endBit = endBit;
     Editable = editable;
     this.constantsMappingString = constantsMappingString;
 }
Example #33
0
        /// <summary>
        /// Returns column's data value type.
        /// </summary>
        protected int?GetColumnDataValueType(EntitySchemaQueryExpression expression)
        {
            if (expression.SchemaColumn == null)
            {
                return(null);
            }
            DataValueType columnValueType = expression.SchemaColumn.DataValueType;

            return((int)Terrasoft.Nui.ServiceModel.Extensions.DataValueTypeExtension.ToEnum(columnValueType));
        }
Example #34
0
        public static object ConvertValue(object value, DataValueType valueType)
        {
            object obj = value;

            try
            {
                if (valueType == DataValueType.Float)
                {
                    double doubleValue;
                    if (ValueHelper.TryConvert(value, true, out doubleValue))
                    {
                        obj = (object)doubleValue;
                    }
                }
                else if (valueType == DataValueType.Integer)
                {
                    long intValue;
                    if (ValueHelper.TryConvert(value, true, out intValue))
                    {
                        obj = (object)intValue;
                    }
                }
                else if (valueType == DataValueType.Date || valueType == DataValueType.DateTime || valueType == DataValueType.Time)
                {
                    DateTime dateTimeValue;
                    if (ValueHelper.TryConvert(value, true, out dateTimeValue))
                    {
                        obj = (object)dateTimeValue;
                    }
                }
                else
                {
                    string input = value as string;
                    if (input != null)
                    {
                        if (valueType == DataValueType.DateTimeOffset)
                        {
                            obj = (object)DateTimeOffset.Parse(input, (IFormatProvider)CultureInfo.InvariantCulture);
                        }
                        else if (valueType == DataValueType.TimeSpan)
                        {
                            obj = (object)TimeSpan.Parse(input, (IFormatProvider)CultureInfo.InvariantCulture);
                        }
                    }
                }
            }
            catch (FormatException ex)
            {
            }
            catch (InvalidCastException ex)
            {
            }
            return(obj);
        }
Example #35
0
 public static ValueAggregator GetAbsAggregator(DataValueType valueType)
 {
     switch (valueType)
     {
         case DataValueType.Integer:
             return (ValueAggregator)new AbsInt64ValueAggregator();
         case DataValueType.Float:
             return (ValueAggregator)new AbsDoubleValueAggregator();
         case DataValueType.Time:
         case DataValueType.TimeSpan:
             return (ValueAggregator)new AbsTimeValueAggregator();
         default:
             return ValueAggregator.GetAggregator(valueType);
     }
 }
Example #36
0
 public static ValueAggregator GetAggregator(DataValueType valueType)
 {
     switch (valueType)
     {
         case DataValueType.Auto:
             return (ValueAggregator)new DefaultValueAggregator();
         case DataValueType.Category:
             return (ValueAggregator)new CategoryValueAggregator();
         case DataValueType.Integer:
             return (ValueAggregator)new Int64ValueAggregator();
         case DataValueType.Float:
             return (ValueAggregator)new DoubleValueAggregator();
         case DataValueType.DateTime:
         case DataValueType.Date:
             return (ValueAggregator)new DateTimeValueAggregator();
         case DataValueType.Time:
         case DataValueType.TimeSpan:
             return (ValueAggregator)new TimeValueAggregator();
         case DataValueType.DateTimeOffset:
             return (ValueAggregator)new DateTimeOffsetValueAggregator();
         default:
             throw new NotSupportedException();
     }
 }
Example #37
0
 internal virtual ValueAggregator CreateAggregator(DataValueType valueType)
 {
     return ValueAggregator.GetAggregator(valueType);
 }
Example #38
0
 // Constructor for DataValueType.ByteBits
 public StreamValueReference(string n, int offset, int startBit, int endBit, DataValueType t, bool editable=true)
     : base(n, offset, startBit, endBit, t, editable)
 {
 }
Example #39
0
 private Axis FindAxis(DataValueType valueType, AxisOrientation orientation)
 {
     foreach (Axis axis in (Collection<Axis>)this.Axes)
     {
         if (axis.Orientation == orientation && axis.Scale.ValueType == valueType)
             return axis;
     }
     foreach (Axis axis in (Collection<Axis>)this.Axes)
     {
         if (axis.Orientation == orientation && axis.Scale.CanProject(valueType))
             return axis;
     }
     return (Axis)null;
 }
Example #40
0
    void databaseWork()
    {
        int rows = 100;

        // create table
        string tableName = Guid.NewGuid().ToString().Replace("-", "");
        var fields = new DataValueType[] { DataValueType.IntegerType, DataValueType.DateTimeType, DataValueType.ShortStringType, DataValueType.LongStringType };
        var createActions = new List<DbAction>();
        createActions.Add(DbAction.EnsureTable(tableName, new string[] { "id" }, new DataValueType[] { DataValueType.IntegerType }));
        createActions.Add(DbAction.AddField(tableName, "f1", DataValueType.BooleanType, true, new BooleanDataValue(false)));
        createActions.Add(DbAction.AddField(tableName, "f2", DataValueType.DateTimeType, false, new DateTimeDataValue(DateTime.Now)));
        createActions.Add(DbAction.AddField(tableName, "f3", DataValueType.FloatType, false, new FloatDataValue(0)));
        createActions.Add(DbAction.AddField(tableName, "f4", DataValueType.ShortStringType, true, new ShortStringDataValue("test")));
        createActions.Add(DbAction.AddField(tableName, "f5", DataValueType.LongStringType, false, new LongStringDataValue("test")));
        WAFRuntime.Engine.Dao.DbProvider.UpdateDatabase(createActions);

        // inserting records
        var table = new SqlTable(tableName);
        var id = new SqlFieldInteger("id", table);
        var f1 = new SqlFieldBoolean("f1", table);
        var f2 = new SqlFieldDateTime("f2", table);
        var f3 = new SqlFieldFloat("f3", table);
        var f4 = new SqlFieldShortString("f4", table);
        var f5 = new SqlFieldLongString("f5", table);
        {
            for (int r = 0; r < rows; r++) {
                SqlQuery q = new SqlQuery(WAFRuntime.Engine.Dao);
                q.Insert(table);
                q.Values(id, r);
                q.Values(f1, false);
                q.Values(f2, DateTime.Now);
                q.Values(f3, (double)r);
                q.Values(f4, "My test string " + r);
                q.Values(f5, "My long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long test string " + r);
                q.ExecuteNonQuery();
            }
        }
        {
            // quering 10 records at the time
            for (int r = 0; r < rows; r++) {
                SqlQuery q = new SqlQuery(WAFRuntime.Engine.Dao);
                q.From(table);
                q.Select(f1);
                q.Select(f2);
                q.Select(f3);
                q.Select(f4);
                q.Where(id > r);
                using (var dr = q.ExecuteReader()) {
                    while (dr.Read()) { }
                }
            }
        }

        // deleting 1/10 of the records
        for (int r = 0; r < rows / 10; r++) {
            SqlQuery q = new SqlQuery(WAFRuntime.Engine.Dao);
            q.Delete(table);
            q.Where(id == r);
            q.ExecuteNonQuery();
        }

        // dropping table
        WAFRuntime.Engine.Dao.DbProvider.UpdateDatabase(new DbAction[] { DbAction.DeleteTable(tableName) }.ToList());
    }
Example #41
0
 private void UpdateScaleValuesIfUndefined(Axis axis, DataValueType valueType)
 {
     if (valueType == DataValueType.Auto)
         return;
     if (axis.Scale.CanProject(valueType))
         axis.Scale.UpdateValuesIfUndefined(this.AggregateValues(axis));
     else
         this.SyncSeriesAndAxes();
 }
Example #42
0
 private void OnActualXValueTypeChanged(DataValueType newValue)
 {
     this.XAggregator = this.CreateAggregator(newValue);
     this.InvalidateDataPointsByXValue();
     this.OnPropertyChanged("ActualXValueType");
 }
Example #43
0
 // Same as above but without start/endBit
 public ValueReference(string n, int index, DataValueType t, bool editable, string constantsMappingString)
 {
     valueIndex = index;
     ValueType = t;
     Name = n;
     Editable = editable;
     this.constantsMappingString = constantsMappingString;
     Console.WriteLine("Mapping string " + this.constantsMappingString);
     if (t == DataValueType.ByteBits || t == DataValueType.ByteBit)
         throw new Exception("Wrong constructor");
 }