Пример #1
0
        public Int32Collection GetReFilterRows(DataTable i_Table, GroupInfo groupInfo, Int32Collection rows)
        {
            if (i_Table == null || rows == null || groupInfo == null)
            {
                return(rows);
            }

            Int32Collection reFilterRows = new Int32Collection();

            groupInfo.CalculateGroupResult(i_Table, rows, rows, rows, groupInfo);

            foreach (GroupResult m_Result in groupInfo.GroupResults)
            {
                if (!this.CheckResult(m_Result.RowIndicators.Count))
                {
                    continue;
                }

                reFilterRows = reFilterRows.Combine(reFilterRows, m_Result.RowIndicators);
            }

            return(reFilterRows);
        }
Пример #2
0
        public void AddTotalAndOthers(System.Data.DataTable i_Table, Int32Collection outerRows, Int32Collection innerRows)
        {
            if (this.RootGroupInfo == null)
            {
                return;
            }

            GroupResultCollection m_newResults = new GroupResultCollection();

            GroupResult m_TotalGroupResult = new GroupResult();

            m_TotalGroupResult.Summaries = new GroupSummaryCollection();

            GroupResult m_OtherGroupResult = new GroupResult();

            m_OtherGroupResult.Summaries = new GroupSummaryCollection();

            if (this.TotalPosition != TotalType.None)
            {
                #region Caclculate Result for Total

                m_TotalGroupResult.GroupValue = this.RootGroupInfo.TotalTitle;

                m_TotalGroupResult.RowIndicators = new Int32Collection();

                m_TotalGroupResult.ParentGroupInfo = this.RootGroupInfo;  //Add at 2009-2-19 14:23:47@Simon

                innerRows.CopyTo(m_TotalGroupResult.RowIndicators);

                if (this.RootGroupInfo.Summaries.Count > 0)
                {
                    GroupSummary summaryTotal = this.SummaryForTotalGroup.Copy();

                    m_TotalGroupResult.Summaries.Add(summaryTotal);

                    m_TotalGroupResult.CalculateSummaryResult(i_Table, innerRows, innerRows);
                }

                m_TotalGroupResult.SubGroupInfos = RootGroupInfo.SubGroupInfos.Copy();

                foreach (GroupInfo subGroupInfo in m_TotalGroupResult.SubGroupInfos)
                {
                    subGroupInfo.CalculateGroupResult(i_Table, outerRows, outerRows, innerRows, subGroupInfo);
                }
                #endregion
            }
            if (this.TotalPosition == TotalType.AllBefore)
            {
                m_newResults.Add(m_TotalGroupResult);
            }
            if (this.TotalOthersPosition == TotalType.AllBefore)
            {
                m_newResults.Add(m_OtherGroupResult);
            }

            Int32Collection m_OtherRowsTotal = new Int32Collection();

            for (int i = 0; i < this.RootGroupInfo.GroupResults.Count; i++)
            {
                if (i >= this.HorizonTopCount && HorizonTopCount > 0)
                {
                    m_OtherRowsTotal = m_OtherRowsTotal.Combine(this.RootGroupInfo.GroupResults[i].RowIndicators, m_OtherRowsTotal);
                }
                else
                {
                    m_newResults.Add(this.RootGroupInfo.GroupResults[i]);
                }
            }

            if (this.TotalOthersPosition != TotalType.None)
            {
                #region calculate Other results

                m_OtherGroupResult.GroupValue = this.TotalOthersName;

                m_OtherGroupResult.RowIndicators = new Int32Collection();

                m_OtherGroupResult.ParentGroupInfo = this.RootGroupInfo;  //Add at 2009-2-19 14:23:47@Simon

                m_OtherRowsTotal.CopyTo(m_OtherGroupResult.RowIndicators);

                if (this.RootGroupInfo.Summaries.Count > 0)
                {
                    GroupSummary summaryTotal = this.SummaryForOthers.Copy();

                    m_OtherGroupResult.Summaries.Add(summaryTotal);

                    m_OtherGroupResult.CalculateSummaryResult(i_Table, outerRows, m_OtherRowsTotal);
                }

                m_OtherGroupResult.SubGroupInfos = this.RootGroupInfo.SubGroupInfos.Copy();

                foreach (GroupInfo subGroupInfo in m_OtherGroupResult.SubGroupInfos)
                {
                    subGroupInfo.CalculateGroupResult(i_Table, m_OtherRowsTotal, outerRows, m_OtherRowsTotal, subGroupInfo);
                }
                #endregion
            }

            if (this.TotalOthersPosition == TotalType.AllAfter)
            {
                m_newResults.Add(m_OtherGroupResult);
            }
            if (this.TotalPosition == TotalType.AllAfter)
            {
                m_newResults.Add(m_TotalGroupResult);
            }

            this.RootGroupInfo.ResetGroupResults(m_newResults);
        }