internal BindColumnList(BindManager <T> manager)
        {
            columnTypes = new Type [0];
            columnCount = 0;

            this.manager = manager;
        }
        internal BindColumnList(BindManager <T> manager, Type type)
        {
            int i, j;

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            MemberInfo [] objMembers = type.GetMembers();
            List <Type>   list       = new List <Type> ();

            columnNames   = new Dictionary <string, int> ();
            captions      = new List <string> ();
            resolvedNames = new List <string> ();

            for (i = 0, j = 0; i < objMembers.Length; i++)
            {
                MemberInfo memberInfo = objMembers [i];
                string     columnName = manager.ColumnNameResolver != null?
                                        manager.ColumnNameResolver(memberInfo) :
                                            memberInfo.Name;

                PropertyInfo property = memberInfo as PropertyInfo;
                if (property != null)
                {
                    if (!property.CanRead && !property.CanWrite)
                    {
                        continue;
                    }

                    columnNames.Add(property.Name, j++);
                    list.Add(property.PropertyType);
                    captions.Add(property.Name);
                    resolvedNames.Add(columnName);
                    continue;
                }

                FieldInfo field = memberInfo as FieldInfo;
                if (field != null)
                {
                    columnNames.Add(field.Name, j++);
                    list.Add(field.FieldType);
                    captions.Add(field.Name);
                    resolvedNames.Add(columnName);
                }
            }

            columnTypes = list.ToArray();
            columnCount = columnNames.Count;

            this.manager = manager;
        }
        internal BindColumnList(BindManager <T> manager, IList rowList)
        {
            if (rowList == null)
            {
                return;
            }

            columnCount = rowList.Count;
            columnTypes = new Type [rowList.Count];

            for (int i = 0; i < rowList.Count; i++)
            {
                columnTypes [i] = rowList [i].GetType();
            }

            this.manager = manager;
        }
        internal BindColumnList(BindManager <T> manager, ITypedList list)
        {
            typedListProps = list.GetItemProperties(null);
            if (typedListProps != null && typedListProps.Count != 0)
            {
                columnNames = new Dictionary <string, int> ();
                columnTypes = new Type [typedListProps.Count];
                captions    = new List <string> (typedListProps.Count);

                for (int i = 0; i < typedListProps.Count; i++)
                {
                    columnNames.Add(typedListProps [i].Name, i);
                    columnTypes [i] = typedListProps [i].PropertyType;
                    captions.Add(typedListProps [i].Name);
                }

                columnCount = columnNames.Count;

                DataTable dataTable = null;
                if (list is DataView)
                {
                    dataTable = ((DataView)list).Table;
                }
                if (list is DataTable)
                {
                    dataTable = (DataTable)list;
                }
                if (dataTable != null)
                {
                    for (int i = 0; i < dataTable.Columns.Count; i++)
                    {
                        captions [i] = dataTable.Columns [i].Caption;
                    }
                }
            }
            this.manager = manager;
        }
 internal BindRowList(BindManager <T> manager)
 {
     this.manager = manager;
 }
Example #6
0
 internal BindRow(BindManager <T> manager, T rowObject)
 {
     this.manager   = manager;
     this.rowObject = rowObject;
 }