예제 #1
0
        internal void ValidateDataSetBindingAndRelationships(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext)
        {
            if (m_dataSet != null)
            {
                return;
            }
            ParentDataSetContainer parentDataSetContainer = DetermineParentDataSets(scopeTree, scope);

            if (m_dataSetName == null)
            {
                BindToParentDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
            }
            else
            {
                BindToNamedDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
            }
            if (m_dataSet == null)
            {
                return;
            }
            if (scopeTree.GetParentDataRegion(scope) == null && m_joinInfo != null)
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidRelationshipTopLevelDataRegion, Severity.Error, scope.DataScopeObjectType, scope.Name, "Relationship");
                m_joinInfo = null;
            }
            if (parentDataSetContainer != null && m_joinInfo == null)
            {
                if (parentDataSetContainer.Count == 1)
                {
                    m_joinInfo = new LinearJoinInfo();
                }
                else
                {
                    m_joinInfo = new IntersectJoinInfo();
                }
            }
            if (m_joinInfo != null)
            {
                if (!m_joinInfo.ValidateRelationships(scopeTree, errorContext, m_dataSet, parentDataSetContainer, scope))
                {
                    m_joinInfo = null;
                }
                if (m_joinInfo == null && m_dataSetName != null && m_dataSet != null && !DataSet.AreEqualById(parentDataSetContainer.ParentDataSet, m_dataSet))
                {
                    UpdateDataSet(parentDataSetContainer.ParentDataSet, scope);
                }
            }
        }
예제 #2
0
        internal 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);
            }
            m_rowParentDataSet    = parentDataSets.RowParentDataSet;
            m_columnParentDataSet = parentDataSets.ColumnParentDataSet;
            if (m_rowParentDataSet == null || m_columnParentDataSet == null)
            {
                return(false);
            }
            bool dataSetAlreadyHasRelationship  = false;
            bool dataSetAlreadyHasRelationship2 = false;

            if (m_relationships != null)
            {
                foreach (IdcRelationship relationship in m_relationships)
                {
                    if (relationship.ValidateIntersectRelationship(errorContext, currentScope, scopeTree))
                    {
                        CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, m_rowParentDataSet, ref dataSetAlreadyHasRelationship);
                        CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, m_columnParentDataSet, ref dataSetAlreadyHasRelationship2);
                        continue;
                    }
                    return(false);
                }
            }
            dataSetAlreadyHasRelationship  = HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, m_rowParentDataSet, dataSetAlreadyHasRelationship);
            dataSetAlreadyHasRelationship2 = HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, m_columnParentDataSet, dataSetAlreadyHasRelationship2);
            if (!dataSetAlreadyHasRelationship || !dataSetAlreadyHasRelationship2)
            {
                return(false);
            }
            DataRegion parentDataRegion2 = scopeTree.GetParentDataRegion(currentScope);

            if (ValidateCellBoundTotheSameDataSetAsParentScpoe(m_columnParentDataSet, 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);
        }
예제 #3
0
 private void BindToParentDataSet(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext, ParentDataSetContainer parentDataSets)
 {
     if (parentDataSets == null)
     {
         if (scopeTree.GetParentDataRegion(scope) == 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    parentDataRegion = scopeTree.GetParentDataRegion(scope);
         IRIFDataScope parentRowScopeForIntersection    = scopeTree.GetParentRowScopeForIntersection(scope);
         IRIFDataScope parentColumnScopeForIntersection = scopeTree.GetParentColumnScopeForIntersection(scope);
         errorContext.Register(ProcessingErrorCode.rsMissingIntersectionDataSetName, Severity.Error, scope.DataScopeObjectType, parentDataRegion.Name, "DataSetName", parentDataRegion.ObjectType.ToString(), parentRowScopeForIntersection.Name, parentColumnScopeForIntersection.Name);
     }
     else
     {
         UpdateDataSet(parentDataSets.ParentDataSet, scope);
     }
 }
예제 #4
0
        private void BindToNamedDataSet(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext, ParentDataSetContainer parentDataSets)
        {
            DataSet dataSet = scopeTree.GetDataSet(m_dataSetName);

            if (dataSet == null)
            {
                DataRegion parentDataRegion = scopeTree.GetParentDataRegion(scope);
                if (parentDataSets != null && parentDataSets.Count == 1 && scope is DataRegion && parentDataRegion != null)
                {
                    UpdateDataSet(parentDataSets.ParentDataSet, scope);
                    m_dataSetName = parentDataSets.ParentDataSet.Name;
                    return;
                }
                errorContext.Register(ProcessingErrorCode.rsInvalidDataSetName, Severity.Error, scope.DataScopeObjectType, scope.Name, "DataSetName", m_dataSetName.MarkAsPrivate());
                if (parentDataSets != null)
                {
                    UpdateDataSet(parentDataSets.ParentDataSet, scope);
                }
            }
            else
            {
                UpdateDataSet(dataSet, scope);
            }
        }
예제 #5
0
        internal 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");
            m_parentDataSet = parentDataSets.ParentDataSet;
            if (DataSet.AreEqualById(ourDataSet, m_parentDataSet))
            {
                return(false);
            }
            bool flag = false;

            if (m_relationships != null)
            {
                foreach (IdcRelationship relationship in m_relationships)
                {
                    flag |= relationship.ValidateLinearRelationship(errorContext, m_parentDataSet);
                }
            }
            if (flag || ourDataSet.HasDefaultRelationship(m_parentDataSet))
            {
                Relationship activeRelationship = GetActiveRelationship(ourDataSet);
                if (activeRelationship == null)
                {
                    RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
                    return(false);
                }
                if (activeRelationship.IsCrossJoin && (!activeRelationship.NaturalJoin || ScopeHasParentGroups(currentScope, scopeTree)))
                {
                    errorContext.Register(ProcessingErrorCode.rsInvalidNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, currentScope.Name, "JoinConditions");
                    return(false);
                }
                return(true);
            }
            RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
            return(false);
        }
예제 #6
0
 internal abstract bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope);