Example #1
0
        public void Init(SceneConfig sceneConfig, MagicWallManager manager, Action onSceneCompleted)
        {
            _manager          = manager;
            _onSceneCompleted = onSceneCompleted;

            _cutEffect = CutEffectFactory.GetCutEffect(sceneConfig.sceneType); // 设置过场效果
            _cutEffect.Init(_manager, sceneConfig
                            , OnCutEffectCreateAgentCompleted,
                            () => {
                // on effect completed

                _runEntrance = false;
            }, () =>
            {
                // on display Start

                _runDisplay       = true;
                _displayStartTime = Time.time;
            }
                            );
            _dataType = sceneConfig.dataType; // 设置类型

            //  显示
            _displayBehavior = DisplayBehaviorFactory.GetBehavior(sceneConfig.displayBehavior);

            // 销毁
            _destoryBehavior = DestoryBehaviorFactory.GetBehavior(sceneConfig.destoryBehavior);
            _destoryBehavior.Init(_manager, this, OnDestoryCompleted, sceneConfig);

            _sceneConfig = sceneConfig;

            _magicSceneEnumStatus = MagicSceneEnum.Running;

            _runEntrance = true;
        }
Example #2
0
        //
        //  Init
        //
        public void Init(MagicWallManager manager, SceneConfig sceneConfig,
                         Action <DisplayBehaviorConfig> OnCreateAgentCompleted,
                         Action OnEffectCompleted, Action OnDisplayStart
                         )
        {
            //  初始化 manager
            _manager     = manager;
            _sceneConfig = sceneConfig;

            _dataTypeEnum = sceneConfig.dataType;

            _daoService = _manager.daoServiceFactory.GetDaoService(sceneConfig.daoTypeEnum);

            if (sceneConfig.isKinect == 0)
            {
                row_set = _manager.managerConfig.Row;
            }
            else
            {
                row_set = _manager.managerConfig.KinectRow;
            }


            _onCreateAgentCompleted = OnCreateAgentCompleted;
            _onEffectCompleted      = OnEffectCompleted;
            _onDisplayStart         = OnDisplayStart;
        }
        /// <summary>
        /// Maps a single aggregate to the UI datasource, and only includes the specified datatype segment
        /// returned by the web service, including any additional links
        /// </summary>
        /// <param name="aggregate">the Windfarm Data</param>
        /// <param name="includeOnlyDataType">Include only the specified datatype segment</param>
        /// <param name="generator">Instance of the Link generator class</param>
        /// <returns>UI data source and links</returns>
        //public Windfarm MapAggregate(Core.Model.Aggregate aggregate, DataTypeEnum includeOnlyDataType, IAggregateLinkGenerator generator)
        public Windfarm MapAggregate(Core.Model.Aggregate aggregate, DataTypeEnum includeOnlyDataType, ILinkGenerator<Core.Model.Aggregate> generator)
        {
            if (aggregate == null)
                return new Windfarm();

            //  Create a data segment and a link for each datatype
            var data = new List<WindfarmData>();
            foreach (var d in aggregate.Data)
            {
                if (d.DataType == includeOnlyDataType)
                {
                    data.Add(new WindfarmData()
                    {
                        Type = Enum.GetName(typeof(DataTypeEnum), d.DataType),
                        Data = d.Data
                    });
                    break;      //  Found, now leave immediately
                }
            }
            //  Create the UiAggregate
            var uiAggregate = new Windfarm()
            {
                Id = aggregate.Id,
                Name = aggregate.Name,
                Data = data,
                Links = generator.GenerateItemLinks(aggregate)      //  Include links for all other datatypes
            };
            return uiAggregate;
        }
Example #4
0
            public void PopAssignableTo(Opcode opcode, Type targetType)
            {
                Contract.Requires(opcode != null);
                Contract.Requires(targetType != null);

                if (entries.Count == 0)
                {
                    throw Error("{0} expects a stack operand of type {1}, but the stack is empty.", opcode.Name, targetType.FullName);
                }

                var poppedEntry = Pop(opcode);

                if (poppedEntry.CtsType == null)
                {
                    if (targetType.IsValueType)
                    {
                        throw Error("{0} expects a stack operand of type {1}, but the top of the stack is a null value.", opcode.Name, targetType.FullName);
                    }
                }
                else if (!targetType.IsAssignableFrom(poppedEntry.CtsType))
                {
                    var targetDataType = DataTypeEnum.FromCtsType(targetType);
                    if (targetDataType.ToStackType() != poppedEntry.DataType ||
                        targetDataType == DataType.ValueType ||
                        targetDataType == DataType.ObjectReference)
                    {
                        throw Error("{0} expects a stack operand of type {1} but the stack top has type {2}.",
                                    opcode.Name, targetType.FullName, poppedEntry.CtsType.FullName);
                    }
                }
            }
Example #5
0
 public Field(string name, DataTypeEnum type, int ordinal)
 {
     this.Name         = name;
     this.DataType     = type;
     this.AutoIncStart = -1;
     this.Ordinal      = ordinal;
 }
Example #6
0
 /// <summary>
 /// 初始化值
 /// </summary>
 /// <param name="_ColumnName"></param>
 /// <param name="_DataTypeEnum"></param>
 /// <param name="_ColumnLong"></param>
 /// <param name="_IsKeyPrimary"></param>
 public ColumnStruct(string _ColumnName, DataTypeEnum _DataTypeEnum, int _ColumnLong, bool _IsKeyPrimary)
 {
     this._ColumnName   = _ColumnName;
     this._DataTypeEnum = _DataTypeEnum;
     this._ColumnLong   = _ColumnLong;
     this._IsKeyPrimary = _IsKeyPrimary;
 }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            byte[]       data     = (byte[])values[0];
            DataTypeEnum dataType = (DataTypeEnum)values[1];

            return(DisplayData(data, dataType));
        }
Example #8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                string sType        = cmbDataTypes.SelectedItem as string,
                       name         = txtFieldName.Text.Trim(),
                       defaultValue = chkNull.Checked ? null : txtDefaultValue.Text.Trim();

                if (name.Length == 0)
                {
                    throw new Exception("You must provide a name for the new field");
                }

                this.Cursor = Cursors.WaitCursor;
                this.Update();

                DataTypeEnum dataType = (DataTypeEnum)Enum.Parse(typeof(DataTypeEnum), sType);
                Field        newField = new Field(name, dataType);
                _fileDb.AddField(newField, defaultValue);

                this.Cursor       = Cursors.Default;
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
 public static void ExpectedDataType(this Variable variable, DataTypeEnum datatype)
 {
     if (variable.ValueType != datatype)
     {
         throw new FEELException($"Expected data type: {datatype} but is: {variable.ValueType}");
     }
 }
        private DataType GetDataType(DataTypeEnum dt)
        {
            switch (dt)
            {
            case DataTypeEnum.Int16:
            case DataTypeEnum.Int32:
            case DataTypeEnum.Int64:
                return(DataType.Int);

            case DataTypeEnum.Decimal:
            case DataTypeEnum.Double:
            case DataTypeEnum.Single:
                return(DataType.Decimal);

            case DataTypeEnum.DateTime:
                return(DataType.DateTime);

            case DataTypeEnum.Boolean:
                return(DataType.Boolean);

            case DataTypeEnum.Object:
                return(DataType.Image);

            case DataTypeEnum.Text:
                return(DataType.Text);

            default:
                return(DataType.String);
            }
        }
Example #11
0
 private void SetDefaultValues()
 {
     Path       = "Data";
     Position   = PositionTypeEnum.Relative;
     Type       = DataTypeEnum.XML;
     IsReadOnly = false;
 }
Example #12
0
 /// <summary>
 /// Creates a
 /// </summary>
 /// <param name="fieldNameArg"></param>
 /// <param name="fieldValueArg"></param>
 public FieldValuePair(string fieldNameArg, object fieldValueArg, DataTypeEnum fieldDataType)
 {
     // set properties
     this.FieldName     = fieldNameArg;
     this.fieldValue    = fieldValueArg;
     this.FieldDataType = fieldDataType;
 }
Example #13
0
 public AccessDaoPropertyModel(Property property)
 {
     Name = property.Name;
     try { Value = property.Value?.ToString(); }
     catch (Exception ex) { Value = ex.Message; }
     Type = (DataTypeEnum)property.Type;
 }
Example #14
0
        public Address(uint addr, uint length, uint pointer, string info, DataTypeEnum type, uint blockSize = 0, uint[] pointerIndexes = null)
        {
            this.Addr   = U.toOffset(addr);
            this.Length = length;
            this.Info   = info;

            Debug.Assert(U.isSafetyOffset(this.Addr));

            if (!U.isSafetyLength(this.Addr, length))
            {//あまりにも長すぎる.
                length = 0;
            }

            if (pointer == U.NOT_FOUND)
            {
                this.Pointer = U.NOT_FOUND;
            }
            else
            {
                this.Pointer = U.toOffset(pointer);
                Debug.Assert(U.isSafetyOffset(this.Pointer));
            }
            this.DataType       = type;
            this.BlockSize      = blockSize;
            this.PointerIndexes = pointerIndexes;
#if DEBUG
            if (type == DataTypeEnum.InputFormRef)
            {
                Debug.Assert(blockSize > 0);
            }
#endif
        }
Example #15
0
        /// <summary>
        /// Post带参请求
        /// </summary>
        /// <param name="url"></param>
        /// <param name="contentType">指定参数类型</param>
        /// <param name="strData"></param>
        /// <param name="dicHeader"></param>
        /// <returns></returns>
        public static string PostRequest(string url, DataTypeEnum contentType, string strData, Dictionary <string, string> dicHeader = null)
        {
            string result;
            var    webRequest = WebRequest.Create(url);

            if (dicHeader != null)
            {
                foreach (var m in dicHeader)
                {
                    webRequest.Headers.Add(m.Key, m.Value);
                }
            }
            webRequest.Method = MethodTypeEnum.Post.ToString();
            webRequest.Proxy  = null;
            if (contentType == DataTypeEnum.Form)
            {
                webRequest.ContentType = "application/x-www-form-urlencoded";
            }
            else
            {
                webRequest.ContentType = "application/" + contentType;
            }

            byte[] reqBodyBytes = System.Text.Encoding.UTF8.GetBytes(strData);
            Stream reqStream    = webRequest.GetRequestStream(); //加入需要发送的参数

            reqStream.Write(reqBodyBytes, 0, reqBodyBytes.Length);
            reqStream.Close();
            using (var reader = new StreamReader(webRequest.GetResponse().GetResponseStream()))
            {
                result = reader.ReadToEnd();
            }
            return(result);
        }
Example #16
0
        /// <summary>
        /// 创建网络交流传输对象
        /// </summary>
        /// <param name="dataType">数据类型</param>
        /// <param name="data">传输数据</param>
        /// <param name="isSuccess">是否成功,服务端发送给客户端</param>
        /// <param name="detail">要发送给客户端的细节字符串</param>
        public CommunicateObj(DataTypeEnum dataType, Object data, bool isSuccess, string detail, Type type = null)
        {
            StringBuilder buffer = new StringBuilder();

            DataType     = dataType;
            IsSuccess    = isSuccess;
            DetailString = detail;

            if ((data != null) && (type == null))
            {
                throw new Exception("没有标明数据类型");
            }



            if (data != null)
            {
                //序列化数据为字符串
                XmlSerializer serializer = new XmlSerializer(type);
                using (TextWriter writer = new StringWriter(buffer))
                {
                    serializer.Serialize(writer, data);
                }
                Data = buffer.ToString();
            }
        }
Example #17
0
        /// <summary>
        /// Post带参请求
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="ContentType">指定参数类型</param>
        /// <param name="strData"></param>
        /// <returns></returns>
        public static string PostRequest(string url, DataTypeEnum ContentType, string strData)
        {
            string     result     = string.Empty;
            WebRequest webRequest = WebRequest.Create(url);

            webRequest.Method = MethodTypeEnum.Post.ToString();

            if (ContentType == DataTypeEnum.form)
            {
                webRequest.ContentType = "application/x-www-form-urlencoded";
            }
            else
            {
                webRequest.ContentType = "application/" + ContentType.ToString();
            }

            byte[] reqBodyBytes = System.Text.Encoding.UTF8.GetBytes(strData);
            Stream reqStream    = webRequest.GetRequestStream();//加入需要发送的参数

            reqStream.Write(reqBodyBytes, 0, reqBodyBytes.Length);
            reqStream.Close();
            using (StreamReader reader = new StreamReader(webRequest.GetResponse().GetResponseStream()))
            {
                result = reader.ReadToEnd();
            }
            return(result);
        }
Example #18
0
        public static SaveDataTypeEnum AnalysisTypeToSaveType(DataTypeEnum type)
        {
            switch (type)
            {
            case DataTypeEnum.UBYTE:
                return(SaveDataTypeEnum.V_UNIT);

            case DataTypeEnum.SBYTE:
                return(SaveDataTypeEnum.V_INT);

            case DataTypeEnum.UWORD:
                return(SaveDataTypeEnum.V_UNIT);

            case DataTypeEnum.SWORD:
                return(SaveDataTypeEnum.V_INT);

            case DataTypeEnum.ULONG:
                return(SaveDataTypeEnum.V_UNIT);

            case DataTypeEnum.SLONG:
                return(SaveDataTypeEnum.V_INT);

            case DataTypeEnum.FLOAT32_IEEE:
                return(SaveDataTypeEnum.V_FL4);

            default:
                return(SaveDataTypeEnum.V_NULL);
            }
        }
Example #19
0
        public static int AnalysisTypeToLength(DataTypeEnum type)
        {
            switch (type)
            {
            case DataTypeEnum.UBYTE:
                return(1);

            case DataTypeEnum.SBYTE:
                return(1);

            case DataTypeEnum.UWORD:
                return(2);

            case DataTypeEnum.SWORD:
                return(2);

            case DataTypeEnum.ULONG:
                return(4);

            case DataTypeEnum.SLONG:
                return(4);

            case DataTypeEnum.FLOAT32_IEEE:
                return(4);

            default:
                return(0);
            }
        }
Example #20
0
        public bool Upgrade()
        {
            ColumnCollection oldcolumns = null;
            BusinessObject   BO         = null;
            object           dsid       = SqlHelper.ExecuteScalar(_metastring, "select DataSourceID from uap_report where id='" + _reportid + "'");

            if (dsid != null)
            {
                oldcolumns = ((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns;
                //((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns=new ColumnCollection();
            }
            else
            {
                //new bo
            }

            ColumnCollection newcolumns = ((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns;
            //获取老报表数据,考虑列的顺序
            SqlDataReader reader = SqlHelper.ExecuteReader(_datastring, "select ,, from rpt order by orderid");

            while (reader.Read())
            {
                string      columnname = reader["ColumnName"].ToString();
                TableColumn column     = AlreadyInColumns(columnname, oldcolumns);
                if (column != null)
                {
                    newcolumns.Add(column);
                }
                else//不存在则加进去
                {
                    DataTypeEnum dt   = GetDataType();
                    string       desc = null;
                    column = new TableColumn(columnname, dt, desc);
                    newcolumns.Add(column);
                }
            }
            ConfigureServiceProxy c = new ConfigureServiceProxy();

            c.UpdateBusinessObject(BO);

            UpgradeReport ur = new UpgradeReport();

            ur.DataSourceID = BO.MetaID;


            //创建BusinessObject对象,并调用Save方法
            //创建Report对象,并调用Save方法
            //reportengine
            //Report report=reportengine.DesignReport()
            //reportengine.UpgradeSave(report,ref commonxml,ref cnxml,ref twxml,ref enxml);
            //if rpt_id在meta库中UAP_Report表不存在
            //BusinessObject BO = new BusinessObject();
            //else rpt_id在meta库中UAP_Report表存在
            //ConfigureServiceProxy proxy =new ConfigureServiceProxy();
            //proxy.GetBusinessObject()

            ur.Save();
            return(true);
        }
Example #21
0
        internal ConversionOpcode(Emit.OpCode opcode) : base(opcode)
        {
            var match = nameRegex.Match(opcode.Name);

            targetDataType    = DataTypeEnum.TryParseNameInOpcode(match.Groups[2].Value).Value;
            isSourceUnsigned  = match.Groups[3].Success;
            isOverflowChecked = match.Groups[1].Success;
        }
Example #22
0
 public ParameterMeta(string strParamName,
                      DataTypeEnum enumDataType,
                      ParameterDirectionEnum enumDirection,
                      IDataTypeDictionary typeMap)
     : base(strParamName, enumDataType, typeMap)
 {
     _eDirection = enumDirection;
 }
Example #23
0
 internal Schema(String name, String displayname, DataTypeEnum datatype, Int32 maxlength, Boolean isindexed)
 {
     Name        = name;
     DisplayName = displayname;
     DataType    = datatype;
     MaxLength   = maxlength;
     IsIndexed   = isindexed;
 }
Example #24
0
        public string ToString(DataTypeEnum dtType)
        {
            LoadMap();

            string valueTmp = _dtMap.FindT2(dtType);

            return((valueTmp != null) ? valueTmp : string.Empty);
        }
 public static BaseDataTypeHelper GetHelper(DataTypeEnum data_type)
 {
     if (_helpers.ContainsKey((int)data_type))
     {
         return(_helpers[(int)data_type]);
     }
     return(null);
 }
Example #26
0
        public LContext(DataTypeEnum dataType, string path, PositionTypeEnum positionType, bool isReadOnly)
        {
            Path       = path;
            Position   = positionType;
            Type       = dataType;
            IsReadOnly = isReadOnly;

            InitDbSet();
        }
        /// <summary>
        /// Gets the Aggregate for the specified Id, and the specified
        /// datatype.
        /// </summary>
        /// <param name="id">The specified Id</param>
        /// <param name="dataType">The specified DataType</param>
        /// <returns>An Aggregate</returns>
        public Aggregate Get(int id, DataTypeEnum dataType)
        {
            var aggregate = _uow.AggregatedData
                .Include(d => d.Aggregate)
                .Where(d => d.DataType == dataType && d.Aggregate.Id == id)
                .Select(d => d.Aggregate).FirstOrDefault();

            return aggregate;
        }
Example #28
0
        public FlockData GetFlockDataByScene(DataTypeEnum type, int sceneIndex)
        {
            var item = GetFlockData(type);

            //Debug.Log("Get by scene : " + item.GetId());


            return(item);
        }
Example #29
0
        public IntComponent(DataTypeEnum dataType)
        {
            _dataType = dataType;
            InitializeComponent();
            _timestamp = DateTimeOffset.Now;

            txBox.Text         = "0";
            txBox.TextChanged += TxBox_TextChanged;
        }
Example #30
0
        /// <summary>
        /// Adds a parameter to the specified command object using the specified parameters.
        /// </summary>
        /// <param name="oADOCommand">Command to which to add the parameter</param>
        /// <param name="parameterType">Data type for the parameter</param>
        /// <param name="varParameterValue">Value for the parameter</param>
        /// <param name="parameterDirection">Direction of the parameter - In, Out, In/Out</param>
        /// <param name="parameterName">Name of the parameter</param>
        /// <returns>Boolean indicating status</returns>
        private bool AddParameterToCommand(Command oADOCommand, DataTypeEnum parameterType, object varParameterValue, ParameterDirectionEnum parameterDirection, string parameterName)
        {
            bool returnValue = false;

            try
            {
                Parameter oParameter = default(Parameter);
                Command   adoCommand = oADOCommand;
                oParameter           = adoCommand.CreateParameter();
                oParameter.Direction = parameterDirection;

                if (parameterName.Length > 0)
                {
                    oParameter.Name = parameterName;
                }

                oParameter.Type = parameterType;
                if (oParameter.Type == DataTypeEnum.adChar | oParameter.Type == DataTypeEnum.adVarChar)
                {
                    if (Convert.IsDBNull(varParameterValue) || (string)varParameterValue == string.Empty)
                    {
                        oParameter.Size = 1;
                    }
                    else
                    {
                        oParameter.Size = Convert.ToInt32(varParameterValue.ToString().Length);
                    }
                }

                if (Convert.IsDBNull(varParameterValue) || varParameterValue.ToString() == string.Empty)
                {
                    Object adParamNullable = null;
                    oParameter.Attributes = Convert.ToInt32(adParamNullable);
                    oParameter.Direction  = ParameterDirectionEnum.adParamInput;
                    oParameter.Value      = DBNull.Value;
                }
                else
                {
                    oParameter.Value = varParameterValue;
                }
                adoCommand.Parameters.Append(oParameter);
                oParameter  = null;
                returnValue = true;
            }
            catch (Exception ex)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show(m_Application.ApplicationWindow, TRACE_ADD_PARAMETER_ERROR + ": " + ex.Message, ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                WriteToCommandLog("ERROR", TRACE_ADD_PARAMETER_ERROR + ": " + ex.Message, "commonTraceHelper.AddParameterToCommand");
                returnValue = false;
            }

            return(returnValue);
        }
Example #31
0
        internal ElementReferenceOpcode(Emit.OpCode opcode) : base(opcode)
        {
            string name     = opcode.Name;
            int    dotIndex = name.LastIndexOf('.');

            if (dotIndex >= 0)
            {
                dataType = DataTypeEnum.TryParseNameInOpcode(name.Substring(dotIndex + 1));
            }
        }
        /// <summary>
        /// Create GenericField object
        /// </summary>
        /// <param name="name">Name Of Generic Field</param>
        /// <param name="dataValue">Vlaue of generic field</param>
        /// <param name="type">Type of generic field</param>
        /// <returns> GenericField</returns>
        private GenericField createGenericField(string name, DataValue dataValue, DataTypeEnum type)
        {
            GenericField genericField = new GenericField();

            genericField.dataType          = type;
            genericField.dataTypeSpecified = true;
            genericField.name      = name;
            genericField.DataValue = dataValue;
            return(genericField);
        }
 public void Refresh(DataTypeEnum dataType)
 {
     switch(dataType)
     {
         case DataTypeEnum.Group:
             GroupMaintenance.Instance.Clear();
             GroupMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.Site:
             SiteMaintenance.Instance.Clear();
             SiteMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.Equipment:
             EquipmentMaintenance.Instance.Clear();
             EquipmentMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.Signal:
             SignalMaintenance.Instance.Clear();
             SignalMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.Affair:
             AffairMaintenance.Instance.Clear();
             AffairMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.Command:
             CommandMaintenance.Instance.Clear();
             CommandMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.CommandDO:
             CommandDOMaintenance.Instance.Clear();
             CommandDOMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.User:
             UserInfoMaintenance.Instance.Clear();
             UserInfoMaintenance.Instance.Initialize();
             break;
         case DataTypeEnum.PageScheme:
             PageContextMaintenance.Instance.Clear();
             break;
         case DataTypeEnum.Camera:
             CameraMaintenance.Instance.Clear();
             break;
         case DataTypeEnum.Right:
             RightMaintenance.Instance.Clear();
             break;
         default:
             SelfClear();
             SelfInitialize();
             break;
     }
 }
        public static bool ParseField(this DataRow row, string columnName, DataTypeEnum dataType)
        {
            bool isValidValue = false;
            switch (dataType)
            {
                case DataTypeEnum.Date:
                    isValidValue = !row.Field<DateTime?>(columnName).HasValue;
                    break;
                case DataTypeEnum.Int:
                    break;
                case DataTypeEnum.Double:
                    break;
                default:
                    break;
            }

            return isValidValue;
        }
        private static DataTypeEnum CreateField(DataType dataType, PropertyInfo property)
        {
            var dataTypeEnum = dataType.DataTypeEnums
                .EmptyIfNull()
                .SingleOrDefault(x => x.Value == property.Name);

            if (dataTypeEnum == null)
            {
                dataTypeEnum = new DataTypeEnum
                {
                    DataTypeEnumDescriptions = new List<DataTypeEnumDescription>(),
                    Value = property.Name
                };

                dataType.AddDataTypeEnum(dataTypeEnum);
            }

            return dataTypeEnum;
        }
        private static void AddMultilingualDescription(PropertyInfo property, DataTypeEnum dataTypeEnum, DataType dataType)
        {
            foreach (var description in property.GetCustomAttributes<LanguageAttribute>())
            {
                var enumDescription = dataTypeEnum.DataTypeEnumDescriptions
                    .EmptyIfNull()
                    .SingleOrDefault(x => x.CultureCode == description.Language);

                if (enumDescription == null)
                {
                    enumDescription = new DataTypeEnumDescription
                    {
                        CultureCode = description.Language
                    };
                    dataTypeEnum.AddDescription(enumDescription);
                }

                enumDescription.DisplayName = description.DisplayName;
                enumDescription.Description = description.Description ?? string.Empty;
            }

            dataType.AddDataTypeEnum(dataTypeEnum);
        }
        public static List<LogData> ReferenceDataTypeCheck(this DataTable dataTable, string columnName
            , DataTypeEnum dataType, string DataTypeField, DataTable referenceTable, string referenceDataTypeField, string referenceCompareField)
        {
            var logs = new List<LogData>();
            var typeSpecificData = referenceTable.Rows.Cast<DataRow>().Where(a => a.Field<string>(referenceCompareField) == dataType.ToString())
                .Select(b => b.Field<string>(referenceDataTypeField));

            var invalidRows = dataTable.Rows.Cast<DataRow>().Where(a => typeSpecificData.Contains(a.Field<string>(DataTypeField), StringComparer.CurrentCultureIgnoreCase)
                && a.ParseField(columnName, dataType));
            foreach (var row in invalidRows)
            {
                logs.Add(new LogData
                {
                    WorkSheet = dataTable.TableName,
                    ColumnName = columnName,
                    RowNumber = dataTable.Rows.IndexOf(row) + 2,
                    LogMessage = columnName + " value is not correct format"
                });
                //str.AppendFormat("{0} : {1} : Row {2} : {3}{4}", dataTable.TableName, columnName, dataTable.Rows.IndexOf(row) + 2,
                //            columnName, " value is not correct format.\n");
            }

            return logs;
        }
Example #38
0
 private bool SaveStub(DbContextWrapper ilcdDb, DataTypeEnum dtEnum)
 {
     bool isSaved = false;
     string uuid = GetCommonUUID();
     if (ilcdDb.GetIlcdEntity(GetCommonUUID()) == null)
     {
         ILCDEntity stub = SaveIlcdStub(ilcdDb, dtEnum);
         isSaved = ilcdDb.AddEntity<ILCDEntity>(stub);
     }
     return isSaved;
 }
Example #39
0
 private ILCDEntity SaveIlcdStub(DbContextWrapper ilcdDb, DataTypeEnum dtEnum)
 {
     ILCDEntity ilcdEntity = new ILCDEntity();
     ilcdEntity.UUID = GetCommonUUID();
     ilcdEntity.Version = GetCommonVersion();
     ilcdEntity.DataTypeID = Convert.ToInt32(dtEnum);
     ilcdEntity.DataSourceID = ilcdDb.GetCurrentIlcdDataSourceID();
     return ilcdEntity;
 }
Example #40
0
        public void AdodbDataType_property_returns_adodb_data_type_that_is_converted_from_field_data_type(DataType dataType, DataTypeEnum adodbDataType)
        {
            var field = new Field("Test_Field", dataType);

            Assert.That(field.AdodbDataType, Is.EqualTo(adodbDataType));
        }
Example #41
0
 public void Refresh(DataTypeEnum dataType)
 {
     try
     {
         PageLogger.RecordInfoLog(String.Format("Refresh {0}", dataType.ToString()));
         PageEntityMaintenance.Instance.Refresh(dataType);
     }
     catch (Exception ex)
     {
         PageLogger.RecordErrorLog("Refresh", ex);
     }
 }
 private static bool ConvertCyPhyDataTypeEnum(CyPhyClasses.Parameter.AttributesClass.DataType_enum cyphyDataType, out DataTypeEnum xDataType)
 {
     if (cyphyDataType == CyPhyClasses.Parameter.AttributesClass.DataType_enum.Float)
     {
         xDataType = DataTypeEnum.Real;
     }
     else
     {
         var valid = Enum.TryParse(cyphyDataType.ToString(), true, out xDataType);
         return valid;
     }
     return true;
 }
Example #43
0
 /// <summary>
 /// 从xml文件中初始化对象
 /// </summary>
 /// <param name="xml"></param>
 public override void FromXML(XmlNode node)
 {
     this._guid = node.Attributes["Guid"].Value;
     this.Code = node.Attributes["Code"].Value;
     this.Name = node.Attributes["Name"].Value;
     this.IsNull = node.Attributes["IsNull"].Value.ToString() == "1" ? true : false;
     if (node.Attributes["IsViewer"] != null)
     {
         this._isViewer = node.Attributes["IsViewer"].Value.ToString() == "1" ? true : false;
     }
     else
     {
         this._isViewer = false;
     }
     if (node.Attributes["IsBizKey"] != null)
     {
         this._isBizKey = node.Attributes["IsBizKey"].Value.ToString() == "1" ? true : false;
     }
     else
     {
         this._isBizKey = false;
     }
     this._dataType = (DataTypeEnum)Enum.Parse(typeof(DataTypeEnum), node.Attributes["DataType"].Value);
     if (this._dataType != DataTypeEnum.CommonType)
     {
         this._refGuid = node.Attributes["RefGuid"].Value.ToString();
         //如果是聚合类型需要知道聚合对象的字段是哪个
         if (this._dataType == Base.DataTypeEnum.CompositionType)
         {
             //如果出现聚合,则需要重新查找该聚合字段所对应的引用字段
             XmlDocument xd = new XmlDocument();
             xd.Load(this.BEProj.ProjPath);
             XmlNode refNode = xd.SelectSingleNode("EntityProj/EntityList/Entity[@Guid='" + this.RefGuid + "']/Attributes/Attribute[@RefColGuid='" + this.Guid + "']");
             if (refNode != null)
             {
                 this._refColCode = refNode.Attributes["Code"].Value.ToString();
             }
         }
     }
     if (this._dataType == DataTypeEnum.RefreceType)
     {
         if (node.Attributes["RefColGuid"] != null && node.Attributes["RefColGuid"].Value != null && !string.IsNullOrEmpty(node.Attributes["RefColGuid"].Value.ToString()))
         {
             this._refColGuid = node.Attributes["RefColGuid"].Value.ToString();
         }
     }
     //这是自动生成的
     if (!string.IsNullOrEmpty(this._refGuid))//如果是引用类型,需要重新取数值
     {
         XmlNode refEntityNode = this.Entity.Proj.GetEntityNode(this.RefGuid);
         if (refEntityNode != null)
         {
             if (refEntityNode.Name == "Enum")
             {
                 this._isEnum = true;
             }
             this._refEntityCode = refEntityNode.Attributes["Code"].Value.ToString();
             if (refEntityNode.Attributes["Table"] != null)
             {
                 this._refEntityTableName = refEntityNode.Attributes["Table"].Value.ToString();
             }
             else
             {
                 if (!this._isEnum)
                 {
                     this._refEntityTableName = "T_" + this.RefEntityCode.ToUpper();
                 }
             }
             string projNameSpace = refEntityNode.ParentNode.ParentNode.Attributes["namespace"].Value.ToString();
             if (!string.IsNullOrEmpty(projNameSpace))
             {
                 this._typeString = projNameSpace + "." + this.RefEntityCode;
             }
             else
             {
                 this._typeString = this.RefEntityCode;
             }
         }
         this._length = 0;
     }
     else
     {
         this._typeString = node.Attributes["Type"].Value;
         if (this._typeString == "string")
         {
             if (node.Attributes["Length"] != null)
             {
                 this._length = int.Parse(node.Attributes["Length"].Value);
             }
         }
     }
     this.DataState = DataState.Update;
     this.IsChanged = false;
 }
Example #44
0
 public bool IsOfType(DataTypeEnum filter)
 {
     if (!IsGeneric(filter))
     {
         // they have to equal exactly
         return m_dataType == filter;
     }
     else
     {
         // can be a subset
         switch (filter)
         {
             case DataTypeEnum.ANY:
                 return true;
             default:
                 return false;
         }
     }
 }
Example #45
0
 public static bool IsGeneric(DataTypeEnum check)
 {
     if(System.Enum.GetNames(typeof(DataTypeEnumGeneric)).Contains(
         check.ToString()
         ))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        /// <summary>
        /// Gets all Aggregates that have AggregateData of the type specified
        /// </summary>
        /// <param name="dataType">The DataType</param>
        /// <returns>Collection of Aggregates</returns>
        public IQueryable<Aggregate> GetAllWithDataType(DataTypeEnum dataType)
        {
            var aggregatesContainingDataType = _uow.AggregatedData
                .Include(d => d.Aggregate)
                .Where(d => d.DataType == dataType)
                .Select(d => d.Aggregate)
                .Distinct();

            return aggregatesContainingDataType;
        }
Example #47
0
 /// <summary>
 /// Determines the datatype to be expected as the ajax response
 /// </summary>
 public AjaxRequest DataType(DataTypeEnum type)
 {
     _dataType = type;
     return this;
 }
Example #48
0
 private void CreateListView(DataTypeEnum dataType, IBase entity)
 {
     if (entity.Id != SPECIAL)
     {
         var config = ConfigToolContext.Instance.ToolConfigObject[dataType.ToString()];
         if (config != null)
         {
             var datasource = new List<ConfigObject>(config);
             lvParameters.DisplayMember = "Title";
             lvParameters.ValueMember = "Name";
             lvParameters.DataSource = datasource;
         }
     }
 }
Example #49
0
 public DataField(WorkflowProcess workflowProcess, String name, DataTypeEnum dataType)
     : base(workflowProcess, name)
 {
     this.DataType = dataType;
 }
Example #50
0
 public FieldDataType(String DataType)
     : base(DataType)
 {
     m_dataType =
         (DataTypeEnum) System.Enum.Parse(typeof(DataTypeEnum), DataType);
 }
Example #51
0
 /// <summary>
 /// Returns the default value for a given data type
 /// </summary>
 /// <param name="dataType"></param>
 /// <returns></returns>
 public static object DefaultValue(DataTypeEnum dataType)
 {
     //validation (throws exception if it fails - better now than later)
     switch (dataType)
     {
         case FieldDataType.DataTypeEnum.ANY:
         case FieldDataType.DataTypeEnum.BOOL:
             return (Boolean)false;
         case FieldDataType.DataTypeEnum.NUMBER:
             return (Decimal)0;
         case FieldDataType.DataTypeEnum.DATETIME:
             return DateTime.MinValue;
         case FieldDataType.DataTypeEnum.STRING:
             return string.Empty;
         default:
             return null;
     }
 }
Example #52
0
 /// <summary>
 /// Checks that the given object is valid for the given data type
 /// </summary>
 /// <param name="value"></param>
 /// <param name="dataType"></param>
 /// <returns></returns>
 public static bool CheckType(object value, DataTypeEnum dataType)
 {
     if (value == null)
     {
         return false;
     }
     else
     {
         //validation (throws exception if it fails - better now than later)
         switch (dataType)
         {
             case FieldDataType.DataTypeEnum.ANY:
                 if (value.GetType() != typeof(Boolean) && value.GetType() != typeof(Decimal) &&
                     value.GetType() != typeof(DateTime) && value.GetType() != typeof(String))
                 {
                     return false;
                 }
                 break;
             case FieldDataType.DataTypeEnum.BOOL:
                 if (value.GetType() != typeof(Boolean))
                 {
                     return false;
                 }
                 break;
             case FieldDataType.DataTypeEnum.DATETIME:
                 if (value.GetType() != typeof(DateTime))
                 {
                     return false;
                 }
                 break;
             case FieldDataType.DataTypeEnum.NUMBER:
                 if (value.GetType() != typeof(Decimal))
                 {
                     return false;
                 }
                 break;
             case FieldDataType.DataTypeEnum.STRING:
                 if (value.GetType() != typeof(String))
                 {
                     return false;
                 }
                 break;
         }
         return true;
     }
 }
Example #53
0
 public DataType(DataTypeEnum dataType)
 {
     Id = (int) dataType;
     Description = dataType.ToString();
 }
        /// <summary>
        /// Gets the datatype for the specified aggregate
        /// </summary>
        /// <param name="id">Id of the Aggregate</param>
        /// <param name="type">The Datatype</param>
        /// <returns>Returns the Aggregate, with the specified data type attached</returns>
        public Aggregate GetAggregateWithDataType(int id, DataTypeEnum type)
        {
            var aggregate = _aggregateRepository.Get(id, type);
            if (aggregate == null) return null;

            foreach (var data in aggregate.Data.Where(data => data.DataType == type))
            {
                data.Data = ApplyExternalData(data);
            }

            return aggregate;
        }
Example #55
0
        private void CreateField(TableDef tblName, String strFieldName, Boolean booAllowZeroLength, DataTypeEnum fieldType,
                                int lngAttributes, int intMaxLength, Object defaultValue)
        {
            Field tmpNewField = tblName.CreateField(strFieldName, fieldType, intMaxLength);

            if (fieldType == DataTypeEnum.dbText || fieldType == DataTypeEnum.dbMemo)
                tmpNewField.AllowZeroLength = booAllowZeroLength;

            tmpNewField.Attributes = lngAttributes;

            if (defaultValue != null)
                tmpNewField.DefaultValue = defaultValue;

            tblName.Fields.Append(tmpNewField);
        }
Example #56
0
 public void Refresh(DataTypeEnum dataType)
 {
     PageEntityMaintenance.Instance.Refresh(dataType);
 }
 private static bool ConvertCyPhyDataTypeEnum(DataTypeEnum xDataType, out CyPhyClasses.Property.AttributesClass.DataType_enum cyphyDataType)
 {
     if (xDataType == DataTypeEnum.Real)
     {
         cyphyDataType = CyPhyClasses.Property.AttributesClass.DataType_enum.Float;
     }
     else
     {
         var valid = Enum.TryParse(xDataType.ToString(), true, out cyphyDataType);
         return valid;
     }
     return true;
 }
        /// <summary>
        /// Gets all aggregates that contain the specified data type
        /// </summary>
        /// <param name="type">The Datatype</param>
        /// <returns>Collection of Aggregate classes</returns>
        public IEnumerable<Aggregate> GetAggregatesWithDataType(DataTypeEnum type)
        {
            var aggregates = _aggregateRepository.GetAllWithDataType(type);

            return aggregates;
        }
Example #59
0
 public PhysicalColumn(string colName, int rowCount, PhysicalColumn.DataTypeEnum dataType)
 {
     Name = colName;
     DataType = dataType;
     Row = new PhysicalRow(rowCount, DataType);
 }
Example #60
0
 public FieldDataType(DataTypeEnum DataType)
     : base(System.Enum.GetName(typeof(DataTypeEnum), DataType))
 {
     //Compiler will check validity
     m_dataType = DataType;
 }