Пример #1
0
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            List <ObjectClass> list = new List <ObjectClass>();
            AbstractField      f    = (AbstractField)context.Instance;

            list.AddRange(f.Proxy.Database.Classes.Collection);

            TypeConverter.StandardValuesCollection svc = new TypeConverter.StandardValuesCollection(list);
            return(svc);
        }
Пример #2
0
        private void CreateFieldType()
        {
            switch (this.fieldProperty.FieldType)
            {
            case FieldType.Text:
                this.fieldType = new FieldText(this);
                break;

            case FieldType.Number:
                this.fieldType = new FieldDecimal(this);
                break;

            case FieldType.Date:
                this.fieldType = new FieldDate(this);
                break;

            case FieldType.Image:
                this.fieldType = new FieldImage(this);
                break;

            case FieldType.Url:
                this.fieldType = new FieldUrl(this);
                break;

            case FieldType.Select:
                this.fieldType = new FieldSelect(this);
                break;

            case FieldType.Boolean:
                this.fieldType = new FieldBool(this);
                break;

            case FieldType.Table:
                this.fieldType = new FieldTable(this);
                break;

            case FieldType.Rating:
                this.fieldType = new FieldRaiting(this);
                break;

            case FieldType.Reference:
                this.fieldType = new FieldReference(this);
                break;

            case FieldType.List:
                this.fieldType = new FieldList(this);
                break;

            case FieldType.Memo:
                this.fieldType = new FieldMemo(this);
                break;
            }

            this.fieldType.FieldModified += new EventHandler <EventArgs>(this.FieldDataProxy_FieldModified);
        }
Пример #3
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value is string)
            {
                AbstractField f = (AbstractField)context.Instance;

                foreach (ObjectClass c in f.Proxy.Database.Classes.Collection)
                {
                    string s = value as string;
                    if (s != null && c.Name == s)
                    {
                        return(c);
                    }
                }

                return(null);
            }

            return(base.ConvertFrom(context, culture, value));
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value is string)
            {
                AbstractField field = null;
                switch (EnumDescription.GetFieldType((string)value))
                {
                case FieldType.Text:
                    field = new FieldText((FieldProxy)context.Instance);
                    break;

                case FieldType.Number:
                    field = new FieldDecimal((FieldProxy)context.Instance);
                    break;

                case FieldType.Date:
                    field = new FieldDate((FieldProxy)context.Instance);
                    break;

                case FieldType.Image:
                    field = new FieldImage((FieldProxy)context.Instance);
                    break;

                case FieldType.Url:
                    field = new FieldUrl((FieldProxy)context.Instance);
                    break;

                case FieldType.Select:
                    field = new FieldSelect((FieldProxy)context.Instance);
                    break;

                case FieldType.Boolean:
                    field = new FieldBool((FieldProxy)context.Instance);
                    break;

                case FieldType.Table:
                    field = new FieldTable((FieldProxy)context.Instance);
                    break;

                case FieldType.Rating:
                    field = new FieldRaiting((FieldProxy)context.Instance);
                    break;

                case FieldType.Reference:
                    field = new FieldReference((FieldProxy)context.Instance);
                    break;

                case FieldType.List:
                    field = new FieldList((FieldProxy)context.Instance);
                    break;

                case FieldType.Memo:
                    field = new FieldMemo((FieldProxy)context.Instance);
                    break;
                }

                return(field);
            }

            return(base.ConvertFrom(context, culture, value));
        }