Exemplo n.º 1
0
        public static EasyBaseColumn COLLECT(EasyBaseColumn column, object result, int index, object value, bool condition)
        {
            if (result == null && value != null)
            {
                if (value.GetType() == typeof(int))
                {
                    result = new EasyIntColumn();
                }
                else if (value.GetType() == typeof(string))
                {
                    result = new EasyStringColumn();
                }
                else if (value.GetType() == typeof(bool))
                {
                    result = new EasyBoolColumn();
                }
                else
                {
                    throw new NotSupportedException();
                }
            }
            if (result == null)
            {
                return(null);
            }

            EasyBaseColumn b = (EasyBaseColumn)result;

            //if (condition) deðiþtirme!!!
            b.Insert(value);

            return(b);
        }
Exemplo n.º 2
0
        public EasyTable CreateTableStructure(string tablename, List <CreateField> columns, uint useTableId, uint[] useColumnId)
        {
            if (useTableId == 0)
            {
                tableId++;
                useTableId = tableId;
            }

            EasyTable table = new EasyTable()
            {
                Id = useTableId, Server = this
            };

            table.Name = tablename;
            int i = 0;

            foreach (CreateField column in columns)
            {
                uint id = 0;
                if (useColumnId == null)
                {
                    columnId++;
                    id = columnId;
                }
                else
                {
                    id = useColumnId[i];
                }
                i++;

                EasyBaseColumn col = null;
                if (column.FieldType == typeof(string))
                {
                    col = new EasyStringColumn()
                    {
                        Id = id
                    }
                }
                ;

                else if (column.FieldType == typeof(int))
                {
                    col = new EasyIntColumn()
                    {
                        Id = id
                    }
                }
                ;

                else if (column.FieldType == typeof(uint))
                {
                    col = new EasyUIntColumn()
                    {
                        Id = id
                    }
                }
                ;

                else if (column.FieldType == typeof(bool))
                {
                    col = new EasyBoolColumn()
                    {
                        Id = id
                    }
                }
                ;

                else if (column.FieldType == typeof(decimal))
                {
                    col = new EasyDecimalColumn()
                    {
                        Id = id
                    }
                }
                ;
                else
                {
                    throw new Exception("Unknown column type! " + column.FieldType);
                }

                col.Name       = column.Name;
                col.IsIdentity = column.IsIdentity;
                table.AddColumn(col);
            }

            Tables.Add(table);

            return(table);
        }