Example #1
0
        public int Compare(object x, object y)
        {
            DataSourceRow r1 = (DataSourceRow)x;
            DataSourceRow r2 = (DataSourceRow)y;

            return(baseComparer.Compare(r1.BoundItem, r2.BoundItem));
        }
Example #2
0
        private void InitGrid()
        {
            Columns = new ArrayList();
            Rows    = new ArrayList();

            OutlookGrid grid = (OutlookGrid)dataSource;

            // use reflection to discover all properties of the object
            foreach (DataGridViewColumn c in grid.Columns)
            {
                Columns.Add(c.Name);
            }

            foreach (OutlookGridRow r in grid.Rows)
            {
                if (!r.IsGroupRow && !r.IsNewRow)
                {
                    DataSourceRow row = new DataSourceRow(this, r);
                    for (int i = 0; i < Columns.Count; i++)
                    {
                        row.Add(r.Cells[i].Value);
                    }
                    Rows.Add(row);
                }
            }
        }
Example #3
0
        private void InitList()
        {
            Columns = new ArrayList();
            Rows    = new ArrayList();
            IList list = (IList)dataSource;

            // use reflection to discover all properties of the object
            BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;

            PropertyInfo[] props = list[0].GetType().GetProperties();
            foreach (PropertyInfo pi in props)
            {
                Columns.Add(pi.Name);
            }

            foreach (object obj in list)
            {
                DataSourceRow row = new DataSourceRow(this, obj);
                foreach (PropertyInfo pi in props)
                {
                    object result = obj.GetType().InvokeMember(pi.Name, bf, null, obj, null);
                    row.Add(result);
                }
                Rows.Add(row);
            }
        }
Example #4
0
        private void InitDataSet()
        {
            Columns = new ArrayList();
            Rows    = new ArrayList();
            DataTable table = ((DataSet)dataSource).Tables[this.dataMember];

            // use reflection to discover all properties of the object
            foreach (DataColumn c in table.Columns)
            {
                Columns.Add(c.ColumnName);
            }
            foreach (DataRow r in table.Rows)
            {
                DataSourceRow row = new DataSourceRow(this, r);
                for (int i = 0; i < Columns.Count; i++)
                {
                    row.Add(r[i]);
                }
                Rows.Add(row);
            }
        }
Example #5
0
        private void InitList()
        {
            Columns = new ArrayList();
            Rows    = new ArrayList();
            IList list = (IList)dataSource;

            // use reflection to discover all properties of the object
            BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;

            PropertyInfo[] props = list[0].GetType().GetProperties();
            foreach (PropertyInfo pi in props)
            {
                Columns.Add(pi.Name);
            }

            //Add methods flagged as treat as property - added by Peter Varney
            foreach (MethodInfo me in OutlookGridAttribute.GetMethods(dataSource.GetType()))
            {
                Columns.Add(me.Name);
            }

            foreach (object obj in list)
            {
                DataSourceRow row = new DataSourceRow(this, obj);
                foreach (PropertyInfo pi in props)
                {
                    object result = obj.GetType().InvokeMember(pi.Name, bf, null, obj, null);
                    row.Add(result);
                }
                foreach (MethodInfo me in OutlookGridAttribute.GetMethods(dataSource.GetType()))
                {
                    object result = me.Invoke(obj, new object[] { obj });
                    row.Add(result);
                }
                Rows.Add(row);
            }
        }
Example #6
0
        private void InitList()
        {
            Columns = new ArrayList();
            Rows = new ArrayList();
            IList list = (IList)dataSource;

            // use reflection to discover all properties of the object
            BindingFlags bf = BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty;
            PropertyInfo[] props = list[0].GetType().GetProperties();
            foreach (PropertyInfo pi in props)
                    Columns.Add(pi.Name);

            foreach (object obj in list)
            {
                DataSourceRow row = new DataSourceRow(this, obj);
                foreach (PropertyInfo pi in props)
                {
                    object result = obj.GetType().InvokeMember(pi.Name, bf, null, obj, null);
                    row.Add(result);  
                }
                Rows.Add(row);
            }
        }
Example #7
0
        private void InitGrid()
        {
            Columns = new ArrayList();
            Rows = new ArrayList();

            OutlookGrid grid = (OutlookGrid)dataSource;
            // use reflection to discover all properties of the object
            foreach (DataGridViewColumn c in grid.Columns)
                Columns.Add(c.Name);

            foreach (OutlookGridRow r in grid.Rows)
            {
                if (!r.IsGroupRow && !r.IsNewRow)
                {
                    DataSourceRow row = new DataSourceRow(this, r);
                    for (int i = 0; i < Columns.Count; i++)
                        row.Add(r.Cells[i].Value);
                    Rows.Add(row);
                }
            }
        }
Example #8
0
        private void InitDataSet()
        {
            Columns = new ArrayList();
            Rows = new ArrayList();

            DataTable table = ((DataSet)dataSource).Tables[this.dataMember];
            // use reflection to discover all properties of the object
            foreach (DataColumn c in table.Columns)
                Columns.Add(c.ColumnName);

            foreach (DataRow r in table.Rows)
            {
                DataSourceRow row = new DataSourceRow(this, r);
                for (int i = 0; i < Columns.Count; i++)
                    row.Add(r[i]);
                Rows.Add(row);
            }
        }