Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Column" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="null">if set to <c>true</c> [null].</param>
 /// <param name="default">The default.</param>
 public Column(string name, ColumnTypes type, bool @null, Default @default)
 {
     Name     = name;
     Type     = type;
     Default  = @default;
     Nullable = @null;
 }
Esempio n. 2
0
 public ColumnItem(string text, ColumnTypes controlType, object defaultValue, string categoryName)
 {
     Text = text;
     ControlType = controlType;
     DefaultValue = defaultValue;
     CategoryName = categoryName;
 }
Esempio n. 3
0
        public static SqlDbType ToDbType(ColumnTypes type)
        {
            switch (type)
            {
            case ColumnTypes.Enum:
                return(SqlDbType.Int);

            case ColumnTypes.Refid:
                return(SqlDbType.BigInt);

            case ColumnTypes.String:
                return(SqlDbType.NVarChar);

            case ColumnTypes.Integer:
                return(SqlDbType.BigInt);

            case ColumnTypes.Long:
                return(SqlDbType.BigInt);

            case ColumnTypes.Float:
                return(SqlDbType.Float);

            case ColumnTypes.Set:
                return(SqlDbType.BigInt);

            default:
                throw new Exception("bad type");
            }
        }
Esempio n. 4
0
        public static AccountSettingsColumn GetColumnByType(this AccountSettings settings, ColumnTypes columnType)
        {
#pragma warning disable 618
            return settings.Columns
                .FirstOrDefault(c => string.Compare(c.ColumnType.SystemName, columnType.ToString(), true) == 0);
#pragma warning restore 618
        }
Esempio n. 5
0
        /// <summary>
        /// 获取父节点的名称和ID
        /// 只取2级
        /// </summary>
        /// <param name="type"></param>
        /// <param name="parentid"></param>
        /// <param name="isShow"></param>
        /// <returns></returns>
        public Dictionary <Guid, string> GetParentColumns(ColumnTypes columnType, Guid parentid, bool isShow = false)
        {
            var query = _columnsRepository.Table;

            query = query.Where(c => c.ColumnType == (int)columnType);
            string key = string.Format(",{0},", parentid);

            if (!string.IsNullOrEmpty(parentid.ToString()))
            {
                query = query.Where(c => c.ColumnList.Contains(key));
            }
            if (!isShow)
            {
                query = query.Where(c => c.Status == (int)StatusTypes.Normal);
            }

            query = query.OrderBy(c => c.CreatedOnUtc);
            var list = query.ToList();
            Dictionary <Guid, string> dic = new Dictionary <Guid, string>();

            list.Where(c => c.ParentId == parentid).ToList().ForEach(m =>
            {
                dic.Add(m.Id, m.ColumnTitle);
                var subdic = query.Where(c => c.ParentId == m.Id).Select(model => new { id = model.Id, name = model.ColumnTitle })
                             .ToDictionary(c => c.id, c => c.name);
                foreach (var dt in subdic)
                {
                    dic.Add(dt.Key, dt.Value);
                }
            });
            return(dic);
        }
Esempio n. 6
0
        private OrderedDictionary IsMatchingPartial(OrderedDictionary attributes, DataRow row)
        {
            OrderedDictionary partialAttr = new OrderedDictionary();

            foreach (DictionaryEntry attrValue in attributes)
            {
                var value = attrValue.Value.ToString();
                ColumnTypes.TryGetValue(attrValue.Key.ToString(), out ColumnType type);
                if (type == ColumnType.SYMBOLIC)//if (!value.Contains(".."))
                {
                    if (new string[] { value, "*", "-" }.Contains(row[attrValue.Key.ToString()].ToString()))
                    {
                        partialAttr.Add(attrValue.Key, attrValue.Value);
                    }
                }
                else//Interval
                {
                    var intervals = value.Split(new string[] { ".." }, StringSplitOptions.RemoveEmptyEntries);
                    if (float.TryParse(intervals[0], out float min) &&
                        float.TryParse(intervals[1], out float max) && float.TryParse(row[attrValue.Key.ToString()].ToString(), out float data))
                    {
                        if (data > min && data < max)
                        {
                            partialAttr.Add(attrValue.Key, attrValue.Value);
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid Intervals");
                    }
                }
            }

            return(partialAttr);
        }
Esempio n. 7
0
        /// <summary>
        /// 扩展方法:根据表格列(Ext JS)的数据类型获得相应的javascript的类型
        /// </summary>
        /// <param name="pCaller"></param>
        /// <returns></returns>
        public static string GetJavascriptType(this ColumnTypes pCaller)
        {
            switch (pCaller)
            {
            case ColumnTypes.Int:
            case ColumnTypes.Timespan:
                return("int");

            case ColumnTypes.Decimal:
            case ColumnTypes.Percent:
                return("float");

            case ColumnTypes.Boolean:
                return("boolean");

            case ColumnTypes.String:
            case ColumnTypes.Coordinate:
            case ColumnTypes.Photo:
            case ColumnTypes.Customize:
                return("string");

            case ColumnTypes.DateTime:
            case ColumnTypes.Date:
                return("date");

            default:
                throw new NotImplementedException(string.Format("未实现枚举值[{0}]的转换处理.", pCaller));
            }
        }
Esempio n. 8
0
        private void FindNumericOrSymbolic(DataTable dataSet)
        {
            var testData = dataSet.AsEnumerable();

            foreach (DataColumn column in dataSet.Columns)
            {
                bool isNumeric = true;
                var  temp      = testData.Select(t => t.Field <string>(column)).ToList();
                if (column.Ordinal == dataSet.Columns.Count - 2)
                {
                    continue;
                }
                if (column.ColumnName != "ID")
                {
                    foreach (var item in temp)
                    {
                        if (item == "?" || item == "*")
                        {
                            continue;
                        }
                        if (!float.TryParse(item, out float result))
                        {
                            isNumeric = false;
                            ColumnTypes.Add(column.ColumnName, ColumnType.SYMBOLIC);
                            break;
                        }
                    }
                    if (isNumeric)
                    {
                        ColumnTypes.Add(column.ColumnName, ColumnType.NUMERIC);
                    }
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Column" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="null">if set to <c>true</c> [null].</param>
        /// <param name="default">The default.</param>
        public Column(string name, ColumnTypes type, bool @null, Default @default)
        {
			Name = name;
			Type = type;
			Default = @default;
            Nullable = @null;
		}
        public FullFactorialDOEStudy(string name, string description, WorkflowComponent workflow, List <Data> factors, List <decimal> startingValues, List <decimal> stepSizes, List <int> noOfLevels, List <Data> responses)
            : base(name, description, workflow, factors, responses)
        {
            base.StudiedComponent = workflow;

            this.startingValues = startingValues;
            this.stepSizes      = stepSizes;
            this.noOfLevels     = noOfLevels;



            ColumnNames.Add("ID");
            ColumnTypes.Add(DataTypes.INTEGER);
            ColumnFormats.Add(0);
            ColumnUnits.Add("");

            for (int i = 0; i < factors.Count; i++)
            {
                string columnHeader = factors[i].Name;
                ColumnNames.Add(columnHeader);
                if (factors[i] is IntegerData)
                {
                    ColumnTypes.Add(DataTypes.INTEGER);
                    ColumnFormats.Add(0);
                    ColumnUnits.Add(((IntegerData)factors[i]).Unit);
                }
                else if (factors[i] is DoubleData)
                {
                    ColumnTypes.Add(DataTypes.DOUBLE);
                    ColumnFormats.Add(((DoubleData)factors[i]).DecimalPlaces);
                    ColumnUnits.Add(((DoubleData)factors[i]).Unit);
                }
            }
            for (int i = 0; i < responses.Count; i++)
            {
                string columnHeader = responses[i].Name;
                ColumnNames.Add(columnHeader);
                if (responses[i] is IntegerData)
                {
                    ColumnTypes.Add(DataTypes.INTEGER);
                    ColumnFormats.Add(0);
                    ColumnUnits.Add(((IntegerData)responses[i]).Unit);
                }
                else if (responses[i] is DoubleData)
                {
                    ColumnTypes.Add(DataTypes.DOUBLE);
                    ColumnFormats.Add(((DoubleData)responses[i]).DecimalPlaces);
                    ColumnUnits.Add(((DoubleData)responses[i]).Unit);
                }
            }



            TableNames.Add(Name);



            Treatment = new FullFactorial("testFF", "", Project.ProjectPath + "\\DOE.sdf", workflow as Workflow, factors, startingValues, stepSizes, noOfLevels, responses);
            Treatment.CreateFolder();
        }
Esempio n. 11
0
 protected ColumnDefinition ColDef(string name, ColumnTypes columnType, bool isPrimary)
 {
     return(new ColumnDefinition()
     {
         Name = name, Type = columnType, IsPrimary = isPrimary
     });
 }
Esempio n. 12
0
        //private void SelectiveCutpoints(DataTable dataSet)
        //{
        //    var dataEnumer = dataSet.AsEnumerable();
        //    foreach (var cutPoint in CutPoints)
        //    {
        //        dataEnumer.Where(t=>t.Field<float>(cutPoint.Key)>=)
        //    }
        //}

        private DataTable ReorderDataSet(DataTable dataSet)
        {
            var numeric = ColumnTypes.Where(t => t.Value == ColumnType.NUMERIC);
            int ordinal = 0;

            if (numeric.Count() > 0)
            {
                foreach (var column in numeric)
                {
                    //ordinal += OriginalDataSet.Columns[column.Key].Ordinal + ordinal - 1 < 0 ?0 : OriginalDataSet.Columns[column.Key].Ordinal;
                    foreach (var cutpoint in CutPoints[column.Key])
                    {
                        dataSet.Columns[string.Concat(column.Key, "|", cutpoint)].SetOrdinal(ordinal);
                        ordinal++;
                    }
                }
            }

            //foreach (var column in ColumnTypes)
            //{
            //    if (column.Value == ColumnType.NUMERIC)
            //    {

            //        foreach (var cutpoint in CutPoints[column.Key])
            //        {
            //            dataSet.Columns[string.Concat(column.Key,"|", cutpoint)].SetOrdinal(ordinal);
            //            ordinal++;
            //        }
            //    }
            //}
            return(dataSet);
        }
Esempio n. 13
0
        public bool ExistColumn(string schema, string table, string column, ColumnTypes columnType)
        {
            using (var connection = new SqlConnection(this.ConnectionString))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    var cmdText = @"
SELECT data_type
FROM information_schema.columns
WHERE table_name = @tableName AND table_schema = @tableSchema AND
column_name=@columnName";

                    command.CommandText = cmdText;

                    command.Parameters.Add("@tableName", SqlDbType.NVarChar).Value   = table;
                    command.Parameters.Add("@tableSchema", SqlDbType.NVarChar).Value = schema;
                    command.Parameters.Add("@columnName", SqlDbType.NVarChar).Value  = column;

                    var dataType = (string)command.ExecuteScalar();
                    if (string.IsNullOrWhiteSpace(dataType))
                    {
                        return(false);
                    }

                    return(this.Match(columnType, dataType));
                }
            }
        }
Esempio n. 14
0
 public ColumnValue(string columnName, object value)
     : this(columnName)
 {
     this.Value = value;
     if (value is double || value is decimal)
     {
         this.DataType = ColumnTypes.Numeric;
     }
     else if (value is int || value is long)
     {
         this.DataType = ColumnTypes.Integer;
     }
     else if (value is DateTime)
     {
         this.DataType = ColumnTypes.DateTime;
     }
     else if (value is bool)
     {
         this.DataType = ColumnTypes.SmallInt;
     }
     else if (value is byte[])
     {
         this.DataType = ColumnTypes.Blob;
     }
 }
Esempio n. 15
0
        public static Type ToType(ColumnTypes type)
        {
            switch (type)
            {
            case ColumnTypes.Enum:
                return(typeof(int));

            case ColumnTypes.Refid:
                return(typeof(long));

            case ColumnTypes.String:
                return(typeof(string));

            case ColumnTypes.Integer:
                return(typeof(long));

            case ColumnTypes.Long:
                return(typeof(long));

            case ColumnTypes.Float:
                return(typeof(double));

            case ColumnTypes.Set:
                return(typeof(long));

            default:
                throw new Exception("wrong type");
            }
        }
        private TableMetadata ReadTableMetadata(ref SequenceReader <byte> reader)
        {
            var numericColumnCount = ColumnTypes.Count(c => IsNumberColumn((ColumnType)c));

            var metadata = new TableMetadata();

            while (reader.Remaining > 0)
            {
                reader.TryRead(out byte filedTypeCode);

                var fieldType = (MetadataFieldType)filedTypeCode;
                var length    = reader.ReadLengthEncodedInteger();

                var subReader = new SequenceReader <byte>(reader.Sequence.Slice(reader.Consumed, length));

                try
                {
                    ReadMetadataField(ref subReader, fieldType, metadata, numericColumnCount);
                }
                finally
                {
                    reader.Advance(length);
                }
            }

            return(metadata);
        }
Esempio n. 17
0
        private void FindNumericOrSymbolic()
        {
            var testData = TestData.AsEnumerable();

            foreach (DataColumn column in TestData.Columns)
            {
                bool isNumeric = true;
                var  temp      = testData.Select(t => t.Field <string>(column)).ToList();
                if (column.ColumnName != "ID")
                {
                    foreach (var item in temp)
                    {
                        if (!float.TryParse(item, out float result))
                        {
                            isNumeric = false;
                            ColumnTypes.Add(column.ColumnName, ColumnType.SYMBOLIC);
                            break;
                        }
                    }
                    if (isNumeric)
                    {
                        ColumnTypes.Add(column.ColumnName, ColumnType.NUMERIC);
                    }
                }
            }
        }
Esempio n. 18
0
 public ColumnItem(string text, ColumnTypes controlType, object defaultValue, string categoryName)
 {
     Text         = text;
     ControlType  = controlType;
     DefaultValue = defaultValue;
     CategoryName = categoryName;
 }
Esempio n. 19
0
        public ColumnConfig(string header, ColumnTypes type, string path = null)
        {
            if (string.IsNullOrWhiteSpace(header))
            {
                header = type.ToString() + _unnamedColumnIndex++;
            }
            Header = header;
            Type   = type;
            if (string.IsNullOrWhiteSpace(path))
            {
                switch (type)
                {
                case ColumnTypes.Level:
                case ColumnTypes.Message:
                case ColumnTypes.Time:
                    Path = type.ToString();
                    break;

                default:
                    Path = header;
                    break;
                }
            }
            else
            {
                Path = path;
            }
        }
Esempio n. 20
0
        internal Statement()
        {
            tables             = new List <EntityTable>();
            columns            = new List <Column>();
            sql                = new StringBuilder();
            allowedColumnTypes = ColumnTypes.EntityColumn | ColumnTypes.FormulaColumn;

            restrictionCount = 0;
        }
Esempio n. 21
0
        /// <summary>
        /// 对属性列生成lamda表达式
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="columnType"></param>
        /// <param name="columnKey"></param>
        /// <returns></returns>
        public LambdaExpression GeneratePropertyLamda <TEntity>(ColumnTypes columnType, string columnKey)
        {
            var dbFuncName          = GetDbFunctionName(columnType);
            var p                   = Expression.Parameter(typeof(TEntity), "x");
            var _pExp               = Expression.Constant($"$.{columnKey}", typeof(string));
            MemberExpression member = Expression.PropertyOrField(p, "Property");
            var expRes              = Expression.Call(typeof(TEntity).GetEntityDbContextType().GetMethod(dbFuncName), member, _pExp);

            return(Expression.Lambda(expRes, p));
        }
Esempio n. 22
0
        /// <summary>
        /// 判断是否存在相同的导航信息
        /// </summary>
        /// <param name="ColumnTitle"></param>
        /// <param name="CategoryType"></param>
        /// <returns></returns>
        public virtual bool ExistsColumns(string ColumnTitle, ColumnTypes columnType)
        {
            if (string.IsNullOrWhiteSpace(ColumnTitle))
            {
                throw new ExceptionExt("Column Name Is Null");
            }
            var query = _columnsRepository.Table.Where(c => c.ColumnTitle == ColumnTitle && c.ColumnType == (int)columnType);

            return(query.Count() > 0 ? true : false);
        }
Esempio n. 23
0
        internal static string GetVariableColumnType(this ColumnTypes columnType)
        {
            switch (columnType)
            {
            case ColumnTypes.AutoNumber:
                return("auto_number");

            case ColumnTypes.ColorPicker:
                return("color_picker");

            case ColumnTypes.CreationLog:
                return("creation_log");

            case ColumnTypes.ItemId:
                return("item_id");

            case ColumnTypes.LastUpdated:
                return("last_updated");

            case ColumnTypes.LongText:
                return("long_text");

            case ColumnTypes.TimeTracking:
                return("time_tracking");

            case ColumnTypes.WorldClock:
                return("world_clock");

            case ColumnTypes.Checkbox:
            case ColumnTypes.Country:
            case ColumnTypes.Date:
            case ColumnTypes.Dropdown:
            case ColumnTypes.Email:
            case ColumnTypes.Hour:
            case ColumnTypes.Link:
            case ColumnTypes.Location:
            case ColumnTypes.Numbers:
            case ColumnTypes.People:
            case ColumnTypes.Phone:
            case ColumnTypes.Progress:
            case ColumnTypes.Rating:
            case ColumnTypes.Status:
            case ColumnTypes.Team:
            case ColumnTypes.Tags:
            case ColumnTypes.Text:
            case ColumnTypes.Timeline:
            case ColumnTypes.Vote:
            case ColumnTypes.Week:
            case ColumnTypes.Integration:
                return(columnType.ToString().ToLower());
            }

            return(null);
        }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldDefinition"/> class.
 /// </summary>
 /// <param name="name">
 /// The name.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="parentTable">
 /// The parent table.
 /// </param>
 /// <param name="securityGuardValue">
 /// The security guard value.
 /// </param>
 /// <param name="includeInResult">
 /// if set to <c>true</c> [include in result].
 /// </param>
 /// <param name="isFilterable">
 /// if set to <c>true</c> [is filterable].
 /// </param>
 /// <param name="nameValuesList">
 /// The name values list.
 /// </param>
 /// <param name="isRichText">
 /// if set to <c>true</c> [is rich text].
 /// </param>
 /// <param name="allowLocalizedData">
 /// The allow localized data.
 /// </param>
 public FieldDefinition(string name, ColumnTypes type, TableDefinition parentTable, string securityGuardValue, bool includeInResult = true, bool isFilterable = true, Dictionary<string, object> nameValuesList = null, bool isRichText = false, bool allowLocalizedData = false)
 {
     this.SystemName = name;
     this.ColumnType = type;
     _parentTable = parentTable;
     SecurityGuardValue = securityGuardValue;
     IncludeInResult = includeInResult;
     IsFilterable = isFilterable;
     NameValuesList = nameValuesList;
     IsRichText = isRichText;
     AllowLocalizedData = allowLocalizedData;
 }
Esempio n. 25
0
        /// <summary>
        /// Maps the specified entity type builder.
        /// </summary>
        /// <param name="entityTypeBuilder">The entity type builder.</param>
        public override void Map(EntityTypeBuilder <CountryEntity> entityTypeBuilder)
        {
            // Table
            entityTypeBuilder.ToTable("Country", SchemaName);

            // Primary Key
            entityTypeBuilder.HasKey(x => x.Id);

            // Properties
            entityTypeBuilder.Property(x => x.DisplayName).HasColumnType(ColumnTypes.GetNVarCharWithSpecifiedLength()).IsRequired();
            entityTypeBuilder.Property(x => x.TwoDigitsAlphabeticCode).IsRequired().HasMaxLength(2);
            entityTypeBuilder.Property(x => x.ThreeDigitsAlphabeticCode).IsRequired().HasMaxLength(3);
        }
Esempio n. 26
0
        public PrintGridItem(ExDataGridView dgv, bool isFit, PrintPageEventArgs e)
        {
            _grid           = dgv;
            _newPage        = true;
            _fitToPageWidth = true;
            _pageNo         = 1;
            _headerTitle    = String.Empty;
            _headerPrinter  = String.Empty;
            _rowPos         = 0;
            _rowsPerPage    = 0;
            _totalWidth     = 0;

            int CellWidth = 0;
            int PageLeft  = e.MarginBounds.Left;

            foreach (DataGridViewColumn GridCol in dgv.Columns)
            {
                if (!GridCol.Visible)
                {
                    continue;
                }

                _totalWidth += GridCol.Width;
            }

            foreach (DataGridViewColumn GridCol in dgv.Columns)
            {
                if (!GridCol.Visible)
                {
                    continue;
                }

                if (isFit)
                {
                    CellWidth = (int)(Math.Floor((double)((double)GridCol.Width / (double)TotalWidth * (double)TotalWidth * ((double)e.MarginBounds.Width / (double)TotalWidth))));
                }
                else
                {
                    CellWidth = GridCol.Width;
                }

                HeaderHeight = (int)(e.Graphics.MeasureString(GridCol.HeaderText, GridCol.InheritedStyle.Font, CellWidth).Height) + 11;

                ColumnLefts.Add(PageLeft);
                ColumnWidths.Add(CellWidth);
                ColumnTypes.Add(GridCol.GetType());
                PageLeft += CellWidth;
            }
        }
        /// <summary>
        /// Extension method to get the cell value for the specified column,
        /// falling back to the fallback position if the column is not found by name
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        public static string GetColumnValue(this DataRow row, ColumnTypes column)
        {
            // Try to get column value by name
            foreach (var name in aliases[column])
            {
                if (row.Table.Columns.Contains(name))
                {
                    return(row[name].ToString());
                }
            }

            // If we did not succeed, get it by fallback position, this will only work if
            // The fields are in proper order
            return(row[((int)column) - 1].ToString());
        }
Esempio n. 28
0
        /// <summary>
        /// Maps the specified entity type builder.
        /// </summary>
        /// <param name="entityTypeBuilder">The entity type builder.</param>
        public override void Map(EntityTypeBuilder <SettingEntity> entityTypeBuilder)
        {
            // Table
            entityTypeBuilder.ToTable("Setting", SchemaName);

            // Primary Key
            entityTypeBuilder.HasKey(x => x.Id);

            // Properties
            entityTypeBuilder.Property(x => x.UniqueName).HasColumnType(ColumnTypes.GetNVarCharWithSpecifiedLength(ColumnLengths.UniqueName)).IsRequired();
            entityTypeBuilder.Property(x => x.Value).HasColumnType(ColumnTypes.NVarCharMax).IsRequired();

            // Index
            entityTypeBuilder.HasIndex(x => x.UniqueName).IsUnique();
        }
Esempio n. 29
0
 public static Column GetColumn(ColumnTypes columnType)
 {
     switch (columnType)
     {
         case ColumnTypes.DOWN:
             return new DownColumn();
         case ColumnTypes.UP:
             return new UpColumn();
         case ColumnTypes.FREE:
             return new FreeColumn();
         case ColumnTypes.ANNOUNCEMENT:
             return new AnnouncementColumn();
         default:
             throw new YambException("");
     }
 }
        /// <summary>
        /// Maps the specified entity type builder.
        /// </summary>
        /// <param name="entityTypeBuilder">The entity type builder.</param>
        public override void Map(EntityTypeBuilder <CityEntity> entityTypeBuilder)
        {
            // Table
            entityTypeBuilder.ToTable("City", SchemaName);

            // Primary Key
            entityTypeBuilder.HasKey(x => x.Id);

            // Properties
            entityTypeBuilder.Property(x => x.CountyId);
            entityTypeBuilder.Property(x => x.DisplayName).HasColumnType(ColumnTypes.GetNVarCharWithSpecifiedLength()).IsRequired();

            // Relationships
            entityTypeBuilder.HasOne(x => x.County)
            .WithMany()
            .HasForeignKey(x => x.CountyId);
        }
        /// <summary>
        /// Determines whether the specified question and answer types are compatible.
        /// </summary>
        /// <param name="questionType">
        /// The question type.
        /// </param>
        /// <param name="answerType">
        /// The answer type.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified types are compatible; otherwise, <c>false</c>.
        /// </returns>
        public bool AreTypesCompatible(ColumnTypes questionType, ColumnTypes answerType)
        {
            switch (answerType)
            {
                case ColumnTypes.Integer:
                    return questionType == ColumnTypes.Integer || questionType == ColumnTypes.Reference;

                case ColumnTypes.String:
                    return questionType == ColumnTypes.String || questionType == ColumnTypes.Frequency || questionType == ColumnTypes.AutoNumber || questionType == ColumnTypes.Label;
                
                case ColumnTypes.Reference:
                    return questionType == ColumnTypes.Reference || questionType == ColumnTypes.Integer;

                default:
                    return questionType == answerType;
            }
        }
Esempio n. 32
0
        public bool EnterDiceValue(IViewTableForm frmTableDisplay, IConfirmForm frmConfirm, ColumnTypes column, LayerTypes layer, FieldTypes field)
        {
            if (_currentDiceThrow == DiceThrow.FIRST && !_turnEnded)
            {
                frmTableDisplay.DisplayMsg(Color.Red, _msg[4]);
                return false;
            }
            else
            {
                if (ValidEntering(frmConfirm, column))
                {
                    try
                    {
                        YambTable.GetInstance().InputValue(column, layer, field, _diceRoller.Dices, _currentDiceThrow);

                        if (column == ColumnTypes.ANNOUNCEMENT)
                        {
                            AnnouncementActions(frmTableDisplay, field);
                        }
                        else
                        {
                            NextTurn();
                            frmTableDisplay.EndOfTurnActions();
                        }

                        if (YambTable.GetInstance().IsTableFull())
                        {
                            frmTableDisplay.GameFinished();
                        }
                    }
                    catch (YambException)
                    {
                        frmTableDisplay.DisplayMsg(Color.Red, _msg[5]);
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
Esempio n. 33
0
        /// <summary>
        /// 扩展方法:根据表格列(Ext JS)的数据类型获得相应的.net的类型
        /// </summary>
        /// <param name="pCaller"></param>
        /// <returns></returns>
        public static Type GetDotNetType(this ColumnTypes pCaller)
        {
            switch (pCaller)
            {
            case ColumnTypes.Int:
                return(typeof(int));

            case ColumnTypes.Decimal:
                return(typeof(decimal));

            case ColumnTypes.Boolean:
                return(typeof(bool));

            case ColumnTypes.String:
                return(typeof(string));

            case ColumnTypes.Date:
                return(typeof(DateTime));

            case ColumnTypes.DateTime:
                return(typeof(DateTime));

            case ColumnTypes.Timespan:
                return(typeof(int));

            case ColumnTypes.Coordinate:
                return(typeof(string));

            case ColumnTypes.Photo:
                return(typeof(string));

            case ColumnTypes.Percent:
                return(typeof(decimal));

            case ColumnTypes.Customize:
                return(typeof(string));

            default:
                throw new NotImplementedException(string.Format("未实现枚举值[{0}]的转换处理.", pCaller));
            }
        }
Esempio n. 34
0
        /// <summary>
        /// 获取列类型对应的自定义属性数据库函数名称
        /// </summary>
        /// <param name="columnType"></param>
        /// <returns></returns>
        private string GetDbFunctionName(ColumnTypes columnType)
        {
            string result = "";

            switch (columnType)
            {
                //case ColumnTypes.DateTime:
                //    result = nameof(MasterDbContext.GetJsonValueDate);
                //    break;
                //case ColumnTypes.Number:
                //    result = nameof(MasterDbContext.GetJsonValueNumber);
                //    break;
                //case ColumnTypes.Switch:
                //    result = nameof(MasterDbContext.GetJsonValueBool);
                //    break;
                //default:
                //    result = nameof(MasterDbContext.GetJsonValueString);
                //    break;
            }
            return(result);
        }
Esempio n. 35
0
        public DataGridColumn Add(string header, ColumnTypes type, string path = null)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                path = header;
            }
            switch (type)
            {
            case ColumnTypes.Level:
                return(AddText(header, "Level", "LevelStyle"));

            case ColumnTypes.Time:
                return(AddTime(header, "Time"));

            case ColumnTypes.Message:
                return(AddText(header, "Message"));

            default:
                return(AddText(header, path));
            }
        }
Esempio n. 36
0
        private string ColumnTypeToString(ColumnTypes type)
        {
            switch (type)
            {
            case ColumnTypes.HoTen: return("Họ Tên");

            case ColumnTypes.CMND: return("CMND");

            case ColumnTypes.NgaySinh: return("Ngày Sinh");

            case ColumnTypes.GioiTinh: return("Giới Tính");

            case ColumnTypes.SoDienThoai: return("Sdt");

            case ColumnTypes.DiaChi: return("Địa chỉ");

            case ColumnTypes.GhiChu: return("Ghi chú");

            default: return("");
            }
        }
Esempio n. 37
0
        protected override bool Match(ColumnTypes columnType, string dataType)
        {
            dataType = dataType.Trim().ToLowerInvariant();

            switch (columnType)
            {
            case ColumnTypes.ObjectId:
                return(dataType.Equals("int"));

            case ColumnTypes.TypeId:
                return(dataType.Equals("uniqueidentifier"));

            case ColumnTypes.CacheId:
                return(dataType.Equals("int"));

            case ColumnTypes.Binary:
                return(dataType.Equals("varbinary"));

            case ColumnTypes.Boolean:
                return(dataType.Equals("bit"));

            case ColumnTypes.Decimal:
                return(dataType.Equals("decimal"));

            case ColumnTypes.Float:
                return(dataType.Equals("float"));

            case ColumnTypes.Integer:
                return(dataType.Equals("int"));

            case ColumnTypes.String:
                return(dataType.Equals("nvarchar"));

            case ColumnTypes.Unique:
                return(dataType.Equals("uniqueidentifier"));

            default:
                throw new Exception("Unsupported columntype " + columnType);
            }
        }
Esempio n. 38
0
        /// <summary>
        /// Initializes new instance of <see cref="T:Cebos.Veyron.Library.Process.Publisher.Definitions.MetricDefinition"/>.
        /// </summary>
        /// <param name="id">Metric's Id number.</param>
        /// <param name="name">The name of the metric.</param>
        /// <param name="guid">The <see cref="T:System.Guid"/> object that is used as unique identifier of the metric object.</param>
        /// <param name="summaryType">Type of the summary.</param>
        /// <param name="lockFilter">if set to <c>true</c> [lock filter].</param>
        /// <param name="snapshotFrequency">The snapshot frequency.</param>
        /// <param name="metricFieldSystemName">The system name of the field who's values used as metric measure.</param>
        /// <param name="groupFieldOneSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldTwoSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldThreeSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldFourSystemName">The system name of the field by which to group values.</param>
        /// <param name="filterGuid">The unique identifier of the filter that used in metric.</param>
        /// <param name="filterDefinition">The filter definition used to store overriden filter certainly filter with overriden UDP property.</param>
        /// <param name="orderByMetricField">The system name of the field by which to sort values or value groups if any defined.</param>
        /// <param name="orderByAscending">Whether to sorts values in ascending order.</param>
        /// <param name="orderByMetricFieldType">The type of the field which is used as sort criteria.</param>
        public MetricDefinition(
            int id,
            string name,
            Guid guid,
            SummaryTypes summaryType,
            bool lockFilter,
            string snapshotFrequency,
            string metricFieldSystemName,
            string groupFieldOneSystemName,
            string groupFieldTwoSystemName,
            string groupFieldThreeSystemName,
            string groupFieldFourSystemName,
            Guid filterGuid,
            string filterDefinition,
            string orderByMetricField,
            bool? orderByAscending,
            ColumnTypes orderByMetricFieldType)
        {
            Id = id;
            Name = name;
            Guid = guid;

            SummaryType = summaryType;
            LockFilter = lockFilter;
            SnapshotFrequency = snapshotFrequency;
            MetricFieldSystemName = metricFieldSystemName;
            GroupFieldOneSystemName = groupFieldOneSystemName;
            GroupFieldTwoSystemName = groupFieldTwoSystemName;
            GroupFieldThreeSystemName = groupFieldThreeSystemName;
            GroupFieldFourSystemName = groupFieldFourSystemName;
            FilterGuid = filterGuid;
            FilterDefinition = filterDefinition;

            OrderByMetricField = orderByMetricField;
            OrderByAscending = orderByAscending;
            OrderByMetricFieldType = orderByMetricFieldType;
        }
 public PropertyAttribute(ColumnTypes columnType)
 {
     this._columnType = columnType;
 }
Esempio n. 40
0
 protected ColumnDefinition ColDef(string name, ColumnTypes columnType)
 {
     return new ColumnDefinition() { Name = name, Type = columnType, IsPrimary = false };
 }
Esempio n. 41
0
 protected ColumnDefinition ColDef(string name, ColumnTypes columnType, bool isPrimary)
 {
     return new ColumnDefinition() { Name = name, Type = columnType, IsPrimary = isPrimary };
 }
Esempio n. 42
0
 public int GetFieldValue(ColumnTypes column, LayerTypes layer, FieldTypes field)
 {
     switch (column)
     {
         case ColumnTypes.DOWN:
             return DownColumn.GetFieldValue(layer, field);
         case ColumnTypes.UP:
             return UpColumn.GetFieldValue(layer, field);
         case ColumnTypes.FREE:
             return FreeColumn.GetFieldValue(layer, field);
         case ColumnTypes.ANNOUNCEMENT:
             return AnnouncementColumn.GetFieldValue(layer, field);
         default:
             throw new YambException("");
     }
 }
Esempio n. 43
0
 protected abstract bool ExistColumn(string schema, string table, string column, ColumnTypes columnType);
Esempio n. 44
0
 private bool ValidEntering(IConfirmForm frmConfirm, ColumnTypes column)
 {
     if (_currentDiceThrow == DiceThrow.FIRST && column == ColumnTypes.ANNOUNCEMENT)
     {
         return true;
     }
     else
     {
         string msg = GetMessage(column);
         return frmConfirm.ShowMsg(msg);
     }
 }
Esempio n. 45
0
 public int GetLayerPointsByColumn(ColumnTypes column, LayerTypes layer)
 {
     switch (column)
     {
         case ColumnTypes.DOWN:
             return DownColumn.GetLayerPoints(layer);
         case ColumnTypes.UP:
             return UpColumn.GetLayerPoints(layer);
         case ColumnTypes.FREE:
             return FreeColumn.GetLayerPoints(layer);
         case ColumnTypes.ANNOUNCEMENT:
             return AnnouncementColumn.GetLayerPoints(layer);
         default:
             throw new YambException("");
     }
 }
Esempio n. 46
0
 public abstract string GetColumnTypeStringSymbol(ColumnTypes type);
Esempio n. 47
0
 private string GetMessage(ColumnTypes column)
 {
     if (column == ColumnTypes.ANNOUNCEMENT && _currentDiceThrow == DiceThrow.SECOND && !_announced)
     {
         return "Announce entry?";
     }
     else
     {
         return "Enter the points?";
     }
 }
Esempio n. 48
0
        public void InputColumn(ColumnTypes type, Column column)
        {
            switch (type)
            {
                case ColumnTypes.DOWN:
                    DownColumn.AddLayers(column.Layers);

                    break;
                case ColumnTypes.UP:
                    UpColumn.AddLayers(column.Layers);
                    break;
                case ColumnTypes.FREE:
                    FreeColumn.AddLayers(column.Layers);
                    break;
                case ColumnTypes.ANNOUNCEMENT:
                    AnnouncementColumn.AddLayers(column.Layers);
                    break;
                default:
                    throw new YambException("");
            }
        }
Esempio n. 49
0
        public int GetFieldValue(ColumnTypes column, LayerTypes layer, FieldTypes field)
        {
            int value = 0;
            try
            {
                value = Columns[column].GetFieldValue(layer, field);
            }
            catch (FieldIsEmptyException)
            {
            }
            catch (KeyNotFoundException)
            {
                throw new NonExistingFieldException("There is no such field in the selected layer.");
            }

            return value;
        }
Esempio n. 50
0
 public int GetLayerPointsByColumn(ColumnTypes column, LayerTypes layer)
 {
     return Columns[column].GetLayerPoints(layer);
 }
Esempio n. 51
0
 protected abstract bool Match(ColumnTypes columnType, string dataType);
Esempio n. 52
0
        public bool ExistColumn(string schema, string table, string column, ColumnTypes columnType)
        {
            using (var connection = new SQLiteConnection(this.ConnectionString))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    var cmdText = @"
            pragma table_info(" + table + ")";

                    command.CommandText = cmdText;
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var name = ((string)reader["name"]).Trim().ToLowerInvariant();
                            var type = ((string)reader["type"]).Trim().ToLowerInvariant();

                            if (name.Equals(column.Trim().ToLowerInvariant()))
                            {
                                switch (columnType)
                                {
                                    case ColumnTypes.ObjectId:
                                        return "integer".Equals(type);
                                    case ColumnTypes.TypeId:
                                        return "blob".Equals(type);
                                    case ColumnTypes.CacheId:
                                        return "integer".Equals(type);
                                    case ColumnTypes.Binary:
                                        return "blob".Equals(type);
                                    case ColumnTypes.Boolean:
                                        return "integer".Equals(type);
                                    case ColumnTypes.Decimal:
                                        return "text".Equals(type);
                                    case ColumnTypes.Float:
                                        return "real".Equals(type);
                                    case ColumnTypes.Integer:
                                        return "integer".Equals(type);
                                    case ColumnTypes.String:
                                        return "text".Equals(type);
                                    case ColumnTypes.Unique:
                                        return "text".Equals(type);
                                }

                                return true;
                            }
                        }
                    }

                    return false;
                }
            }
        }
Esempio n. 53
0
        public void InputValue(ColumnTypes column, LayerTypes layer, FieldTypes field, int[] diceNumbers, DiceThrow diceThrow)
        {
            if (column == ColumnTypes.ANNOUNCEMENT && !_announced)
            {
                if (diceThrow == DiceThrow.SECOND)
                {
                    Columns[column].InputValues(layer, field, diceNumbers);
                    _announced = true;
                }
                else
                {
                    throw new InaccessibleFieldException("The field is unavailable.");
                }
            }
            else if (_announced && column != ColumnTypes.ANNOUNCEMENT)
            {
                throw new InaccessibleFieldException("The field is unavailable.");
            }
            else
            {
                Columns[column].InputValues(layer, field, diceNumbers);
                _announced = false;
            }

            NotifyObservers();
        }
Esempio n. 54
0
 private string GetColumnTypeStringSymbol(ColumnTypes type)
 {
     switch (type)
     {
         case ColumnTypes.Integer:
             return "INTEGER";
         case ColumnTypes.String:
             return "TEXT";
         case ColumnTypes.String1:
             return "VARCHAR(1)";
         case ColumnTypes.String2:
             return "VARCHAR(2)";
         case ColumnTypes.String45:
             return "VARCHAR(45)";
         case ColumnTypes.String50:
             return "VARCHAR(50)";
         case ColumnTypes.String100:
             return "VARCHAR(100)";
         case ColumnTypes.String512:
             return "VARCHAR(512)";
         case ColumnTypes.String1024:
             return "VARCHAR(1024)";
         case ColumnTypes.String8196:
             return "VARCHAR(8196)";
         case ColumnTypes.Blob:
             return "blob";
         case ColumnTypes.Text:
             return "TEXT";
         case ColumnTypes.Date:
             return "DATE";
         default:
             throw new DataManagerException("Unknown column type.");
     }
 }
        protected ColumnDefinition ColDef(string name, ColumnTypes columnType)
        {
            ColumnTypeDef type;
            switch (columnType)
            {
                case ColumnTypes.Blob:
                    type = ColumnTypeDef.Blob;
                    break;
                case ColumnTypes.Char32:
                    type = ColumnTypeDef.Char32;
                    break;
                case ColumnTypes.Char33:
                    type = ColumnTypeDef.Char33;
                    break;
                case ColumnTypes.Char34:
                    type = ColumnTypeDef.Char34;
                    break;
                case ColumnTypes.Char35:
                    type = ColumnTypeDef.Char35;
                    break;
                case ColumnTypes.Char36:
                    type = ColumnTypeDef.Char36;
                    break;
                case ColumnTypes.Char37:
                    type = ColumnTypeDef.Char37;
                    break;
                case ColumnTypes.Char38:
                    type = ColumnTypeDef.Char38;
                    break;
                case ColumnTypes.Char39:
                    type = ColumnTypeDef.Char39;
                    break;
                case ColumnTypes.Char40:
                    type = ColumnTypeDef.Char40;
                    break;
                case ColumnTypes.Char5:
                    type = ColumnTypeDef.Char5;
                    break;
                case ColumnTypes.Char1:
                    type = ColumnTypeDef.Char1;
                    break;
                case ColumnTypes.Char2:
                    type = ColumnTypeDef.Char2;
                    break;
                case ColumnTypes.Date:
                    type = ColumnTypeDef.Date;
                    break;
                case ColumnTypes.DateTime:
                    type = ColumnTypeDef.DateTime;
                    break;
                case ColumnTypes.Double:
                    type = ColumnTypeDef.Double;
                    break;
                case ColumnTypes.Float:
                    type = ColumnTypeDef.Float;
                    break;
                case ColumnTypes.Integer11:
                    type = ColumnTypeDef.Integer11;
                    break;
                case ColumnTypes.Integer30:
                    type = ColumnTypeDef.Integer30;
                    break;
                case ColumnTypes.UInteger11:
                    type = ColumnTypeDef.UInteger11;
                    break;
                case ColumnTypes.UInteger30:
                    type = ColumnTypeDef.UInteger30;
                    break;
                case ColumnTypes.LongBlob:
                    type = ColumnTypeDef.LongBlob;
                    break;
                case ColumnTypes.LongText:
                    type = ColumnTypeDef.LongText;
                    break;
                case ColumnTypes.MediumText:
                    type = ColumnTypeDef.MediumText;
                    break;
                case ColumnTypes.String:
                    type = ColumnTypeDef.Text;
                    break;
                case ColumnTypes.String10:
                    type = ColumnTypeDef.String10;
                    break;
                case ColumnTypes.String100:
                    type = ColumnTypeDef.String100;
                    break;
                case ColumnTypes.String1024:
                    type = ColumnTypeDef.String1024;
                    break;
                case ColumnTypes.String128:
                    type = ColumnTypeDef.String128;
                    break;
                case ColumnTypes.String16:
                    type = ColumnTypeDef.String16;
                    break;
                case ColumnTypes.String255:
                    type = ColumnTypeDef.String255;
                    break;
                case ColumnTypes.String30:
                    type = ColumnTypeDef.String30;
                    break;
                case ColumnTypes.String32:
                    type = ColumnTypeDef.String32;
                    break;
                case ColumnTypes.String36:
                    type = ColumnTypeDef.String36;
                    break;
                case ColumnTypes.String45:
                    type = ColumnTypeDef.String45;
                    break;
                case ColumnTypes.String50:
                    type = ColumnTypeDef.String50;
                    break;
                case ColumnTypes.String512:
                    type = ColumnTypeDef.String512;
                    break;
                case ColumnTypes.String64:
                    type = ColumnTypeDef.String64;
                    break;
                case ColumnTypes.String8196:
                    type = ColumnTypeDef.String8196;
                    break;
                case ColumnTypes.Text:
                    type = ColumnTypeDef.Text;
                    break;
                case ColumnTypes.TinyInt1:
                    type = ColumnTypeDef.TinyInt1;
                    break;
                case ColumnTypes.TinyInt4:
                    type = ColumnTypeDef.TinyInt4;
                    break;
                case ColumnTypes.UTinyInt4:
                    type = ColumnTypeDef.UTinyInt4;
                    break;
                case ColumnTypes.Binary32:
                    type = ColumnTypeDef.Binary32;
                    break;
                case ColumnTypes.Binary64:
                    type = ColumnTypeDef.Binary64;
                    break;
                case ColumnTypes.UUID:
                    type = ColumnTypeDef.UUID;
                    break;
                default:
                    type = ColumnTypeDef.Unknown;
                    break;
            }

            return new ColumnDefinition {Name = name, Type = type};
        }
 public override string GetColumnTypeStringSymbol(ColumnTypes type)
 {
     switch (type)
     {
         case ColumnTypes.Double:
             return "DOUBLE";
         case ColumnTypes.Integer11:
             return "INT(11)";
         case ColumnTypes.Integer30:
             return "INT(30)";
         case ColumnTypes.UInteger11:
             return "INT(11) UNSIGNED";
         case ColumnTypes.UInteger30:
             return "INT(30) UNSIGNED";
         case ColumnTypes.Char40:
             return "CHAR(40)";
         case ColumnTypes.Char39:
             return "CHAR(39)";
         case ColumnTypes.Char38:
             return "CHAR(38)";
         case ColumnTypes.Char37:
             return "CHAR(37)";
         case ColumnTypes.Char36:
             return "CHAR(36)";
         case ColumnTypes.Char35:
             return "CHAR(35)";
         case ColumnTypes.Char34:
             return "CHAR(34)";
         case ColumnTypes.Char33:
             return "CHAR(33)";
         case ColumnTypes.Char32:
             return "CHAR(32)";
         case ColumnTypes.Char5:
             return "CHAR(5)";
         case ColumnTypes.Char1:
             return "CHAR(1)";
         case ColumnTypes.Char2:
             return "CHAR(2)";
         case ColumnTypes.String:
             return "TEXT";
         case ColumnTypes.String10:
             return "VARCHAR(10)";
         case ColumnTypes.String16:
             return "VARCHAR(16)";
         case ColumnTypes.String30:
             return "VARCHAR(30)";
         case ColumnTypes.String32:
             return "VARCHAR(32)";
         case ColumnTypes.String36:
             return "VARCHAR(36)";
         case ColumnTypes.String45:
             return "VARCHAR(45)";
         case ColumnTypes.String50:
             return "VARCHAR(50)";
         case ColumnTypes.String64:
             return "VARCHAR(64)";
         case ColumnTypes.String128:
             return "VARCHAR(128)";
         case ColumnTypes.String100:
             return "VARCHAR(100)";
         case ColumnTypes.String255:
             return "VARCHAR(255)";
         case ColumnTypes.String512:
             return "VARCHAR(512)";
         case ColumnTypes.String1024:
             return "VARCHAR(1024)";
         case ColumnTypes.String8196:
             return "VARCHAR(8196)";
         case ColumnTypes.Text:
             return "TEXT";
         case ColumnTypes.MediumText:
             return "MEDIUMTEXT";
         case ColumnTypes.LongText:
             return "LONGTEXT";
         case ColumnTypes.Blob:
             return "BLOB";
         case ColumnTypes.LongBlob:
             return "LONGBLOB";
         case ColumnTypes.Date:
             return "DATE";
         case ColumnTypes.DateTime:
             return "DATETIME";
         case ColumnTypes.Float:
             return "FLOAT";
         case ColumnTypes.TinyInt1:
             return "TINYINT(1)";
         case ColumnTypes.TinyInt4:
             return "TINYINT(4)";
         case ColumnTypes.UTinyInt4:
             return "TINYINT(4) UNSIGNED";
         case ColumnTypes.Binary32:
             return "BINARY(32)";
         case ColumnTypes.Binary64:
             return "BINARY(64)";
         default:
             throw new DataManagerException("Unknown column type.");
     }
 }
Esempio n. 57
0
 public override string GetColumnTypeStringSymbol(ColumnTypes type)
 {
     switch (type)
     {
         case ColumnTypes.Double:
             return "DOUBLE";
         case ColumnTypes.Integer11:
             return "INT(11)";
         case ColumnTypes.Integer30:
             return "INT(30)";
         case ColumnTypes.Char36:
             return "CHAR(36)";
         case ColumnTypes.Char32:
             return "CHAR(32)";
         case ColumnTypes.String:
             return "TEXT";
         case ColumnTypes.String1:
             return "VARCHAR(1)";
         case ColumnTypes.String2:
             return "VARCHAR(2)";
         case ColumnTypes.String16:
             return "VARCHAR(16)";
         case ColumnTypes.String32:
             return "VARCHAR(32)";
         case ColumnTypes.String36:
             return "VARCHAR(36)";
         case ColumnTypes.String45:
             return "VARCHAR(45)";
         case ColumnTypes.String50:
             return "VARCHAR(50)";
         case ColumnTypes.String64:
             return "VARCHAR(64)";
         case ColumnTypes.String128:
             return "VARCHAR(128)";
         case ColumnTypes.String100:
             return "VARCHAR(100)";
         case ColumnTypes.String255:
             return "VARCHAR(255)";
         case ColumnTypes.String512:
             return "VARCHAR(512)";
         case ColumnTypes.String1024:
             return "VARCHAR(1024)";
         case ColumnTypes.String8196:
             return "VARCHAR(8196)";
         case ColumnTypes.Blob:
             return "blob";
         case ColumnTypes.LongBlob:
             return "blob";
         case ColumnTypes.Text:
             return "VARCHAR(512)";
         case ColumnTypes.MediumText:
             return "VARCHAR(512)";
         case ColumnTypes.LongText:
             return "VARCHAR(512)";
         case ColumnTypes.Date:
             return "DATE";
         case ColumnTypes.DateTime:
             return "DATETIME";
         case ColumnTypes.Unknown:
             return "";
         case ColumnTypes.TinyInt1:
             return "TINYINT(1)";
         case ColumnTypes.TinyInt4:
             return "TINYINT(4)";
         default:
             throw new DataManagerException("Unknown column type.");
     }
 }
 private static void AddField(Collection<ICrossRefFieldViewModel> collection, ColumnTypes columnType = ColumnTypes.String)
 {
     var field = Mock.Create<ICrossRefFieldViewModel>();
     Mock.Arrange(() => field.SystemName).Returns(Guid.NewGuid().ToString());
     Mock.Arrange(() => field.Model.ColumnType).Returns(columnType);
     collection.Add(field);
 }
Esempio n. 59
0
        protected override bool Match(ColumnTypes columnType, string dataType)
        {
            dataType = dataType.Trim().ToLowerInvariant();

            switch (columnType)
            {
                case ColumnTypes.ObjectId:
                    return dataType.Equals("int");
                case ColumnTypes.TypeId:
                    return dataType.Equals("uniqueidentifier");
                case ColumnTypes.CacheId:
                    return dataType.Equals("int");
                case ColumnTypes.Binary:
                    return dataType.Equals("varbinary");
                case ColumnTypes.Boolean:
                    return dataType.Equals("bit");
                case ColumnTypes.Decimal:
                    return dataType.Equals("decimal");
                case ColumnTypes.Float:
                    return dataType.Equals("float");
                case ColumnTypes.Integer:
                    return dataType.Equals("int");
                case ColumnTypes.String:
                    return dataType.Equals("nvarchar");
                case ColumnTypes.Unique:
                    return dataType.Equals("uniqueidentifier");
                default:
                    throw new Exception("Unsupported columntype " + columnType);
            }
        }
Esempio n. 60
0
 public static AccountSettingsColumn GetColumnFor(this AccountSettings settings, ColumnTypes type)
 {
     return settings.Columns.FirstOrDefault(c => c.ColumnType.Type == type);
 }