Inheritance: DataView, IFilter
Exemplo n.º 1
0
        public override bool Equals(DataView dv)
        {
            RelatedView other = dv as RelatedView;

            if (other == null)
            {
                return(false);
            }
            if (!base.Equals(dv))
            {
                return(false);
            }
            if (_filterValues != null)
            {
                return(CompareArray(_childKey.ColumnsReference, other._childKey.ColumnsReference) && CompareArray(_filterValues, other._filterValues));
            }
            else
            {
                if (other._filterValues != null)
                {
                    return(false);
                }

                return(CompareArray(_childKey.ColumnsReference, other._childKey.ColumnsReference) &&
                       CompareArray(_parentKey.Value.ColumnsReference, _parentKey.Value.ColumnsReference) &&
                       _parentRowView.Equals(other._parentRowView));
            }
        }
 public System.Data.DataView CreateChildView(DataRelation relation)
 {
     if ((relation == null) || (relation.ParentKey.Table != this.DataView.Table))
     {
         throw ExceptionBuilder.CreateChildView();
     }
     int record = this.GetRecord();
     object[] keyValues = relation.ParentKey.GetKeyValues(record);
     RelatedView view = new RelatedView(relation.ChildColumnsReference, keyValues);
     view.SetIndex("", DataViewRowState.CurrentRows, null);
     view.SetDataViewManager(this.DataView.DataViewManager);
     return view;
 }
        public System.Data.DataView CreateChildView(DataRelation relation)
        {
            if ((relation == null) || (relation.ParentKey.Table != this.DataView.Table))
            {
                throw ExceptionBuilder.CreateChildView();
            }
            int record = this.GetRecord();

            object[]    keyValues = relation.ParentKey.GetKeyValues(record);
            RelatedView view      = new RelatedView(relation.ChildColumnsReference, keyValues);

            view.SetIndex("", DataViewRowState.CurrentRows, null);
            view.SetDataViewManager(this.DataView.DataViewManager);
            return(view);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a <see cref="System.Data.DataView"/>
        /// for the child <see cref="System.Data.DataTable"/>
        /// with the specified <see cref="System.Data.DataRelation"/>.
        /// </summary>
        /// <param name="relation">Specified <see cref="System.Data.DataRelation"/>.</param>
        /// <exception cref="ArgumentException">null or mismatch between <paramref name="relation"/> and <see cref="System.Data.DataView.get_Table"/>.</exception>
        public DataView CreateChildView(DataRelation relation, bool followParent)
        {
            if (relation == null || relation.ParentKey.Table != DataView.Table)
            {
                throw ExceptionBuilder.CreateChildView();
            }
            RelatedView childView;

            if (!followParent)
            {
                int      record = GetRecord();
                object[] values = relation.ParentKey.GetKeyValues(record);
                childView = new RelatedView(relation.ChildColumnsReference, values);
            }
            else
            {
                childView = new RelatedView(this, relation.ParentKey, relation.ChildColumnsReference);
            }
            childView.SetIndex("", DataViewRowState.CurrentRows, null); // finish construction via RelatedView.SetIndex
            childView.SetDataViewManager(DataView.DataViewManager);
            return(childView);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns a <see cref="System.Data.DataView"/>
 /// for the child <see cref="System.Data.DataTable"/>
 /// with the specified <see cref="System.Data.DataRelation"/>.
 /// </summary>
 /// <param name="relation">Specified <see cref="System.Data.DataRelation"/>.</param>
 /// <exception cref="ArgumentException">null or mismatch between <paramref name="relation"/> and <see cref="System.Data.DataView.get_Table"/>.</exception>
 public DataView CreateChildView(DataRelation relation, bool followParent) {
     if (relation == null || relation.ParentKey.Table != DataView.Table) {
         throw ExceptionBuilder.CreateChildView();
     }
     RelatedView childView;
     if (!followParent) {
         int record = GetRecord();
         object[] values = relation.ParentKey.GetKeyValues(record);
         childView = new RelatedView(relation.ChildColumnsReference, values);
     }
     else {
         childView = new RelatedView(this, relation.ParentKey, relation.ChildColumnsReference);
     }
     childView.SetIndex("", DataViewRowState.CurrentRows, null); // finish construction via RelatedView.SetIndex
     childView.SetDataViewManager(DataView.DataViewManager);
     return childView;
 }