Esempio n. 1
0
        public DataControl_Array(DataType DataType, bool isReferences, ObjectTypeMember member)
            : base(member)
        {
            m_DataType = DataType;
            m_IsReferences = isReferences;
            m_ItemsPanel.Height = m_ItemsPanel.Height ;
            m_ItemsPanel.BorderStyle = BorderStyle.FixedSingle;
            m_ItemsPanel.Height = 0;
            m_ItemsPanel.Width = Width ;

            m_AddButton.Width = DEFAULT_BUTTON_WIDTH;
            m_DeleteButton.Width = DEFAULT_BUTTON_WIDTH;

            m_AddButton.Text = "Add";
            m_DeleteButton.Text = "Delete";
            m_ButtonsPanel.Location = new Point(0, m_ItemsPanel.Height);
            m_ButtonsPanel.Controls.Add(m_AddButton);
            m_ButtonsPanel.Controls.Add(m_DeleteButton);

            m_AddButton.Click += new System.EventHandler(this.AddItem);

            Controls.Add(m_ItemsPanel);
            Controls.Add(m_ButtonsPanel);

            BorderStyle = BorderStyle.FixedSingle;
            m_ButtonsPanel.BorderStyle = BorderStyle.FixedSingle;
            m_ItemsPanel.BorderStyle = BorderStyle.FixedSingle;
        }
Esempio n. 2
0
 public ValidationWarning(string migrationName, DataType dataType, string providerName, string warning)
 {
     _migrationName = migrationName;
     _dataType = dataType;
     _providerName = providerName;
     _warning = warning;
 }
Esempio n. 3
0
 protected Constant BuildConstant(DataType t1, DataType t2, double val)
 {
     PrimitiveType p1 = (PrimitiveType) t1;
     PrimitiveType p2 = (PrimitiveType) t2;
     int size = Math.Max(p1.Size, p2.Size);
     return ConstantReal.Create(PrimitiveType.Create(p1.Domain & p2.Domain, size), val);
 }
Esempio n. 4
0
        public DataTypeValidator(DataType dataType, object data)
        {
            m_dataType = dataType;
            m_data = data;

            SetActualDataType();
        }
Esempio n. 5
0
 public DataTypeGraphModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, DiagramViewModel parent,
     DataType obj)
     : base(appCtx, dataCtx, parent, obj)
 {
     this._diagMdl = parent;
     this.DataType = obj;
 }
        public SdmxDataFormatCore(DataType dataType)
        {
            if(dataType == null)
                throw new ArgumentException("Data Type can not be null for SdmxDataFormat");

            this._dataType = dataType;
        }
Esempio n. 7
0
        public PyBuildValueFormatParser(
            Program program,
            Address addrInstr,
            string format,
            IServiceProvider services)
        {
            this.ArgumentTypes = new List<DataType>();
            this.format = format;
            var platform = program.Platform;
            this.pointerSize = platform.PointerType.Size;

            var wordSize = platform.Architecture.WordWidth.Size;
            var longSize = platform.GetByteSizeFromCBasicType(
                CBasicType.Long);
            var longLongSize = platform.GetByteSizeFromCBasicType(
                CBasicType.LongLong);
            var doubleSize = platform.GetByteSizeFromCBasicType(
                CBasicType.Double);

            dtInt = Integer(wordSize);
            dtUInt = UInteger(wordSize);
            dtLong = Integer(longSize);
            dtULong = UInteger(longSize);
            dtLongLong = Integer(longLongSize);
            dtULongLong = UInteger(longLongSize);
            dtDouble = Real(doubleSize);
            ptrChar = Ptr(PrimitiveType.Char);
            ptrVoid = Ptr(VoidType.Instance);

            dtPySize = UInteger(pointerSize);
            ptrPyObject = Ptr(Ref("PyObject"));
            ptrPyUnicode = Ptr(Ref("Py_UNICODE"));
            ptrPyComplex = Ptr(Ref("Py_complex"));
            ptrPyConverter = Ptr(new CodeType());
        }
Esempio n. 8
0
 public EmmeMatrix(BinaryReader reader)
     : this()
 {
     this.MagicNumber = reader.ReadUInt32();
     if(!this.IsValidHeader())
     {
         return;
     }
     this.Version = reader.ReadInt32();
     this.Type = (DataType)reader.ReadInt32();
     this.Dimensions = reader.ReadInt32();
     this.Indexes = new int[this.Dimensions][];
     for(int i = 0; i < this.Indexes.Length; i++)
     {
         Indexes[i] = new int[reader.ReadInt32()];
     }
     for(int i = 0; i < this.Indexes.Length; i++)
     {
         var row = Indexes[i];
         for(int j = 0; j < row.Length; j++)
         {
             row[j] = reader.ReadInt32();
         }
     }
     LoadData(reader.BaseStream);
 }
Esempio n. 9
0
        public DataTypeAttribute(DataType dataType)
        {
            this.DataType = dataType;
            this.InitializeDefaultErrorMessage();
            switch (this.DataType)
            {
                case DataType.Boolean:
                    this.UsesCustomValidation = true;
                    break;

                case DataType.Alphabetic:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = AlphabeticMatcher.ToString();
                    break;

                case DataType.AlphaNumeric:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = AlphaNumericMatcher.ToString();
                    break;

                case DataType.PhoneNumber:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = PhoneNumberMatcher.ToString();
                    break;

                case DataType.ZipCode:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = ZipCodeMatcher.ToString();
                    break;

                case DataType.EmailAddress:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = EmailMatcher.ToString();
                    break;

                case DataType.IpAddress:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = IpAddressMatcher.ToString();
                    break;

                case DataType.Url:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = UrlCodeMatcher.ToString();
                    break;

                case DataType.CreditCard:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = CreditCardMatcher.ToString();
                    break;

                case DataType.CreditCardLuhn:
                    this.UsesCustomValidation = true;
                    break;

                case DataType.SocialSecurityNumber:
                    this.UsesRegularExpression = true;
                    this.CurrentRegularExpression = SocialSecurityMatcher.ToString();
                    break;
            }
        }
Esempio n. 10
0
        public DataType Normalize(DataType type)
        {
            if (type is TypeVariable)
                return NormalizeVariable((TypeVariable)type);

            return NormalizeNamedType((NamedType)type);
        }
Esempio n. 11
0
        public IEnumerable<string> Unify(DataType a, DataType b)
        {
            a = Normalize(a);
            b = Normalize(b);

            if (a is TypeVariable)
            {
                var variableA = (TypeVariable)a;

                if (b.Contains(variableA))
                {
                    if (a != b)
                        return Error(a, b);

                    return success;
                }

                substitutions[variableA] = b;
                return success;
            }

            if (b is TypeVariable)
                return Unify(b, a);

            if (a.Name != b.Name)
                return Error(a, b);

            if (a.GenericArguments.Count() != b.GenericArguments.Count())
                return Error(a, b);

            return PairwiseUnify(a.GenericArguments, b.GenericArguments);
        }
Esempio n. 12
0
        //---------------------------------------------------------------------
        public static void DatatypeQuery(OleDbConnection dbcon, CodeGenerator cg)
        {
            cg.DataTypeList.Clear();
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM DataTypes", dbcon);
            OleDbDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                DataType curDatatype = new DataType();

                curDatatype.ID = Convert.ToInt32(dr["ID"].ToString());
                curDatatype.DataTypeName = dr["DataTypeName"].ToString();
                curDatatype.CType = dr["CType"].ToString();
                curDatatype.CTypeDef = dr["CTypeDef"].ToString();

                curDatatype.CSType = dr["CSType"].ToString();
                curDatatype.CSTypeDef = dr["CSTypeDef"].ToString();

                curDatatype.VBType = dr["VBType"].ToString();
                curDatatype.VBTypeDef = dr["VBTypeDef"].ToString();

                curDatatype.PythonType = dr["PythonType"].ToString();
                curDatatype.PythonTypeDef = dr["PythonTypeDef"].ToString();

                cg.DataTypeList.Add(curDatatype);
            }

            dr.Close();
        }
Esempio n. 13
0
 public Ident(string name, IdentType identType, DataType dataType, AstNode node)
 {
     Name = name;
     IdentType = identType;
     DataType = dataType;
     Node = node;
 }
Esempio n. 14
0
        public string GetWriteCmd(int address, string data,DataType dtype)
        {
            int bytes = 0;
            string sWriteData = Utils.CreatePLCWriteData(data, out bytes, dtype);

            return CreateCmd(address, bytes, sWriteData);
        }
Esempio n. 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataTypeInfo" /> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="rules">The rules.</param>
        /// <exception cref="NotSupportedException"></exception>
        public DataTypeInfo(DataType type, IEnumerable<RuleMap> rules)
        {
            switch (type)
            {
                case DataType.Text:
                    Description = "Text";
                    break;
                case DataType.Number:
                    Description = "Number";
                    break;
                case DataType.Date:
                    Description = "Date";
                    break;
                case DataType.Group:
                    Description = "Group";
                    break;
                case DataType.Transform:
                    Description = "Transform";
                    break;
                default:
                    //this stops any undefined data type being added
                    throw new NotSupportedException();
            }

            DataType = type;
            RuleTypes =
                rules.Select(
                    arg =>
                        new RuleTypeInfo(type, arg))
                    .ToList();
        }
Esempio n. 16
0
        /// <summary>
        /// Creates a new SerializeType based on a <see cref="System.Type"/>, gathering all the information that is necessary for serialization.
        /// </summary>
        /// <param name="t"></param>
        public SerializeType(Type t)
        {
            this.type = t.GetTypeInfo();
            this.typeString = t.GetTypeId();
            this.dataType = GetDataType(this.type);
            this.dontSerialize = this.type.HasAttributeCached<DontSerializeAttribute>();
            this.defaultValue = this.type.GetDefaultOf();

            if (this.dataType == DataType.Struct)
            {
                // Retrieve all fields that are not flagged not to be serialized
                IEnumerable<FieldInfo> filteredFields = this.type
                    .DeclaredFieldsDeep()
                    .Where(f => !f.IsStatic && !f.HasAttributeCached<DontSerializeAttribute>());

                // Ugly hack to skip .Net collection _syncRoot fields.
                // Can't use field.IsNonSerialized, because that doesn't exist in the PCL profile,
                // and implementing a whole filtering system just for this would be overkill.
                filteredFields = filteredFields
                    .Where(f => !(
                        f.FieldType == typeof(object) &&
                        f.Name == "_syncRoot" &&
                        typeof(System.Collections.ICollection).GetTypeInfo().IsAssignableFrom(f.DeclaringType.GetTypeInfo())));

                // Store the filtered fields in a fixed form
                this.fields = filteredFields.ToArray();
                this.fields.StableSort((a, b) => string.Compare(a.Name, b.Name));
            }
            else
            {
                this.fields = new FieldInfo[0];
            }
        }
Esempio n. 17
0
        public ReturnTypeVisitor(IQueryContext queryContext, IVariableResolver variableResolver)
        {
            this.queryContext = queryContext;
            this.variableResolver = variableResolver;

            dataType = PrimitiveTypes.Null();
        }
Esempio n. 18
0
 public DataPacket(float[] samples, DataType type, float timeInterval)
 {
     Type = type;
     Count = samples.Length;
     Samples = samples;
     TimeInterval = timeInterval;
 }
Esempio n. 19
0
		public EquivalenceClass CreateEquivalenceClass(DataType dt)
		{
			TypeVariable tv = store.CreateTypeVariable(factory);
			tv.Class.DataType = dt;
			tv.DataType = tv.Class;
			return tv.Class;
		}
Esempio n. 20
0
        /// <summary>
        ///     Constructor that accepts a data type enumeration
        /// </summary>
        /// <param name="dataType">The <see cref="DataType" /> enum value indicating the type to apply.</param>
        public DataTypeAttribute(DataType dataType)
        {
            DataType = dataType;

            // Set some DisplayFormat for a few specific data types
            switch (dataType)
            {
                case DataType.Date:
                    DisplayFormat = new DisplayFormatAttribute();
                    DisplayFormat.DataFormatString = "{0:d}";
                    DisplayFormat.ApplyFormatInEditMode = true;
                    break;
                case DataType.Time:
                    DisplayFormat = new DisplayFormatAttribute();
                    DisplayFormat.DataFormatString = "{0:t}";
                    DisplayFormat.ApplyFormatInEditMode = true;
                    break;
                case DataType.Currency:
                    DisplayFormat = new DisplayFormatAttribute();
                    DisplayFormat.DataFormatString = "{0:C}";

                    // Don't set ApplyFormatInEditMode for currencies because the currency
                    // symbol can't be parsed
                    break;
            }
        }
		/// <summary>
		/// Constructs the filter
		/// </summary>
		/// <param name="dataValue">
		/// DataValue used to link the local with the foreign DataObject
		/// </param>
		/// <param name="valueToCompare">
		/// Foreign DataObject
		/// </param>
		public ForeignKeyFilter(DataType dtype, System.Reflection.MemberInfo member, object valueToCompare)
		{
			if (dtype == null)
			{
				throw new ArgumentNullException(nameof(dtype));
			}

			if (member == null)
			{
				throw new ArgumentNullException(nameof(member));
			}

			DataType = dtype;
			Member = member;
			ValueToCompare = valueToCompare;

			foreach (DataMember pk in dtype.PrimaryKey)
			{
				ValueCompareFilter pkFilter = new ValueCompareFilter();
				pkFilter.Member = pk;
				pkFilter.ValueToCompare = (IComparable) pk.Member.GetValue(ValueToCompare);

				base.InnerFilters.Add(pkFilter);
			}
		}
 /// <summary>
 /// Initializes a new instance of the DatabaseFunctionParameter class with given name, type and mode.
 /// </summary>
 /// <param name="name">Parameter name</param>
 /// <param name="type">Parameter type</param>
 /// <param name="mode">Parameter mode.</param>
 public DatabaseFunctionParameter(string name, DataType type, DatabaseParameterMode mode)
 {
     this.Name = name;
     this.ParameterType = type;
     this.Mode = mode;
     this.Annotations = new List<Annotation>();
 }
       public  void Update(int fieldId, DataType type)
        {
            var types = type.FieldSettingTypes.Where(t => t.Section == Section).ToArray(); 
           for (var i = 0; i < types.Count(); i++)
            {
                var value = string.Empty;
                var t = types[i].SystemType;
                if (t == "Boolean")
                {
                    var cb = Repeater1.Controls[i].FindControl("Checkbox") as CheckBox;
                    if (cb != null) value = cb.Checked.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    var tb = Repeater1.Controls[i].FindControl("Textbox") as TextBox;
                    if (tb != null) value = tb.Text;
                }

                if (t == "Int")
                {
                    value = value.AsInt().ToString(CultureInfo.InvariantCulture);
                }

                var key = types[i].Key;
                if (types[i].VerifySetting (value))
                FieldSettingsController.UpdateFieldSetting(key, value, fieldId);
            }

        }
 public void Show(DataType selectedType)
 {
     TypeName = selectedType.Name;
     SelectedType = selectedType;
     Repeater1.DataSource = selectedType.FieldSettingTypes.Where(t=>t.Section==Section);
     Repeater1.DataBind();
 }
 public void BindData(int fieldId,DataTable  settingsTable, DataType type)
 {
     
     if (!IsPostBack)
     {
         var types = type.FieldSettingTypes.Where(t => t.Section == Section).ToArray();
         for (var i = 0; i < types.Count(); i++)
         {
             var key = types[i].Key;
             var value = settingsTable.GetFieldSetting(key, fieldId);
             if (!string.IsNullOrEmpty(value))
             {
                 var t = type.FieldSettingTypes.ElementAt(i).SystemType;
                 if (t == "Boolean")
                 {
                     var cb = Repeater1.Controls[i].FindControl("Checkbox") as CheckBox;
                     if (cb != null) cb.Checked = value.AsBoolean();
                 }
                 else
                 {
                     var tb = Repeater1.Controls[i].FindControl("Textbox") as TextBox;
                     if (tb != null) tb.Text = value;
                 }
             }
            
         }
     }
 }
Esempio n. 26
0
 public Event(Controller controller, DataType type, string name, string modifier)
     : base(controller)
 {
     Name = name;
     DataType = type;
     _Modifiers.Add(modifier);
 }
Esempio n. 27
0
        public DefaultMethods(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, DataType dt)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;

        }
Esempio n. 28
0
 /// <summary>
 /// Creates a new instance of the <see cref="DataLoadException"/> class.
 /// </summary>
 /// <param name="inner">The inner exception.</param>
 /// <param name="jsonData">The data that the serializer was trying to load.</param>
 /// <param name="targetType">The target type.</param>
 public DataLoadException(Exception inner, string jsonData, Type targetType, DataType dataType)
     : base("An exception occurred trying to read data into an internal format. Please check that the input data is correct.", inner)
 {
     Data.Add("Target type", targetType.Name);
     Data.Add("Data type", dataType.ToString());
     Data.Add("Data", jsonData);
 }
Esempio n. 29
0
 public Input(string name, DataType type= DataType.Text, bool isOptional=false)
 {
     Id = Guid.NewGuid().ToString();
     Name = name;
     Type = type;
     IsOptional = isOptional;
 }
Esempio n. 30
0
 public DataModel(string name, string caption, DataType type)
 {
     this.Name = name;
     this.Caption = string.IsNullOrEmpty(caption) ? name: caption;
     this.Type = type;
     Config = new Config();
 }
Esempio n. 31
0
        private bool CanStore(SecurityId securityId, Type messageType, object arg = null)
        {
            if (!Enabled)
            {
                return(false);
            }

            return(!FilterSubscription || _subscriptions.Contains(Tuple.Create(securityId, DataType.Create(messageType, arg))));
        }
Esempio n. 32
0
        public void AddMember(string memberExpression)
        {
            //if this is a native datamember, just add a SelectMember
            if (DataType.IsMapped(memberExpression))
            {
                DataMember dmember = DataType[memberExpression];

                //this is a native member of this dataType
                SelectMember sm = new SelectMember(dmember, dmember.Member.Expression.Replace('.', '_'));
                Members.Add(sm);

                //finish iteration here
                return;
            }

            //see if this is a dataMember from a base type
            foreach (DataType parent in DataType.BaseDataTypes.Skip(1))
            {
                if (!parent.IsMapped(memberExpression))
                {
                    continue;
                }

                //if this is a native datamember, just add a SelectMember
                DataMember dmember = parent[memberExpression];

                //create join for child-parent relationship
                SelectJoin join = Joins.Where(j => j.Type == parent && j.Alias == parent.Name + "_base").SingleOrDefault();

                if (join == null)
                {
                    join          = new SelectJoin();
                    join.JoinType = SelectJoinType.Inner;
                    join.Type     = parent;
                    join.Alias    = parent.Name + "_base";

                    var childPK = DataType.PrimaryKey.ToList();
                    var joinPK  = join.Type.PrimaryKey.ToList();

                    for (int y = 0; y < joinPK.Count; y++)
                    {
                        //DataMember pk in join.Type.PrimaryKey
                        var filter = new Filters.MemberCompareFilter()
                        {
                            Member                   = childPK[y],
                            MemberToCompare          = joinPK[y],
                            MemberToCompareTypeAlias = join.Alias,
                        };

                        join.On.Add(filter);
                    }

                    Joins.Add(join);
                }

                //this is a native member of this dataType
                SelectMember sm = new SelectMember(dmember, dmember.Member.Expression.Replace('.', '_'));
                join.Members.Add(sm);

                //finish iteration here
                return;
            }


            //if the expression was not found as a single datamember, split it in nested members
            List <System.Reflection.MemberInfo> nestedMemberInfos = MemberExpression.GetMemberInfos(DataType.InnerType, memberExpression).ToList();

            //check every part of the expression
            for (int i = 0; i < nestedMemberInfos.Count; i++)
            {
                System.Reflection.MemberInfo memberInfo = nestedMemberInfos[i];
                bool   isTheFirstOne     = i == 0;
                bool   isTheLastOne      = i == nestedMemberInfos.Count - 1;
                string currentExpression = string.Empty;

                for (int y = 0; y <= i; y++)
                {
                    currentExpression += '.' + nestedMemberInfos[y].Name;
                }

                currentExpression = currentExpression.Trim('.');

                //if this is a dataMember from a base type, create join for that relationship
                foreach (DataType parent in DataType.BaseDataTypes)
                {
                    DataType referencingDataType = isTheFirstOne ? parent : MemberExpression.GetReturnType(nestedMemberInfos[i - 1]);

                    //if this is not a native or inherited DataMember, so we must detect the nested members and create the respective joins
                    if (!isTheLastOne && DataType.IsMapped(MemberExpression.GetReturnType(memberInfo)))
                    {
                        DataType foreignDataType    = MemberExpression.GetReturnType(memberInfo);
                        bool     foreignKeyIsMapped = true;

                        foreach (DataMember foreignKey in foreignDataType.PrimaryKey)
                        {
                            DataMember localKey = referencingDataType.DataMembers.Where(m => m.Member.Expression == memberInfo.Name + "." + foreignKey.Member).SingleOrDefault();

                            if (localKey == null)
                            {
                                foreignKeyIsMapped = false;
                            }
                        }

                        if (foreignKeyIsMapped)
                        {
                            SelectJoin foreignJoin = Joins.Where(j => j.Type == foreignDataType && j.Alias == currentExpression.Replace('.', '_')).SingleOrDefault();

                            if (foreignJoin == null)
                            {
                                foreignJoin          = new SelectJoin();
                                foreignJoin.JoinType = SelectJoinType.Left;
                                foreignJoin.Type     = foreignDataType;
                                foreignJoin.Alias    = currentExpression.Replace('.', '_');

                                string previousJoinAlias = string.Empty;

                                if (isTheFirstOne && parent != DataType)
                                {
                                    previousJoinAlias = parent.Name + "_base";
                                }
                                else
                                {
                                    for (int y = 0; y <= i - 1; y++)
                                    {
                                        previousJoinAlias += '.' + nestedMemberInfos[y].Name;
                                    }

                                    previousJoinAlias = previousJoinAlias.Trim('.');
                                }

                                foreach (DataMember foreignKey in foreignDataType.PrimaryKey)
                                {
                                    DataMember localKey = referencingDataType.DataMembers.Where(m => m.Member.Expression == memberInfo.Name + "." + foreignKey.Member).SingleOrDefault();

                                    var filter = new Filters.MemberCompareFilter()
                                    {
                                        Member                   = localKey,
                                        MemberToCompare          = foreignKey,
                                        TypeAlias                = previousJoinAlias,
                                        MemberToCompareTypeAlias = foreignJoin.Alias,
                                    };

                                    foreignJoin.On.Add(filter);
                                }

                                Joins.Add(foreignJoin);
                            }

                            break;
                        }
                    }

                    if (!isTheFirstOne && isTheLastOne)
                    {
                        DataMember   dmember     = referencingDataType[memberInfo.Name];
                        SelectJoin   foreignJoin = Joins.Where(j => j.Type == referencingDataType && j.Alias == currentExpression.Replace("." + memberInfo.Name, string.Empty).Replace('.', '_')).SingleOrDefault();
                        SelectMember sm          = new SelectMember(dmember, currentExpression.Replace('.', '_'));
                        foreignJoin.Members.Add(sm);

                        break;
                    }
                }
            }
        }
 /// <summary>
 /// Update filter with new subscription.
 /// </summary>
 /// <param name="securityId">Security ID.</param>
 /// <param name="dataType">Data type info.</param>
 public void Subscribe(SecurityId securityId, DataType dataType)
 {
     Subscribe(Tuple.Create(securityId, dataType));
 }
 public abstract bool OperandTypesAreValid(DataType leftType, DataType rightType);
Esempio n. 35
0
 /// <summary>
 /// Add a parameter to the settings
 /// </summary>
 /// <param name="name">name of the parameter</param>
 /// <param name="type">data type of the parameter</param>
 /// <param name="value">default value of the parameter</param>
 public void add(String name, DataType type, dynamic value)
 {
     options[name] = value;
     optionTypes.Add(name, type);
 }
Esempio n. 36
0
 public static DataType as_base_dtype(this DataType type)
 {
     return((int)type > 100 ?
            (DataType)Enum.Parse(typeof(DataType), ((int)type - 100).ToString()) :
            type);
 }
Esempio n. 37
0
 public static Type as_numpy_dtype(this DataType type)
 {
     return(type.as_tf_dtype().as_numpy_datatype());
 }
Esempio n. 38
0
 /// <summary>
 /// Update filter with new subscription.
 /// </summary>
 /// <param name="securityId">Security ID.</param>
 /// <param name="dataType">Data type info.</param>
 /// <returns>If subscription was just created, return <see langword="true" />, otherwise <see langword="false" />.</returns>
 public bool Subscribe(SecurityId securityId, DataType dataType)
 {
     return(_subscriptions.TryAdd(Tuple.Create(securityId, dataType)));
 }
Esempio n. 39
0
 public override Expression CreateStackAccess(IStorageBinder binder, int cbOffset, DataType dataType)
 {
     throw new NotSupportedException("Basic doesn't have the notion of a parameter stack.");
 }
Esempio n. 40
0
 /// <summary>
 /// Update filter with remove a subscription.
 /// </summary>
 /// <param name="securityId">Security ID.</param>
 /// <param name="dataType">Data type info.</param>
 /// <returns>If subscription was just removed, return <see langword="true" />, otherwise <see langword="false" />.</returns>
 public bool UnSubscribe(SecurityId securityId, DataType dataType)
 {
     return(_subscriptions.Remove(Tuple.Create(securityId, dataType)));
 }
Esempio n. 41
0
        public DataColumn AddDataColumn(string name = null, string sourceColumn = null, string displayFolder = null, DataType dataType = DataType.String)
        {
            if (!Handler.PowerBIGovernance.AllowCreate(typeof(DataColumn)))
            {
                throw new PowerBIGovernanceException("Adding columns to a table in this Power BI Model is not supported.");
            }

            Handler.BeginUpdate("add Data column");
            var column = DataColumn.CreateNew(this, name);

            column.DataType = dataType;
            if (!string.IsNullOrEmpty(sourceColumn))
            {
                column.SourceColumn = sourceColumn;
            }
            if (!string.IsNullOrEmpty(displayFolder))
            {
                column.DisplayFolder = displayFolder;
            }
            Handler.EndUpdate();
            return(column);
        }
Esempio n. 42
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public GXDLMSAttribute(int index, DataType type, DataType uiType) :
     this(index, type, uiType, 0)
 {
 }
Esempio n. 43
0
 public static bool IsVisibleInPackage(this DataType dt, SourcePackage package)
 {
     return(dt.GetVisibility().IsVisibleInPackage(package));
 }
Esempio n. 44
0
        public static Index CreateTestIndex()
        {
            string indexName = SearchTestUtilities.GenerateName();

            var index = new Index()
            {
                Name   = indexName,
                Fields = new[]
                {
                    Field.New("hotelId", DataType.String, isKey: true, isSearchable: false, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.New("hotelName", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: false),
                    Field.NewSearchableString("description", AnalyzerName.EnLucene, isKey: false, isFilterable: false, isSortable: false, isFacetable: false),
                    Field.NewSearchableString("descriptionFr", AnalyzerName.FrLucene, isFilterable: false, isSortable: false, isFacetable: false),
                    Field.New("description_custom", DataType.String, isSearchable: true, isFilterable: false, isSortable: false, isFacetable: false, searchAnalyzerName: AnalyzerName.Stop, indexAnalyzerName: AnalyzerName.Stop),
                    Field.New("category", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.New("tags", DataType.Collection(DataType.String), isSearchable: true, isFilterable: true, isSortable: false, isFacetable: true),
                    Field.New("parkingIncluded", DataType.Boolean, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.New("smokingAllowed", DataType.Boolean, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.New("lastRenovationDate", DataType.DateTimeOffset, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.New("rating", DataType.Int32, isFilterable: true, isSortable: true, isFacetable: true),
                    Field.NewComplex("address", isCollection: false, fields: new[]
                    {
                        Field.New("streetAddress", DataType.String, isSearchable: true),
                        Field.New("city", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: true),
                        Field.New("stateProvince", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: true),
                        Field.New("country", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: true),
                        Field.New("postalCode", DataType.String, isSearchable: true, isFilterable: true, isSortable: true, isFacetable: true)
                    }),
                    Field.New("location", DataType.GeographyPoint, isFilterable: true, isSortable: true, isFacetable: false, isRetrievable: true),
                    Field.NewComplex("rooms", isCollection: true, fields: new[]
                    {
                        Field.NewSearchableString("description", AnalyzerName.EnLucene),
                        Field.NewSearchableString("descriptionFr", AnalyzerName.FrLucene),
                        Field.New("type", DataType.String, isSearchable: true, isFilterable: true, isFacetable: true),
                        Field.New("baseRate", DataType.Double, isKey: false, isSearchable: false, isFilterable: true, isFacetable: true),
                        Field.New("bedOptions", DataType.String, isSearchable: true, isFilterable: true, isFacetable: true),
                        Field.New("sleepsCount", DataType.Int32, isFilterable: true, isFacetable: true),
                        Field.New("smokingAllowed", DataType.Boolean, isFilterable: true, isFacetable: true),
                        Field.New("tags", DataType.Collection(DataType.String), isSearchable: true, isFilterable: true, isSortable: false, isFacetable: true)
                    }),
                    Field.New("totalGuests", DataType.Int64, isFilterable: true, isSortable: true, isFacetable: true, isRetrievable: false),
                    Field.New("profitMargin", DataType.Double)
                },
                ScoringProfiles = new[]
                {
                    new ScoringProfile("MyProfile")
                    {
                        FunctionAggregation = ScoringFunctionAggregation.Average,
                        Functions           = new ScoringFunction[]
                        {
                            new MagnitudeScoringFunction(
                                "rating",
                                boost: 2.0,
                                boostingRangeStart: 1,
                                boostingRangeEnd: 4,
                                shouldBoostBeyondRangeByConstant: true,
                                interpolation: ScoringFunctionInterpolation.Constant),
                            new DistanceScoringFunction(
                                "location",
                                boost: 1.5,
                                referencePointParameter: "loc",
                                boostingDistance: 5,
                                interpolation: ScoringFunctionInterpolation.Linear),
                            new FreshnessScoringFunction(
                                "lastRenovationDate",
                                boost: 1.1,
                                boostingDuration: TimeSpan.FromDays(365),   //aka.ms/sre-codescan/disable
                                interpolation: ScoringFunctionInterpolation.Logarithmic)
                        },
                        TextWeights = new TextWeights()
                        {
                            Weights = new Dictionary <string, double>()
                            {
                                { "description", 1.5 }, { "category", 2.0 }
                            }
                        }
                    },
                    new ScoringProfile("ProfileTwo")
                    {
                        FunctionAggregation = ScoringFunctionAggregation.Maximum,
                        Functions           = new[]
                        {
                            new TagScoringFunction(
                                "tags",
                                boost: 1.5,
                                tagsParameter: "mytags",
                                interpolation: ScoringFunctionInterpolation.Linear)
                        }
                    },
                    new ScoringProfile("ProfileThree")
                    {
                        FunctionAggregation = ScoringFunctionAggregation.Minimum,
                        Functions           = new[]
                        {
                            // Set ShouldBoostBeyondRangeByConstant explicitly to false. The API returns the default (false) if you pass in null, so we
                            // need to do this to ensure that comparisons work after round trips.
                            new MagnitudeScoringFunction("rating", 3.0, new MagnitudeScoringParameters(0, 10)
                            {
                                ShouldBoostBeyondRangeByConstant = false
                            })
                            {
                                Interpolation = ScoringFunctionInterpolation.Quadratic
                            }
                        }
                    },
                    new ScoringProfile("ProfileFour")
                    {
                        FunctionAggregation = ScoringFunctionAggregation.FirstMatching,
                        Functions           = new[]
                        {
                            // Set ShouldBoostBeyondRangeByConstant explicitly to false. The API returns the default (false) if you pass in null, so we
                            // need to do this to ensure that comparisons work after round trips.
                            new MagnitudeScoringFunction("rating", 3.14, new MagnitudeScoringParameters(1, 5)
                            {
                                ShouldBoostBeyondRangeByConstant = false
                            })
                            {
                                Interpolation = ScoringFunctionInterpolation.Constant
                            }
                        }
                    }
                },
                DefaultScoringProfile = "MyProfile",
                CorsOptions           = new CorsOptions()
                {
                    AllowedOrigins  = new[] { "http://tempuri.org", "http://localhost:80" },
                    MaxAgeInSeconds = 60
                },
                Suggesters = new[]
                {
                    new Suggester("FancySuggester", "hotelName")
                }
            };

            return(index);
        }
Esempio n. 45
0
        public override Expression CreateStackAccess(IStorageBinder binder, int cbOffset, DataType dataType)
        {
            Services.RequireService <DecompilerEventListener>().Warn(
                "Basic doesn't have the notion of a parameter stack.");
            var stg = new TemporaryStorage("sp" + cbOffset, 0, dataType);

            return(new Identifier("sp" + cbOffset, dataType, stg));
        }
Esempio n. 46
0
 public static bool IsVisibleGlobally(this DataType dt)
 {
     return(dt.GetVisibility().Level == VisibilityLevel.Global);
 }
Esempio n. 47
0
        public int Compare(MDataRow x, MDataRow y)
        {
            // cCount++;
            if (x == y)//自己和自己比,返回0跳出
            {
                return(0);
            }
            int  cellIndex   = index;
            bool cellIsAsc   = isAsc;
            int  cellGroupID = groupID;

            if (useLastIndexState == 1)//出于多重排序的需要这么使用。
            {
                cellIndex         = lastIndex;
                cellIsAsc         = lastIsAsc;
                useLastIndexState = 2;
                cellGroupID       = DataType.GetGroup(x[cellIndex].Struct.SqlType);
            }
            else if (useLastIndexState == 2)
            {
                useLastIndexState = 0;
            }
            //Null判断处理
            if (x[cellIndex].IsNull && y[cellIndex].IsNull)
            {
                return(0);
            }
            else if (x[cellIndex].IsNull)
            {
                return(cellIsAsc ? -1 : 1);
            }
            else if (y[cellIndex].IsNull)
            {
                return(cellIsAsc ? 1 : -1);
            }
            objAValue = x[cellIndex].Value;
            objBValue = y[cellIndex].Value;
            switch (cellGroupID)
            {
            case 1:
            case 3:
                double vA, vB;
                if (cellGroupID == 1)
                {
                    double.TryParse(objAValue.ToString(), out vA);
                    double.TryParse(objBValue.ToString(), out vB);
                    //vA = (int)objAValue;
                    //vB = (int)objBValue;
                }
                else
                {
                    vA = (bool)objAValue ? 1 : 0;
                    vB = (bool)objBValue ? 1 : 0;
                }
                if (vA > vB)
                {
                    return(cellIsAsc ? 1 : -1);
                }
                else if (vA < vB)
                {
                    return(cellIsAsc ? -1 : 1);
                }
                else
                {
                    if (lastIndex > -1 && useLastIndexState == 0)
                    {
                        useLastIndexState = 1;    //标志为正在使用
                        return(Compare(x, y));
                    }
                    return(0);
                }

            case 2:
                return(cellIsAsc ? Comparer <DateTime> .Default.Compare((DateTime)objAValue, (DateTime)objBValue) : Comparer <DateTime> .Default.Compare((DateTime)objBValue, (DateTime)objAValue));

            default:
                //直接性能差一点return cellIsAsc ? Comparer<string>.Default.Compare((string)objAValue, (string)objBValue) : Comparer<string>.Default.Compare((string)objBValue, (string)objAValue);
                if (cellIsAsc)
                {
                    return(Convert.ToString(objAValue).CompareTo(objBValue.ToString()));
                }
                else
                {
                    return(Convert.ToString(objBValue).CompareTo(objAValue.ToString()));
                }
            }
        }
Esempio n. 48
0
 protected override void SetParameterType(IDbDataParameter parameter, DataType dataType)
 {
 }
Esempio n. 49
0
        protected override bool beforeUpdate()
        {
            //更新流程版本
            Flow.UpdateVer(this.No);

            //同步事件实体.
            this.FlowEventEntity = BP.WF.Glo.GetFlowEventEntityStringByFlowMark(this.FlowMark, this.No);

            #region 检查数据完整性 - 同步业务表数据。
            // 检查业务是否存在.
            Flow fl = new Flow(this.No);
            fl.Row = this.Row;

            if (fl.DTSWay != FlowDTSWay.None)
            {
                /*检查业务表填写的是否正确.*/
                string sql = "select count(*) as Num from  " + fl.DTSBTable + " where 1=2";
                try
                {
                    DBAccess.RunSQLReturnValInt(sql, 0);
                }
                catch (Exception)
                {
                    throw new Exception("@业务表配置无效,您配置业务数据表[" + fl.DTSBTable + "]在数据中不存在,请检查拼写错误如果是跨数据库请加上用户名比如: for sqlserver: HR.dbo.Emps, For oracle: HR.Emps");
                }

                sql = "select " + fl.DTSBTablePK + " from " + fl.DTSBTable + " where 1=2";
                try
                {
                    DBAccess.RunSQLReturnValInt(sql, 0);
                }
                catch (Exception)
                {
                    throw new Exception("@业务表配置无效,您配置业务数据表[" + fl.DTSBTablePK + "]的主键不存在。");
                }


                //检查节点配置是否符合要求.
                if (fl.DTSTime == FlowDTSTime.SpecNodeSend)
                {
                    // 检查节点ID,是否符合格式.
                    string nodes = fl.DTSSpecNodes;
                    nodes = nodes.Replace(",", ",");
                    this.SetValByKey(FlowAttr.DTSSpecNodes, nodes);

                    if (DataType.IsNullOrEmpty(nodes) == true)
                    {
                        throw new Exception("@业务数据同步数据配置错误,您设置了按照指定的节点配置,但是您没有设置节点,节点的设置格式如下:101,102,103");
                    }

                    string[] strs = nodes.Split(',');
                    foreach (string str in strs)
                    {
                        if (DataType.IsNullOrEmpty(str) == true)
                        {
                            continue;
                        }

                        if (BP.DA.DataType.IsNumStr(str) == false)
                        {
                            throw new Exception("@业务数据同步数据配置错误,您设置了按照指定的节点配置,但是节点格式错误[" + nodes + "]。正确的格式如下:101,102,103");
                        }

                        Node nd = new Node();
                        nd.NodeID = int.Parse(str);
                        if (nd.IsExits == false)
                        {
                            throw new Exception("@业务数据同步数据配置错误,您设置的节点格式错误,节点[" + str + "]不是有效的节点。");
                        }

                        nd.RetrieveFromDBSources();
                        if (nd.FK_Flow != this.No)
                        {
                            throw new Exception("@业务数据同步数据配置错误,您设置的节点[" + str + "]不再本流程内。");
                        }
                    }
                }

                //检查流程数据存储表是否正确
                if (!DataType.IsNullOrEmpty(fl.PTable))
                {
                    /*检查流程数据存储表填写的是否正确.*/
                    sql = "select count(*) as Num from  " + fl.PTable + " where 1=2";
                    try
                    {
                        DBAccess.RunSQLReturnValInt(sql, 0);
                    }
                    catch (Exception)
                    {
                        throw new Exception("@流程数据存储表配置无效,您配置流程数据存储表[" + fl.PTable + "]在数据中不存在,请检查拼写错误如果是跨数据库请加上用户名比如: for sqlserver: HR.dbo.Emps, For oracle: HR.Emps");
                    }
                }
            }
            #endregion 检查数据完整性. - 同步业务表数据。

            return(base.beforeUpdate());
        }
Esempio n. 50
0
 private StructureField Given_Field(int offset, DataType dt)
 {
     return(new StructureField(offset, dt));
 }
Esempio n. 51
0
 public JsValue(IDictionary <string, JsValue> properties)
 {
     Type   = DataType.Object;
     _value = new Dictionary <string, JsValue>(properties);
 }
Esempio n. 52
0
 public Expression GetMemoryValue(Address addr, DataType dt, SegmentMap segmentMap)
 {
     if (!(dt is PrimitiveType pt))
     {
         return(Constant.Invalid);
     }
Esempio n. 53
0
 public JsValue(IEnumerable array)
 {
     Type   = DataType.Array;
     _value = array;
 }
Esempio n. 54
0
 private Pointer Ptr(DataType dt)
 {
     return(new Pointer(dt, 64));
 }
Esempio n. 55
0
 public JsValue(ushort n)
 {
     Type   = DataType.Number;
     _value = Convert.ToDouble(n);
 }
Esempio n. 56
0
 private JsValue()
 {
     Type = DataType.Null;
 }
Esempio n. 57
0
 public JsValue(string s)
 {
     Type   = DataType.String;
     _value = s;
 }
Esempio n. 58
0
 public JsValue(bool b)
 {
     Type   = DataType.Boolean;
     _value = b;
 }
Esempio n. 59
0
 public override Expression CreateStackAccess(IStorageBinder binder, int cbOffset, DataType dataType)
 {
     //$TODO: another microprocessor with an 8-bit stack pointer.
     throw new NotImplementedException();
 }
Esempio n. 60
0
 public JsValue(double n)
 {
     Type   = DataType.Number;
     _value = n;
 }