Ejemplo n.º 1
0
        /// <summary>
        /// Test the value list for True or False.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="datatype"></param>
        /// <returns></returns>
        private bool TestValueList(object o, ColumnType datatype)
        {
            if (_type == ExpressionType.ValueList)
            {
                if (datatype != _columnType)
                {
                    o = Column.ConvertToObject(o, _columnType);
                }

                return(_list.ContainsKey(o));
            }
            else if (_type == ExpressionType.Query)
            {
                // todo: convert to valuelist before if everything is resolvable
                Result     r    = sSelect.GetResult(0, null);
                Record     n    = r.Root;
                ColumnType type = r.Type[0];

                if (datatype != type)
                {
                    o = Column.ConvertToObject(o, type);
                }

                while (n != null)
                {
                    object o2 = n.Data[0];

                    if (o2 != null && o2.Equals(o))
                    {
                        return(true);
                    }

                    n = n.Next;
                }

                return(false);
            }

            throw Trace.Error(Trace.WRONG_DATA_TYPE);
        }