Example #1
0
 public void Dispose()
 {
     if (DataState != null)
     {
         DataState.Dispose();
     }
     DataState = null;
     GC.SuppressFinalize(this);
 }
Example #2
0
        public TFlexCelDataSource(string dtName, VirtualDataTable aData, TRelationshipList ExtraRelations, TRelationshipList StaticRelations,
                                  TBand MasterBand, string Sort, IDataTableFinder TableFinder)
        {
            SplitLink = null;

            TBand band = MasterBand;
            TMasterDetailLinkList MasterDetailLinkList = new TMasterDetailLinkList();

            while (band != null)
            {
                if (band.DataSource != null)
                {
                    TRelation RelToMaster = band.DataSource.Data.GetRelationWith(aData);
                    if (RelToMaster != null)
                    {
                        MasterDetailLinkList.AddRelation(band.DataSource.DataState, RelToMaster);
                    }

                    //Create the splitlink.
                    TMasterSplitDataTableState SplitMaster = band.DataSource.DataState as TMasterSplitDataTableState;
                    if (SplitMaster != null && String.Equals(SplitMaster.DetailName, dtName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (SplitLink != null)
                        {
                            FlxMessages.ThrowException(FlxErr.ErrSplitNeedsOnlyOneMaster, dtName, SplitMaster.TableName, SplitLink.ParentDataSource.TableName);
                        }
                        SplitLink = new TSplitLink(SplitMaster, SplitMaster.SplitCount);
                    }

                    AddExtraRelationships(TableFinder, aData, ExtraRelations, band, MasterDetailLinkList);
                    AddExtraRelationships(TableFinder, aData, StaticRelations, band, MasterDetailLinkList);
                }
                band = band.MasterBand;
            }

            MasterDetailLinks = MasterDetailLinkList.ToArray();

            Data                 = aData;
            DataState            = aData.CreateState(Sort, MasterDetailLinks, SplitLink);
            DataState.FTableName = dtName;
            FName                = dtName;
        }
Example #3
0
        public void AddRelation(VirtualDataTableState aParentDataSource, TRelation Relation)
        {
            int[] Pc = Relation.ParentColumns;
            int[] Cc = Relation.ChildColumns;

            if (Pc == null && Cc == null) //Intrinsic relationship
            {
                Add(new TMasterDetailLink(aParentDataSource, 0, null));
                return;
            }

            if (Pc.Length != Cc.Length)
            {
                return;                       //Invalid relation.
            }
            for (int i = 0; i < Pc.Length; i++)
            {
                string ChildName = Relation.ChildTable.GetColumnName(Cc[i]);
                if (!Find(ChildName))
                {
                    Add(new TMasterDetailLink(aParentDataSource, Pc[i], ChildName));
                }
            }
        }
Example #4
0
 public TTopDataTableState(VirtualDataTable aTableData, int aTopCount, VirtualDataTableState aActualDataState) : base(aTableData)
 {
     ActualDataState = aActualDataState;
     TopCount        = aTopCount;
 }
Example #5
0
 /// <summary>
 /// Create a new TSplitLink with the given values.
 /// </summary>
 /// <param name="aParentDataSource">See <see cref="ParentDataSource"/></param>
 /// <param name="aSplitCount">See <see cref="SplitCount"/></param>
 public TSplitLink(VirtualDataTableState aParentDataSource, int aSplitCount)
 {
     FParentDataSource = aParentDataSource;
     FSplitCount       = aSplitCount;
 }
Example #6
0
 /// <summary>
 /// Creates a new instance of TMasterDetailLink with the given values.
 /// </summary>
 /// <param name="aParentDataSource">See <see cref="ParentDataSource"/></param>
 /// <param name="aParentField">See <see cref="ParentField"/></param>
 /// <param name="aChildFieldName">See <see cref="ChildFieldName"/></param>
 public TMasterDetailLink(VirtualDataTableState aParentDataSource, int aParentField, string aChildFieldName)
 {
     FParentDataSource = aParentDataSource;
     FParentField      = aParentField;
     FChildFieldName   = aChildFieldName;
 }