public void ValidateDataSetBindingAndRelationships(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext)
 {
     if (this.m_dataSet == null)
     {
         ParentDataSetContainer parentDataSetContainer = DataScopeInfo.DetermineParentDataSets(scopeTree, scope);
         if (this.m_dataSetName == null)
         {
             this.BindToParentDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
         }
         else
         {
             this.BindToNamedDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
         }
         if (this.m_dataSet != null)
         {
             if (scopeTree.GetParentDataRegion(scope) == null && this.m_joinInfo != null)
             {
                 errorContext.Register(ProcessingErrorCode.rsInvalidRelationshipTopLevelDataRegion, Severity.Error, scope.DataScopeObjectType, scope.Name, "Relationship");
                 this.m_joinInfo = null;
             }
             if (parentDataSetContainer != null && this.m_joinInfo == null)
             {
                 if (parentDataSetContainer.Count == 1)
                 {
                     this.m_joinInfo = new LinearJoinInfo();
                 }
                 else
                 {
                     this.m_joinInfo = new IntersectJoinInfo();
                 }
             }
             if (this.m_joinInfo != null)
             {
                 if (!this.m_joinInfo.ValidateRelationships(scopeTree, errorContext, this.m_dataSet, parentDataSetContainer, scope))
                 {
                     this.m_joinInfo = null;
                 }
                 if (this.m_joinInfo == null && this.m_dataSetName != null && this.m_dataSet != null && !DataSet.AreEqualById(parentDataSetContainer.ParentDataSet, this.m_dataSet))
                 {
                     this.UpdateDataSet(parentDataSetContainer.ParentDataSet, scope);
                 }
             }
         }
     }
 }
 private void BindToParentDataSet(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext, ParentDataSetContainer parentDataSets)
 {
     if (parentDataSets == null)
     {
         DataRegion parentDataRegion = scopeTree.GetParentDataRegion(scope);
         if (parentDataRegion == null)
         {
             if (scopeTree.Report.MappingDataSetIndexToDataSet.Count == 0)
             {
                 errorContext.Register(ProcessingErrorCode.rsDataRegionWithoutDataSet, Severity.Error, scope.DataScopeObjectType, scope.Name, null);
             }
             else
             {
                 errorContext.Register(ProcessingErrorCode.rsMissingDataSetName, Severity.Error, scope.DataScopeObjectType, scope.Name, "DataSetName");
             }
         }
     }
     else if (parentDataSets.Count > 1 && !parentDataSets.AreAllSameDataSet())
     {
         DataRegion    parentDataRegion2                = scopeTree.GetParentDataRegion(scope);
         IRIFDataScope parentRowScopeForIntersection    = scopeTree.GetParentRowScopeForIntersection(scope);
         IRIFDataScope parentColumnScopeForIntersection = scopeTree.GetParentColumnScopeForIntersection(scope);
         errorContext.Register(ProcessingErrorCode.rsMissingIntersectionDataSetName, Severity.Error, scope.DataScopeObjectType, parentDataRegion2.Name, "DataSetName", parentDataRegion2.ObjectType.ToString(), parentRowScopeForIntersection.Name, parentColumnScopeForIntersection.Name);
     }
     else
     {
         this.UpdateDataSet(parentDataSets.ParentDataSet, scope);
     }
 }
        private void BindToNamedDataSet(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext, ParentDataSetContainer parentDataSets)
        {
            DataSet dataSet = scopeTree.GetDataSet(this.m_dataSetName);

            if (dataSet == null)
            {
                DataRegion parentDataRegion = scopeTree.GetParentDataRegion(scope);
                if (parentDataSets != null && parentDataSets.Count == 1 && scope is DataRegion && parentDataRegion != null)
                {
                    this.UpdateDataSet(parentDataSets.ParentDataSet, scope);
                    this.m_dataSetName = parentDataSets.ParentDataSet.Name;
                }
                else
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidDataSetName, Severity.Error, scope.DataScopeObjectType, scope.Name, "DataSetName", this.m_dataSetName.MarkAsPrivate());
                    if (parentDataSets != null)
                    {
                        this.UpdateDataSet(parentDataSets.ParentDataSet, scope);
                    }
                }
            }
            else
            {
                this.UpdateDataSet(dataSet, scope);
            }
        }
        public override bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope)
        {
            Global.Tracer.Assert(parentDataSets != null && parentDataSets.Count == 1, "LinearJoinInfo can only be used with exactly one parent data set");
            this.m_parentDataSet = parentDataSets.ParentDataSet;
            if (DataSet.AreEqualById(ourDataSet, this.m_parentDataSet))
            {
                return(false);
            }
            bool flag = false;

            if (base.m_relationships != null)
            {
                foreach (IdcRelationship relationship in base.m_relationships)
                {
                    flag |= relationship.ValidateLinearRelationship(errorContext, this.m_parentDataSet);
                }
            }
            if (!flag && !ourDataSet.HasDefaultRelationship(this.m_parentDataSet))
            {
                this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
                return(false);
            }
            Relationship activeRelationship = this.GetActiveRelationship(ourDataSet);

            if (activeRelationship == null)
            {
                this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
                return(false);
            }
            if (activeRelationship.IsCrossJoin && (!activeRelationship.NaturalJoin || LinearJoinInfo.ScopeHasParentGroups(currentScope, scopeTree)))
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, currentScope.Name, "JoinConditions");
                return(false);
            }
            return(true);
        }
Exemplo n.º 5
0
 public override bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope)
 {
     Global.Tracer.Assert(parentDataSets != null, "IntersectJoinInfo can only be used with one or two parent data sets");
     if (parentDataSets.Count == 1)
     {
         DataRegion parentDataRegion = scopeTree.GetParentDataRegion(currentScope);
         errorContext.Register(ProcessingErrorCode.rsUnexpectedCellDataSetName, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "DataSetName", parentDataRegion.ObjectType.ToString());
         return(false);
     }
     if (parentDataSets.AreAllSameDataSet() && DataSet.AreEqualById(parentDataSets.RowParentDataSet, ourDataSet))
     {
         return(false);
     }
     this.m_rowParentDataSet    = parentDataSets.RowParentDataSet;
     this.m_columnParentDataSet = parentDataSets.ColumnParentDataSet;
     if (this.m_rowParentDataSet != null && this.m_columnParentDataSet != null)
     {
         bool flag  = false;
         bool flag2 = false;
         if (base.m_relationships != null)
         {
             foreach (IdcRelationship relationship in base.m_relationships)
             {
                 if (!relationship.ValidateIntersectRelationship(errorContext, currentScope, scopeTree))
                 {
                     return(false);
                 }
                 this.CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, this.m_rowParentDataSet, ref flag);
                 this.CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, this.m_columnParentDataSet, ref flag2);
             }
         }
         flag  = this.HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, this.m_rowParentDataSet, flag);
         flag2 = this.HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, this.m_columnParentDataSet, flag2);
         if (flag && flag2)
         {
             DataRegion parentDataRegion2 = scopeTree.GetParentDataRegion(currentScope);
             if (this.ValidateCellBoundTotheSameDataSetAsParentScpoe(this.m_columnParentDataSet, this.m_rowParentDataSet, ourDataSet, parentDataRegion2.IsColumnGroupingSwitched))
             {
                 IRIFDataScope parentDataRegion3                = scopeTree.GetParentDataRegion(currentScope);
                 IRIFDataScope parentRowScopeForIntersection    = scopeTree.GetParentRowScopeForIntersection(currentScope);
                 IRIFDataScope parentColumnScopeForIntersection = scopeTree.GetParentColumnScopeForIntersection(currentScope);
                 if (parentDataRegion2.IsColumnGroupingSwitched)
                 {
                     errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion3.Name, "ParentScope", parentDataRegion3.DataScopeObjectType.ToString(), parentColumnScopeForIntersection.Name, parentRowScopeForIntersection.Name);
                     return(false);
                 }
                 errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion3.Name, "ParentScope", parentDataRegion3.DataScopeObjectType.ToString(), parentRowScopeForIntersection.Name, parentColumnScopeForIntersection.Name);
                 return(false);
             }
             return(true);
         }
         return(false);
     }
     return(false);
 }
Exemplo n.º 6
0
 public abstract bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope);