Esempio n. 1
0
 // Build a Field Schema array
 public IDataSourceFieldSchema[] GetFields()
 {
     IDataSourceFieldSchema[] fields = new IDataSourceFieldSchema[2];
     fields[0] = new CustomIDFieldSchema();
     fields[1] = new CustomTitleFieldSchema();
     return(fields);
 }
        /// <summary>
        /// Build a Field Schema array
        /// </summary>
        /// <returns>The collection of fields for the data object type.</returns>
        public IDataSourceFieldSchema[] GetFields()
        {
            PropertyDescriptorCollection fields =
                TypeDescriptor.GetProperties(_owner.Control.DataObjectTypeName);;

            IDataSourceFieldSchema[] schema = new IDataSourceFieldSchema[fields.Count];

            for (int i = 0; i < schema.Length; i++)
            {
                schema[i] = new ObjectFieldSchema(fields[i]);
            }

            return(schema);
        }
                public IDataSourceFieldSchema[] GetFields()
                {
                    PropertyDescriptorCollection fields =
                        ((ITypedList)_owner._component._objectBinder).GetItemProperties(null);

                    IDataSourceFieldSchema[] schema = new IDataSourceFieldSchema[fields.Count];

                    for (int i = 0; i < schema.Length; i++)
                    {
                        schema[i] = new ObjectFieldSchema(fields[i]);
                    }

                    return(schema);
                }
Esempio n. 4
0
 private static DataTable[] ConvertSchemaToDataTables(TypeSchema schema)
 {
     if (schema == null)
     {
         return(null);
     }
     IDataSourceViewSchema[] views = schema.GetViews();
     if (views == null)
     {
         return(null);
     }
     DataTable[] tableArray = new DataTable[views.Length];
     for (int i = 0; i < views.Length; i++)
     {
         IDataSourceViewSchema schema2 = views[i];
         tableArray[i] = new DataTable(schema2.Name);
         IDataSourceFieldSchema[] fields = schema2.GetFields();
         if (fields != null)
         {
             List <DataColumn> list = new List <DataColumn>();
             for (int j = 0; j < fields.Length; j++)
             {
                 IDataSourceFieldSchema schema3 = fields[j];
                 DataColumn             column  = new DataColumn {
                     AllowDBNull   = schema3.Nullable,
                     AutoIncrement = schema3.Identity,
                     ColumnName    = schema3.Name,
                     DataType      = schema3.DataType
                 };
                 if (column.DataType == typeof(string))
                 {
                     column.MaxLength = schema3.Length;
                 }
                 column.ReadOnly = schema3.IsReadOnly;
                 column.Unique   = schema3.IsUnique;
                 tableArray[i].Columns.Add(column);
                 if (schema3.PrimaryKey)
                 {
                     list.Add(column);
                 }
             }
             if (list.Count > 0)
             {
                 tableArray[i].PrimaryKey = list.ToArray();
             }
         }
     }
     return(tableArray);
 }
Esempio n. 5
0
        private void AddKeysAndBoundFields(IDataSourceViewSchema schema)
        {
            JQGridColumnCollection columns = ((JQGrid)base.Component).Columns;

            try
            {
                columns.Clear();
            }
            catch (Exception)
            {
            }
            if (schema != null)
            {
                IDataSourceFieldSchema[] fields = schema.GetFields();
                if (fields != null && fields.Length > 0)
                {
                    new ArrayList();
                    IDataSourceFieldSchema[] array = fields;
                    for (int i = 0; i < array.Length; i++)
                    {
                        IDataSourceFieldSchema dataSourceFieldSchema = array[i];
                        if (((JQGrid)base.Component).IsBindableType(dataSourceFieldSchema.DataType))
                        {
                            JQGridColumn jQGridColumn;
                            if (dataSourceFieldSchema.DataType == typeof(bool) || dataSourceFieldSchema.DataType == typeof(bool?))
                            {
                                jQGridColumn = new JQGridColumn();
                            }
                            else
                            {
                                jQGridColumn = new JQGridColumn();
                            }
                            string name = dataSourceFieldSchema.Name;
                            jQGridColumn.DataField  = name;
                            jQGridColumn.PrimaryKey = dataSourceFieldSchema.PrimaryKey;
                            columns.Add(jQGridColumn);
                        }
                    }
                }
            }
        }
 public TemplateFieldControl(IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
 }
 public override DataControlFieldsEditor.FieldItem[] CreateFields(DataBoundControl control, IDataSourceFieldSchema[] fieldSchemas)
 {
     if (fieldSchemas == null)
     {
         return null;
     }
     ArrayList list = new ArrayList();
     foreach (IDataSourceFieldSchema schema in fieldSchemas)
     {
         if (((control is GridView) && ((GridView) control).IsBindableType(schema.DataType)) || ((control is DetailsView) && ((DetailsView) control).IsBindableType(schema.DataType)))
         {
             BoundField runtimeField = null;
             DataControlFieldsEditor.FieldItem item = null;
             string name = schema.Name;
             if ((schema.DataType == typeof(bool)) || (schema.DataType == typeof(bool?)))
             {
                 runtimeField = new CheckBoxField {
                     HeaderText = name,
                     DataField = name,
                     SortExpression = name
                 };
                 item = new DataControlFieldsEditor.CheckBoxFieldItem(this._fieldsEditor, (CheckBoxField) runtimeField);
             }
             else
             {
                 runtimeField = new BoundField {
                     HeaderText = name,
                     DataField = name,
                     SortExpression = name
                 };
                 item = new DataControlFieldsEditor.BoundFieldItem(this._fieldsEditor, runtimeField);
             }
             if (schema.PrimaryKey)
             {
                 runtimeField.ReadOnly = true;
             }
             if (schema.Identity)
             {
                 runtimeField.InsertVisible = false;
             }
             item.LoadFieldInfo();
             list.Add(item);
         }
     }
     return (DataControlFieldsEditor.FieldItem[]) list.ToArray(typeof(DataControlFieldsEditor.FieldItem));
 }
 public DataControlFieldDesignerNode(DataControlFieldDesigner fieldDesigner, IDataSourceFieldSchema fieldSchema) : base((fieldSchema == null) ? fieldDesigner.DefaultNodeText : fieldSchema.Name, 15)
 {
     this._fieldSchema = fieldSchema;
     this._fieldDesigner = fieldDesigner;
 }
 public CheckBoxNode(DataControlFieldsEditor fieldsEditor, IDataSourceFieldSchema fieldSchema) : base((fieldSchema == null) ? string.Empty : fieldSchema.Name, 10)
 {
     this._fieldsEditor = fieldsEditor;
     this._fieldSchema = fieldSchema;
     if (fieldSchema == null)
     {
         this._genericCheckBoxField = true;
         base.Text = System.Design.SR.GetString("DCFEditor_Node_CheckBox");
     }
 }
 public virtual DataControlFieldsEditor.FieldItem[] CreateFields(DataBoundControl control, IDataSourceFieldSchema[] fieldSchemas)
 {
     return null;
 }
 public DataControlFieldDesignerControl(DataBoundControlDesigner controlDesigner, IServiceProvider serviceProvider, DataControlFieldDesigner designer, IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
     this._controlDesigner = controlDesigner;
     this._serviceProvider = serviceProvider;
     this._designer = designer;
     this.Initialize();
 }
 public void RefreshSchema(IDataSourceFieldSchema[] fieldSchemas)
 {
     this._fieldSchemas = fieldSchemas;
     this._fieldSchemaNames = null;
     if ((fieldSchemas != null) && (fieldSchemas.Length > 0))
     {
         this._haveSchema = true;
     }
     this.RefreshSchemaFields();
 }
 public DataControlFieldControl(IDataSourceFieldSchema[] fieldSchemas, System.Type controlType)
 {
     this._fieldSchemas = fieldSchemas;
     if ((fieldSchemas != null) && (fieldSchemas.Length > 0))
     {
         this._haveSchema = true;
     }
     this._controlType = controlType;
     this.InitializeComponent();
 }
				public IDataSourceFieldSchema[] GetFields()
				{
					PropertyDescriptorCollection fields =
						((ITypedList)_owner._component._objectBinder).GetItemProperties(null);

					IDataSourceFieldSchema[] schema = new IDataSourceFieldSchema[fields.Count];

					for (int i = 0; i < schema.Length; i++)
						schema[i] = new ObjectFieldSchema(fields[i]);

					return schema;
				}
 public abstract DataControlField CreateField(IDataSourceFieldSchema fieldSchema);
 public HyperLinkFieldControl(IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
 }
 private IDataSourceFieldSchema[] GetBooleanFieldSchemas()
 {
     IDataSourceFieldSchema[] fieldSchemas = this.GetFieldSchemas();
     ArrayList list = new ArrayList();
     IDataSourceFieldSchema[] array = null;
     if (fieldSchemas != null)
     {
         foreach (IDataSourceFieldSchema schema in fieldSchemas)
         {
             if (schema.DataType == typeof(bool))
             {
                 list.Add(schema);
             }
         }
         array = new IDataSourceFieldSchema[list.Count];
         list.CopyTo(array);
     }
     return array;
 }
 public DynamicDataFieldControl(DataControlFieldDesigner dynamicFieldDesigner, IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
     this._designer = dynamicFieldDesigner;
 }
Esempio n. 19
0
        public IDataSourceFieldSchema[] GetFields()
        {
            if (_owner == null)
                return null;

            DataTable dt = ((WebDataSourceDesigner)_owner).SchemaTable;
            if (dt == null)
                return null;

            int i = dt.Columns.Count;
            IDataSourceFieldSchema[] fields = new IDataSourceFieldSchema[i];

            int j = 0;
            foreach (DataColumn col in dt.Columns)
            {
                string colName = col.ColumnName;
                Type dataType = col.DataType;

                fields[j] = new ColumnFieldSchema(colName, dataType);
                j++;
            }

            return fields;
        }
 public abstract DataControlField CreateField(IDataSourceFieldSchema fieldSchema);
 public CommandFieldControl(IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
 }