Beispiel #1
0
 public TEFDataTableState(VirtualDataTable aTableData, IQueryable <T> aData, PropertyInfo[] aFields,
                          TFieldExpressions <T> aFieldExpressions, Dictionary <string, int> aFieldsByName,
                          string[] aFilters,
                          string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
     : base(aTableData, aData, aFields, aFieldExpressions, aFieldsByName, aFilters, sort, masterDetailLinks, splitLink)
 {
 }
 public override void MoveMasterRecord(TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     if (masterDetailLinks.Length > 0 || splitLink != null) //This dataset has a master, so rows need to be filtered.
     {
         FillChildDataSet(masterDetailLinks, splitLink);
     }
 }
Beispiel #3
0
 /// <summary>
 /// This method will be called each time that the master datasource moves its position. Use it to filter the data returned
 /// if this is used on a master-detail relationship.
 /// </summary>
 /// <remarks>
 /// You do not need to implement this method if you are not using Master-Detail or Split relationships.</remarks>
 /// <param name="masterDetailLinks">List of all the master tables that are related to this one.
 /// If there are no parents on this VirtualDataTableState, this will be an empty array, not null.
 /// Use it on <see cref="GetValue"/> to filter the data and then return only the records that satisfy the master-detail relationships on <see cref="GetValue"/>
 /// </param>
 /// <param name="splitLink">Parent Split table if this dataset is on a Split relationship, or null if there is none.
 /// Use it to know how many records you should retun on <see cref="RowCount"/>. Note that a table might be on Master-Detail relationship
 /// *and* split relationship. In this case you need to first filter the records that are on the master detail relationship, and then apply the split to them.
 /// </param>
 public virtual void MoveMasterRecord(TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     if (masterDetailLinks == null)
     {
         return;
     }
     for (int i = 0; i < masterDetailLinks.Length; i++)
     {
         if (masterDetailLinks[i].ParentDataSource.RowCount != 0)                  //Avoid throwing an exception if there is actually only one master record.
         {
             FlxMessages.ThrowException(FlxErr.ErrTableDoesNotSupportMasterDetail, FTableData.TableName);
         }
     }
 }
        private void FillChildDataSet(TMasterDetailLink[] MasterDetailLinks, TSplitLink SplitLink)
        {
            Debug.Assert(MasterDetailLinks.Length > 0 || SplitLink != null, "This method can only be called on master detail.");
            Debug.Assert(FilteredDataNeedsDispose == true, "We need to own FilteredData to modify it.");
            FilteredData.Clear();

            DataRowView[] drv = null;
            if (MasterDetailLinks.Length > 0)
            {
                object[] KeyValues = GetKeyValues(MasterDetailLinks);
                drv = SourceForFilteredData.FindRows(KeyValues);
            }

            if (SplitLink != null)
            {
                int ParentPos = SplitLink.ParentDataSource.Position * SplitLink.SplitCount;
                for (int row = ParentPos; row < ParentPos + SplitLink.SplitCount; row++)
                {
                    if (drv != null)
                    {
                        if (row >= drv.Length)
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (row >= SourceForFilteredData.Count)
                        {
                            break;
                        }
                    }
                    ImportRows(FilteredData, drv, SourceForFilteredData, row);
                }
            }

            else // If splitlink = null, MasterdetailLinks.Length > 0, so drv != null.
            {
                foreach (DataRowView r in drv)
                {
                    FilteredData.ImportRow(r.Row);
                }
            }
        }
Beispiel #5
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;
        }
 public override VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     return(new TAdoDotNetDataTableState(this, Data, sort, masterDetailLinks, splitLink));
 }
        public TAdoDotNetDataTableState(VirtualDataTable aTableData, DataTable Data, string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink) : base(aTableData)
        {
            if (masterDetailLinks.Length > 0 || splitLink != null)
            {
                SourceForFilteredData    = new DataView(Data, String.Empty, GetSortColumns(masterDetailLinks), DataViewRowState.CurrentRows);
                FilteredData             = Data.Clone(); //we will have to fill this table each time.
                FilteredDataNeedsDispose = true;
            }
            else
            {
                FilteredData = Data;  //The table is the same as the original.
            }

            SortedFilteredData      = new DataView(FilteredData);
            SortedFilteredData.Sort = sort;
        }
Beispiel #8
0
 public override VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     return(new TColumnsDataTableState(this, Columns));
 }
Beispiel #9
0
 public override VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     return(new TNRowsDataTableState(this, RecordCount));
 }
Beispiel #10
0
 public override void MoveMasterRecord(TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     ActualDataState.MoveMasterRecord(masterDetailLinks, splitLink);
 }
Beispiel #11
0
 public override VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     return(new TTopDataTableState(this, TopCount, ActualData.CreateState(sort, masterDetailLinks, splitLink)));
 }
Beispiel #12
0
 public override void MoveMasterRecord(TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     LastPosition = -1;
 }
Beispiel #13
0
 public override VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink)
 {
     return(new TEFDataTableState <T>(this, Data, Fields, FieldExpressions, FieldsByName, Filters, sort, masterDetailLinks, splitLink));
 }
Beispiel #14
0
 /// <summary>
 /// Creates a VirtualDataSetState to be used in a report. Make sure you override this method on your derived classes
 /// and point it to the correct VirtualDataSet descendant.
 /// </summary>
 /// <param name="sort">A string showing how to sort this dataset. This string might be null, empty, or whatever the user wrote on the config sheet.</param>
 /// <param name="masterDetailLinks">A list of the the master datatables and relation fields on the bands outside this one.
 /// You can pass this parameter to the VirtualDataSetState so it can create indexes on the required fields.
 /// This parameter will be an empty array if no master detail relationships apply to the VirtualDataSetState, but it will not be null.
 /// </param>
 /// <param name="splitLink">A link to a parent Split datasource with the number of records to split, or null if there is no parent split datasource.</param>
 /// <returns></returns>
 public abstract VirtualDataTableState CreateState(string sort, TMasterDetailLink[] masterDetailLinks, TSplitLink splitLink);