示例#1
0
        public override object GetValue(object component)
        {
            Fact fact = (Fact)component;

            return(fact.Columns[Index].ToString());
        }
示例#2
0
        public override void SetValue(object component, object value)
        {
            Fact fact   = (Fact)component;
            var  column = fact.Columns[Index];

            switch (BaseType)
            {
            case Value.Type.Integer:
            {
                if (value is String)
                {
                    column.IntValue = Int32.Parse((String)value);
                }
                else if (value is Int32)
                {
                    column.IntValue = (Int32)value;
                }
                else
                {
                    throw new ArgumentException("Invalid Int32 value");
                }
                break;
            }

            case Value.Type.Integer64:
            {
                if (value is String)
                {
                    column.Int64Value = Int64.Parse((String)value);
                }
                else if (value is Int64)
                {
                    column.Int64Value = (Int64)value;
                }
                else
                {
                    throw new ArgumentException("Invalid Int64 value");
                }
                break;
            }

            case Value.Type.Float:
            {
                if (value is String)
                {
                    column.FloatValue = Single.Parse((String)value);
                }
                else if (value is Single)
                {
                    column.FloatValue = (Single)value;
                }
                else
                {
                    throw new ArgumentException("Invalid float value");
                }
                break;
            }

            case Value.Type.String:
            case Value.Type.GuidString:
            {
                column.StringValue = (String)value;
                break;
            }

            case Value.Type.None:
            default:
                throw new InvalidOperationException("Cannot retrieve type of an unknown column");
            }
        }