Esempio n. 1
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);
     }
 }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //***************************卓正PageOffice组件的使用********************************
        WordDocument doc = new WordDocument();
        //打开数据区域
        DataRegion dTable = doc.OpenDataRegion("PO_table");

        //设置数据区域可编辑性
        dTable.Editing = true;
        //打开数据区域中的表格,OpenTable(index)方法中的index为word文档中表格的下标,从1开始
        PageOffice.WordWriter.Table table1 = doc.OpenDataRegion("PO_Table").OpenTable(1);
        // 给表头单元格赋值
        table1.OpenCellRC(1, 2).Value = "产品1";
        table1.OpenCellRC(1, 3).Value = "产品2";
        table1.OpenCellRC(2, 1).Value = "A部门";
        table1.OpenCellRC(3, 1).Value = "B部门";

        PageOfficeCtrl1.SetWriter(doc);

        //添加自定义按钮
        PageOfficeCtrl1.AddCustomToolButton("保存", "Save", 1);
        PageOfficeCtrl1.AddCustomToolButton("全屏/还原", "IsFullScreen", 4);
        //设置服务器页面
        PageOfficeCtrl1.ServerPage = Request.ApplicationPath + "/pageoffice/server.aspx";
        //设置保存页
        PageOfficeCtrl1.SaveDataPage = "SaveData.aspx";
        //设置文档打开方式
        PageOfficeCtrl1.WebOpen("doc/test.doc", PageOffice.OpenModeType.docSubmitForm, "张佚名");
    }
        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);
            }
        }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.WordWriter.WordDocument doc = new PageOffice.WordWriter.WordDocument();
        DataRegion d1 = doc.OpenDataRegion("d1");

        d1.Font.Color = Color.Green;                                                //设置数据区域文本字体颜色
        d1.Font.Name  = "华文彩云";                                                     //设置数据区域文本字体样式
        d1.Font.Size  = 16;                                                         //设置数据区域文本字体大小
        d1.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; //设置数据区域文本对齐方式


        DataRegion d2 = doc.OpenDataRegion("d2");

        d2.Font.Color = Color.MediumAquamarine;                                   //设置数据区域文本字体颜色
        d2.Font.Name  = "黑体";                                                     //设置数据区域文本字体样式
        d2.Font.Size  = 14;                                                       //设置数据区域文本字体大小
        d2.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; //设置数据区域文本对齐方式

        DataRegion d3 = doc.OpenDataRegion("d3");

        d3.Font.Color = Color.Purple;                                              //设置数据区域文本字体颜色
        d3.Font.Name  = "华文行楷";                                                    //设置数据区域文本字体样式
        d3.Font.Size  = 12;                                                        //设置数据区域文本字体大小
        d3.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight; //设置数据区域文本对齐方式


        PageOfficeCtrl1.SetWriter(doc);

        //添加自定义按钮
        PageOfficeCtrl1.AddCustomToolButton("全屏/还原", "IsFullScreen", 4);
        //设置服务器页面
        PageOfficeCtrl1.ServerPage = Request.ApplicationPath + "/pageoffice/server.aspx"; //此行必须
        //设置文档打开方式
        PageOfficeCtrl1.WebOpen("doc/test.doc", PageOffice.OpenModeType.docSubmitForm, "张三");
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //-----------  PageOffice 服务器端编程开始  -------------------//
        WordDocument doc     = new WordDocument();
        DataRegion   dataReg = doc.OpenDataRegion("PO_table");

        PageOffice.WordReader.Table table = dataReg.OpenTable(1);

        //输出提交的table中的数据
        Response.Write("表格中的各个单元的格数据为:<br/><br/>");
        StringBuilder dataStr = new StringBuilder();

        for (int i = 1; i <= table.RowsCount; i++)
        {
            dataStr.Append("<div style='width:220px;'>");
            for (int j = 1; j <= table.ColumnsCount; j++)
            {
                dataStr.Append("<div style='float:left;width:70px;border:1px solid red;'>" + table.OpenCellRC(i, j).Value + "</div>");
            }
            dataStr.Append("</div>");
        }
        Response.Write(dataStr.ToString());
        //向客户端显示提交的数据
        doc.ShowPage(300, 300);
        doc.Close();
    }
Esempio n. 6
0
        public void DifferentDataRegionsProbablyHaveDifferentHashCodes(long aFirstIndex, long aLastIndex, long bFirstIndex, long bLastIndex)
        {
            DataRegion a = new DataRegion(aFirstIndex, aLastIndex);
            DataRegion b = new DataRegion(bFirstIndex, bLastIndex);

            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        internal void SetupEnvironment(OnDemandProcessingContext odpContext, int dataSetIndex)
        {
            SetupFields(odpContext, dataSetIndex);
            DataRegion dataRegionDef        = m_cellDef.DataRegionDef;
            int        aggregateValueOffset = 0;

            if (m_cellDef.AggregateIndexes != null)
            {
                SetupAggregates(odpContext, dataRegionDef.CellAggregates, m_cellDef.AggregateIndexes, ref aggregateValueOffset);
            }
            if (m_cellDef.PostSortAggregateIndexes != null)
            {
                SetupAggregates(odpContext, dataRegionDef.CellPostSortAggregates, m_cellDef.PostSortAggregateIndexes, ref aggregateValueOffset);
            }
            if (m_cellDef.RunningValueIndexes != null)
            {
                SetupAggregates(odpContext, dataRegionDef.CellRunningValues, m_cellDef.RunningValueIndexes, ref aggregateValueOffset);
            }
            if (m_cellDef.DataScopeInfo != null)
            {
                DataScopeInfo dataScopeInfo = m_cellDef.DataScopeInfo;
                if (dataScopeInfo.AggregatesOfAggregates != null)
                {
                    SetupAggregates(odpContext, dataScopeInfo.AggregatesOfAggregates, ref aggregateValueOffset);
                }
                if (dataScopeInfo.PostSortAggregatesOfAggregates != null)
                {
                    SetupAggregates(odpContext, dataScopeInfo.PostSortAggregatesOfAggregates, ref aggregateValueOffset);
                }
                if (dataScopeInfo.RunningValuesOfAggregates != null)
                {
                    SetupAggregates(odpContext, dataScopeInfo.RunningValuesOfAggregates, ref aggregateValueOffset);
                }
            }
        }
Esempio n. 8
0
        public void EqualDataRegionsHaveEqualHashCodes(long aFirstIndex, long aLastIndex, long bFirstIndex, long bLastIndex)
        {
            DataRegion a = new DataRegion(aFirstIndex, aLastIndex);
            DataRegion b = new DataRegion(bFirstIndex, bLastIndex);

            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 9
0
        public void ToStringWorks(long firstIndex, long lastIndex)
        {
            DataRegion region   = new DataRegion(firstIndex, lastIndex);
            string     expected = "(" + firstIndex + ", " + lastIndex + ")";

            Assert.AreEqual(expected, region.ToString());
        }
Esempio n. 10
0
 private bool HasRelationshipOrDefaultForDataSet(ScopeTree scopeTree, ErrorContext errorContext, IRIFReportDataScope currentScope, DataSet ourDataSet, DataSet parentDataSet, bool hasValidRelationship)
 {
     if (DataSet.AreEqualById(parentDataSet, ourDataSet))
     {
         return(true);
     }
     if (hasValidRelationship || ourDataSet.HasDefaultRelationship(parentDataSet))
     {
         Relationship activeRelationship = GetActiveRelationship(ourDataSet, parentDataSet);
         if (activeRelationship == null)
         {
             RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet);
             return(false);
         }
         if (activeRelationship.IsCrossJoin)
         {
             DataRegion parentDataRegion = scopeTree.GetParentDataRegion(currentScope);
             errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "JoinConditions", parentDataRegion.ObjectType.ToString());
             return(false);
         }
         return(true);
     }
     RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet);
     return(false);
 }
Esempio n. 11
0
        public void SetupEnvironment(OnDemandProcessingContext odpContext, int dataSetIndex)
        {
            base.SetupFields(odpContext, dataSetIndex);
            DataRegion dataRegionDef = this.m_cellDef.DataRegionDef;
            int        num           = 0;

            if (this.m_cellDef.AggregateIndexes != null)
            {
                base.SetupAggregates(odpContext, dataRegionDef.CellAggregates, this.m_cellDef.AggregateIndexes, ref num);
            }
            if (this.m_cellDef.PostSortAggregateIndexes != null)
            {
                base.SetupAggregates(odpContext, dataRegionDef.CellPostSortAggregates, this.m_cellDef.PostSortAggregateIndexes, ref num);
            }
            if (this.m_cellDef.RunningValueIndexes != null)
            {
                base.SetupAggregates(odpContext, dataRegionDef.CellRunningValues, this.m_cellDef.RunningValueIndexes, ref num);
            }
            if (this.m_cellDef.DataScopeInfo != null)
            {
                DataScopeInfo dataScopeInfo = this.m_cellDef.DataScopeInfo;
                if (dataScopeInfo.AggregatesOfAggregates != null)
                {
                    base.SetupAggregates(odpContext, dataScopeInfo.AggregatesOfAggregates, ref num);
                }
                if (dataScopeInfo.PostSortAggregatesOfAggregates != null)
                {
                    base.SetupAggregates(odpContext, dataScopeInfo.PostSortAggregatesOfAggregates, ref num);
                }
                if (dataScopeInfo.RunningValuesOfAggregates != null)
                {
                    base.SetupAggregates(odpContext, dataScopeInfo.RunningValuesOfAggregates, ref num);
                }
            }
        }
Esempio n. 12
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);
        }
Esempio n. 13
0
        public void ConstructorWorks()
        {
            long       firstIndex = 3, lastIndex = 9;
            DataRegion region = new DataRegion(firstIndex, lastIndex);

            Assert.AreEqual(firstIndex, region.FirstIndex);
            Assert.AreEqual(lastIndex, region.LastIndex);
            Assert.AreEqual(7, region.Length);
        }
Esempio n. 14
0
        public void EqualsNonDataRegionReturnsFalse()
        {
            DataRegion region = new DataRegion(0, 1);

            Assert.IsFalse(region.Equals(null));
            Assert.IsFalse(region.Equals("string"));
            Assert.IsFalse(region.Equals(0));
            Assert.IsFalse(region.Equals(1));
        }
Esempio n. 15
0
 public Cell(int id, DataRegion dataRegion)
     : base(id)
 {
     this.m_dataRegionDef      = dataRegion;
     this.m_aggregates         = new List <DataAggregateInfo>();
     this.m_postSortAggregates = new List <DataAggregateInfo>();
     this.m_runningValues      = new List <RunningValueInfo>();
     this.m_dataScopeInfo      = new DataScopeInfo(id);
 }
Esempio n. 16
0
        public void CombineWithWorks(long aFirstIndex, long aLastIndex, long bFirstIndex, long bLastIndex, long resultFirstIndex, long resultLastIndex)
        {
            DataRegion a        = new DataRegion(aFirstIndex, aLastIndex);
            DataRegion b        = new DataRegion(bFirstIndex, bLastIndex);
            DataRegion expected = new DataRegion(resultFirstIndex, resultLastIndex);

            Assert.AreEqual(expected, a.CombineWith(b));
            Assert.AreEqual(expected, b.CombineWith(a));
        }
        private void RadioButton_Click(object sender, RoutedEventArgs e)
        {
            RadioButton button = sender as RadioButton;

            if (button.DataContext is DataRegion)
            {
                currentSelected    = (DataRegion)button.DataContext;
                btnApply.IsEnabled = true;
            }
        }
Esempio n. 18
0
        private void UpdateDataSet(DataSet targetDataSet, IRIFDataScope scope)
        {
            m_dataSet = targetDataSet;
            DataRegion dataRegion = scope as DataRegion;

            if (dataRegion != null && m_dataSet != null)
            {
                dataRegion.DataSetName = m_dataSet.Name;
            }
        }
Esempio n. 19
0
        public override object PublishClone(AutomaticSubtotalContext context, DataRegion newContainingRegion)
        {
            MapMember mapMember = (MapMember)base.PublishClone(context, newContainingRegion);

            if (this.ChildMapMember != null)
            {
                mapMember.ChildMapMember = (MapMember)this.ChildMapMember.PublishClone(context, newContainingRegion);
            }
            return(mapMember);
        }
Esempio n. 20
0
        internal override object PublishClone(AutomaticSubtotalContext context, DataRegion newContainingRegion)
        {
            GaugeMember gaugeMember = (GaugeMember)base.PublishClone(context, newContainingRegion);

            if (ChildGaugeMember != null)
            {
                gaugeMember.ChildGaugeMember = (GaugeMember)ChildGaugeMember.PublishClone(context, newContainingRegion);
            }
            return(gaugeMember);
        }
Esempio n. 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo_paper.mdb";
        string strSql  = "select * from stream ";

        OleDbConnection conn = new OleDbConnection(strConn);
        OleDbCommand    cmd  = new OleDbCommand(strSql, conn);

        conn.Open();
        cmd.CommandType = CommandType.Text;
        OleDbDataReader reader = cmd.ExecuteReader();

        int    id   = 0;
        string temp = "ACE_begin1";

        WordDocument doc = new WordDocument();

        if (reader.HasRows)
        {
            int num = 1;
            while (reader.Read())
            {
                id = int.Parse(reader["ID"].ToString());
                string chk = Request.Form["check" + id];
                if (chk != null && chk.Equals("on", StringComparison.OrdinalIgnoreCase))
                {
                    if (id == 1)
                    {
                        DataRegion dataNum = doc.OpenDataRegion("ACE_begin1");
                        dataNum.Value = "1.\t";
                        DataRegion dataReg = doc.CreateDataRegion("begin" + (id + 1), DataRegionInsertType.After, "begin1");
                        dataReg.Value = "[word]Openfile.aspx?id=" + id + "[/word]";
                    }
                    else
                    {
                        DataRegion dataNum = doc.CreateDataRegion("ACE_" + num, DataRegionInsertType.After, temp);
                        dataNum.Value = num + ".\t";
                        DataRegion dataRegion = doc.CreateDataRegion("begin" + (id + 1), DataRegionInsertType.After, "ACE_" + num);
                        dataRegion.Value = "[word]Openfile.aspx?id=" + id + "[/word]";
                    }

                    temp = "ACE_begin" + (id + 1);
                    num++;
                }
            }
        }

        AceoffixCtrl1.ServerPage = "../aceoffix-runtime/server.aspx";

        AceoffixCtrl1.Menubar       = false;
        AceoffixCtrl1.CustomToolbar = false;
        AceoffixCtrl1.Bind(doc);

        AceoffixCtrl1.OpenDocument("doc/test.doc", Aceoffix.OpenModeType.docNormalEdit, "John Scott");
    }
        private void RegisterInvalidInnerDataSetNameError(ErrorContext errorContext, DataSet ourDataSet, IRIFReportDataScope currentScope)
        {
            Severity   severity   = Severity.Error;
            DataRegion dataRegion = currentScope as DataRegion;

            if (dataRegion != null)
            {
                severity = Severity.Warning;
            }
            errorContext.Register(ProcessingErrorCode.rsInvalidInnerDataSetName, severity, currentScope.DataScopeObjectType, currentScope.Name, "DataSetName", this.m_parentDataSet.Name.MarkAsPrivate(), ourDataSet.Name.MarkAsPrivate());
        }
Esempio n. 23
0
        public void Write(long dstOffset, byte[] buffer, long srcOffset, long length)
        {
            if (BasePageStorage.IsReadOnly)
            {
                throw new InvalidOperationException("Cannot write to a read-only " + nameof(CachedPage) + ".");
            }
            if (dstOffset < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(dstOffset), "The destination offset cannot be less than zero.");
            }
            if (srcOffset < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(srcOffset), "The source offset cannot be less than zero.");
            }
            if (length < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length), "The length cannot be less than zero.");
            }
            if (dstOffset + length > BasePageStorage.PageSize)
            {
                throw new ArgumentOutOfRangeException(nameof(dstOffset), "The sum of the destination offset and length cannot be greater than the page size.");
            }
            if (srcOffset + length > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(srcOffset), "The sum of the source offset and length cannot be greater than the size of the source buffer.");
            }

            lock (locker)
            {
                DataRegion dstRegion = new DataRegion(dstOffset, (dstOffset + length) - 1 /*-1 to go from count to index*/);

                //Copy the data to the cached buffer
                Buffer.BlockCopy(buffer, (int)srcOffset, cacheBuffer, (int)dstOffset, (int)length);

                //Writes affect read cache too
                readRegions.Add(dstRegion);

                if (WriteMode == CachedPageStorage.CacheWriteMode.WriteThrough)
                {
                    //Write directly to the base storage
                    BasePageStorage.WriteTo(PageIndex, dstOffset, buffer, srcOffset, length);
                }
                else
                {
                    //Update the 'dirty' write regions
                    writtenRegions.Add(dstRegion);
                }
            }

            //Mark this page as more recent
            UpdateUseCounter();
        }
Esempio n. 24
0
        public void CombineWithThrowsWhenNeitherIntersectingNorAdjacent(long aFirstIndex, long aLastIndex, long bFirstIndex, long bLastIndex)
        {
            DataRegion a = new DataRegion(aFirstIndex, aLastIndex);
            DataRegion b = new DataRegion(bFirstIndex, bLastIndex);

            Assert.ThrowsException <ArgumentException>(() => {
                a.CombineWith(b);
            });

            Assert.ThrowsException <ArgumentException>(() => {
                b.CombineWith(a);
            });
        }
Esempio n. 25
0
        public override void ResolveReferences(Dictionary <AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType, List <MemberReference> > memberReferencesCollection, Dictionary <int, IReferenceable> referenceableItems)
        {
            List <MemberReference> list = default(List <MemberReference>);

            if (memberReferencesCollection.TryGetValue(Cell.m_Declaration.ObjectType, out list))
            {
                foreach (MemberReference item2 in list)
                {
                    switch (item2.MemberName)
                    {
                    case MemberName.ParentRowID:
                        Global.Tracer.Assert(referenceableItems.ContainsKey(item2.RefID), "ParentRowID");
                        base.m_parentIDOwner = (IDOwner)referenceableItems[item2.RefID];
                        this.m_parentRowID   = item2.RefID;
                        break;

                    case MemberName.ParentColumnID:
                        Global.Tracer.Assert(referenceableItems.ContainsKey(item2.RefID), "ParentColumnID");
                        this.m_parentColumnIDOwner = (IDOwner)referenceableItems[item2.RefID];
                        this.m_parentColumnID      = item2.RefID;
                        break;

                    case MemberName.DataRegionDef:
                    {
                        IReferenceable referenceable2 = default(IReferenceable);
                        referenceableItems.TryGetValue(item2.RefID, out referenceable2);
                        Global.Tracer.Assert(referenceable2 != null && ((ReportItem)referenceable2).IsDataRegion, "DataRegionDef");
                        this.m_dataRegionDef = (DataRegion)referenceable2;
                        break;
                    }

                    case MemberName.InScopeEventSources:
                    {
                        IReferenceable referenceable = default(IReferenceable);
                        referenceableItems.TryGetValue(item2.RefID, out referenceable);
                        IInScopeEventSource item = (IInScopeEventSource)referenceable;
                        if (this.m_inScopeEventSources == null)
                        {
                            this.m_inScopeEventSources = new List <IInScopeEventSource>();
                        }
                        this.m_inScopeEventSources.Add(item);
                        break;
                    }

                    default:
                        Global.Tracer.Assert(false);
                        break;
                    }
                }
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Reads from the page, updating cache where necessary.
        /// </summary>
        /// <param name="srcOffset">The source offset within the page's payload.</param>
        /// <param name="buffer">The destination buffer.</param>
        /// <param name="dstOffset">The offset within the destination <paramref name="buffer"/>.</param>
        /// <param name="length">The number of bytes to read.</param>
        public void Read(long srcOffset, byte[] buffer, long dstOffset, long length)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }
            if (srcOffset < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(srcOffset), "The source offset cannot be less than zero.");
            }
            if (dstOffset < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(dstOffset), "The destination offset cannot be less than zero.");
            }
            if (length < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length), "The length cannot be less than zero.");
            }
            if (srcOffset + length > BasePageStorage.PageSize)
            {
                throw new ArgumentOutOfRangeException(nameof(srcOffset), "The sum of the source offset and length cannot be greater than the size of each page.");
            }
            if (dstOffset + length > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(dstOffset), "The sum of the destination offset and length cannot be greater than the size of the destination buffer.");
            }

            lock (locker)
            {
                if (length != 0)
                {
                    DataRegion srcRegion = new DataRegion(srcOffset, (srcOffset + length) - 1 /*-1 to go from count to index*/);

                    //Determine which DataRegions are not currently cached (if any), and load them into cache
                    foreach (var missing in readRegions.GetMissingRegions(srcRegion))
                    {
                        //Read this missing DataRegion into cache
                        BasePageStorage.ReadFrom(PageIndex, missing.FirstIndex, cacheBuffer, missing.FirstIndex, missing.Length);
                        readRegions.Add(missing);
                    }

                    //Copy the data from the cached buffer
                    Buffer.BlockCopy(cacheBuffer, (int)srcOffset, buffer, (int)dstOffset, (int)length);
                }
                //Else we don't need to do anything, read 0 bytes is meaningless
            }

            //Mark this page as more recent
            UpdateUseCounter();
        }
Esempio n. 27
0
        public void ContainsDataRegionWorks(long containerFirstIndex, long containerLastIndex, long containedFirstIndex, long containedLastIndex, bool isContained)
        {
            DataRegion container = new DataRegion(containerFirstIndex, containerLastIndex);
            DataRegion contained = new DataRegion(containedFirstIndex, containedLastIndex);

            if (isContained)
            {
                Assert.IsTrue(container.Contains(contained));
            }
            else
            {
                Assert.IsFalse(container.Contains(contained));
            }
        }
Esempio n. 28
0
        public override void ResolveReferences(Dictionary <Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType, List <MemberReference> > memberReferencesCollection, Dictionary <int, IReferenceable> referenceableItems)
        {
            if (!memberReferencesCollection.TryGetValue(m_Declaration.ObjectType, out List <MemberReference> value))
            {
                return;
            }
            foreach (MemberReference item2 in value)
            {
                switch (item2.MemberName)
                {
                case MemberName.ParentRowID:
                    Global.Tracer.Assert(referenceableItems.ContainsKey(item2.RefID), "ParentRowID");
                    m_parentIDOwner = (IDOwner)referenceableItems[item2.RefID];
                    m_parentRowID   = item2.RefID;
                    break;

                case MemberName.ParentColumnID:
                    Global.Tracer.Assert(referenceableItems.ContainsKey(item2.RefID), "ParentColumnID");
                    m_parentColumnIDOwner = (IDOwner)referenceableItems[item2.RefID];
                    m_parentColumnID      = item2.RefID;
                    break;

                case MemberName.DataRegionDef:
                {
                    referenceableItems.TryGetValue(item2.RefID, out IReferenceable value3);
                    Global.Tracer.Assert(value3 != null && ((ReportItem)value3).IsDataRegion, "DataRegionDef");
                    m_dataRegionDef = (DataRegion)value3;
                    break;
                }

                case MemberName.InScopeEventSources:
                {
                    referenceableItems.TryGetValue(item2.RefID, out IReferenceable value2);
                    IInScopeEventSource item = (IInScopeEventSource)value2;
                    if (m_inScopeEventSources == null)
                    {
                        m_inScopeEventSources = new List <IInScopeEventSource>();
                    }
                    m_inScopeEventSources.Add(item);
                    break;
                }

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
        }
Esempio n. 29
0
        public void ContainsIndexWorks(long firstIndex, long lastIndex, long scanStartIndex, long scanLastIndex)
        {
            DataRegion region = new DataRegion(firstIndex, lastIndex);

            for (long i = scanStartIndex; i <= scanLastIndex; i++)
            {
                if (i >= firstIndex && i <= lastIndex)
                {
                    Assert.IsTrue(region.ContainsIndex(i));
                }
                else
                {
                    Assert.IsFalse(region.ContainsIndex(i));
                }
            }
        }
Esempio n. 30
0
        public void EqualsWorks(long aFirstIndex, long aLastIndex, long bFirstIndex, long bLastIndex, bool areEqual)
        {
            DataRegion a = new DataRegion(aFirstIndex, aLastIndex);
            DataRegion b = new DataRegion(bFirstIndex, bLastIndex);

            if (areEqual)
            {
                Assert.IsTrue(a.Equals(b));
                Assert.IsTrue(b.Equals(a));
            }
            else
            {
                Assert.IsFalse(a.Equals(b));
                Assert.IsFalse(b.Equals(a));
            }
        }