/// <summary> /// Calculate grouped result /// </summary> /// <param name="i_Table">data source</param> public override void CalculateResult(DataTable i_Table) { //Convert old group struct to new one ConvertOldGroupInfo(this._RootGroupInfo); //If have no data source ,clear group struct if (i_Table == null) { this.RootGroupInfo.ClearGroupResult(this._RootGroupInfo); return; } //Filter rows Webb.Collections.Int32Collection m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(i_Table); m_Rows = this.RepeatFilter.Filter.GetFilteredRows(i_Table, m_Rows); //Added this code at 2008-12-26 12:22:40@Simon m_Rows = this.Filter.GetFilteredRows(i_Table, m_Rows); m_Rows.CopyTo(this.FilteredRows); //Find and create section filters //this.CheckSectionFilters(); //Calculate group result this._RootGroupInfo.CalculateGroupResult(i_Table, m_Rows, m_Rows, this.RootGroupInfo); //Calculate Total //Int32Collection totalIndicators = this.GetAllTotalIndicators(); //if(this.Total) this.CalculateAllTotal(i_Table,totalIndicators.Count,totalIndicators); }
// public override void CalculateGroupResult(DataTable i_Table, Webb.Collections.Int32Collection i_OuterRows, Webb.Collections.Int32Collection i_FilterRows, Webb.Collections.Int32Collection i_InnerRows, GroupInfo i_GroupInfo) // { // i_GroupInfo.UpdateSectionSummaries(); //Modified at 2009-1-21 15:08:49@Scott // this._Filter=AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters,this._Filter); //2009-4-29 11:37:37@Simon Add UpdateAdvFilter // //Added this code at 2008-12-22 8:29:27@Simon // #region Modified Area // if(this._GroupResults == null) this._GroupResults = new GroupResultCollection(); // this._GroupResults.Clear(); // i_InnerRows=this.Filter.GetFilteredRows(i_Table,i_InnerRows); //Added this code at 2008-12-24 8:26:50@Simon // i_FilterRows=this.Filter.GetFilteredRows(i_Table,i_FilterRows); //Added this code at 2008-12-24 8:26:50@Simon // if(this.SectionFilters.Count>0) // { // if (this.AddTotal) // { // GroupResult m_GroupResult = new GroupResult(); // m_GroupResult.Filter = new Webb.Data.DBFilter(); // m_GroupResult.GroupValue = this.TotalTitle; // m_GroupResult.ParentGroupInfo = this; //Add at 2009-2-19 14:23:47@Simon // m_GroupResult.ClickEvent = i_GroupInfo.ClickEvent; // this._GroupResults.Add(m_GroupResult); // } // int LimitCount=0; // foreach(SectionFilter m_Section in this.SectionFilters) // { // if(this.TopCount>0&&LimitCount>=this.TopCount)break; //Added this code at 2009-2-9 9:36:32@Simon // GroupResult m_Result = new GroupResult(); // m_Result.GroupValue = m_Section.FilterName; // m_Result.Filter = m_Section.Filter; // m_Result.ParentGroupInfo = this; // m_Result.ClickEvent = i_GroupInfo.ClickEvent; // this._GroupResults.Add(m_Result); // LimitCount++; // } // foreach(GroupResult m_GroupResult in this.GroupResults) // { // m_GroupResult.ClickEvent = this.ClickEvent; //12-28-2007@Scott // m_GroupResult.CalculateRowIndicators(i_Table,i_InnerRows); // if(this.Summaries != null) // { // m_GroupResult.Summaries = this.Summaries.CopyStructure(); // m_GroupResult.CalculateSummaryResult(i_Table,i_OuterRows,i_InnerRows); // } // } // } // else // { // GroupResult m_GroupResult = new GroupResult(); // m_GroupResult.GroupValue = string.Empty; // m_GroupResult.ParentGroupInfo = this; // m_GroupResult.RowIndicators = new Int32Collection(); // i_InnerRows.CopyTo(m_GroupResult.RowIndicators); // m_GroupResult.ClickEvent = i_GroupInfo.ClickEvent; // this._GroupResults.Add(m_GroupResult); // if(this.Summaries != null) // { // m_GroupResult.Summaries = this.Summaries.CopyStructure(); // m_GroupResult.CalculateSummaryResult(i_Table,i_OuterRows,i_InnerRows); // } // } // if(i_GroupInfo.SubGroupInfos.Count > 0) // { // foreach(GroupResult m_GroupResult in this._GroupResults) // { //// if(m_GroupResult.RowIndicators==null)continue; //// m_GroupResult.SubGroupInfos = i_GroupInfo.SubGroupInfos.Copy(); //// foreach(GroupInfo subGroupinfo in m_GroupResult.SubGroupInfos) //// { //// subGroupinfo.CalculateGroupResult(i_Table, i_OuterRows,i_FilterRows, m_GroupResult.RowIndicators,subGroupinfo); //// } // if(m_GroupResult.RowIndicators==null)continue; // m_GroupResult.SubGroupInfos = i_GroupInfo.SubGroupInfos.Copy(); // for(int i = 0; i < m_GroupResult.SubGroupInfos.Count; i++) // { // GroupInfo resultGroupInfo = m_GroupResult.SubGroupInfos[i]; // GroupInfo subGroupInfo = i_GroupInfo.SubGroupInfos[i]; // resultGroupInfo.IsSectionOutSide = false; // subGroupInfo.IsSectionOutSide = false; // System.Diagnostics.Trace.Assert(resultGroupInfo != null && subGroupInfo != null,"Calculate Section Group Error"); // resultGroupInfo.CalculateGroupResult(i_Table,i_OuterRows,i_FilterRows,m_GroupResult.RowIndicators,subGroupInfo); // } // //End Edit // } // } // #endregion //Modify at 2008-12-19 11:29:27@Simon // } public override void CalculateGroupResult(DataTable i_Table, Webb.Collections.Int32Collection i_OuterRows, Webb.Collections.Int32Collection i_FilterRows, Webb.Collections.Int32Collection i_InnerRows, GroupInfo i_GroupInfo) { i_GroupInfo.UpdateSectionSummaries(); //Modified at 2009-1-21 15:08:49@Scott this._Filter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this._Filter); //2009-4-29 11:37:37@Simon Add UpdateAdvFilter //Added this code at 2008-12-22 8:29:27@Simon #region Modified Area if (this._GroupResults == null) { this._GroupResults = new GroupResultCollection(); } this._GroupResults.Clear(); i_InnerRows = this.Filter.GetFilteredRows(i_Table, i_InnerRows); //Added this code at 2008-12-24 8:26:50@Simon i_FilterRows = this.Filter.GetFilteredRows(i_Table, i_FilterRows); //Added this code at 2008-12-24 8:26:50@Simon if (this.SectionFilters.Count > 0) { if (this.AddTotal) { #region Add total GroupResult m_GroupResult = new GroupResult(); m_GroupResult.Filter = new Webb.Data.DBFilter(); m_GroupResult.GroupValue = this.TotalTitle; m_GroupResult.ParentGroupInfo = this; //Add at 2009-2-19 14:23:47@Simon m_GroupResult.ClickEvent = i_GroupInfo.ClickEvent; i_InnerRows.CopyTo(m_GroupResult.RowIndicators); this._GroupResults.Add(m_GroupResult); #endregion } int LimitCount = 0; foreach (SectionFilter m_Section in this.SectionFilters) { #region Add group Result if (this.TopCount > 0 && LimitCount >= this.TopCount) { break; //Added this code at 2009-2-9 9:36:32@Simon } GroupResult m_Result = new GroupResult(); m_Result.GroupValue = m_Section.FilterName; m_Result.Filter = m_Section.Filter; m_Result.ParentGroupInfo = this; m_Result.ClickEvent = i_GroupInfo.ClickEvent; m_Result.RowIndicators = new Int32Collection(); m_Result.ClickEvent = this.ClickEvent; //12-28-2007@Scott this._GroupResults.Add(m_Result); LimitCount++; #endregion } #region Calculate result Rows foreach (int row in i_InnerRows) { if (row < 0 || row >= i_Table.Rows.Count) { continue; } DataRow dataRow = i_Table.Rows[row]; foreach (GroupResult m_GroupResult in this.GroupResults) { if (m_GroupResult.Filter.CheckResultWithBracket(dataRow)) //Modified at 2009-2-16 16:38:31@Scott { if (m_GroupResult.Filter.PlayAfter && i_Table.Rows.Count > row + 1) { m_GroupResult.RowIndicators.Add(row + 1); } else { m_GroupResult.RowIndicators.Add(row); } } } } #endregion } else { GroupResult m_GroupResult = new GroupResult(); m_GroupResult.GroupValue = string.Empty; m_GroupResult.ParentGroupInfo = this; m_GroupResult.RowIndicators = new Int32Collection(); i_InnerRows.CopyTo(m_GroupResult.RowIndicators); m_GroupResult.ClickEvent = i_GroupInfo.ClickEvent; this._GroupResults.Add(m_GroupResult); } foreach (GroupResult m_GroupResult in this.GroupResults) { if (this.Summaries != null) { m_GroupResult.Summaries = this.Summaries.CopyStructure(); m_GroupResult.CalculateSummaryResult(i_Table, i_OuterRows, i_InnerRows); } } if (i_GroupInfo.SubGroupInfos.Count > 0) { foreach (GroupResult m_GroupResult in this._GroupResults) { if (m_GroupResult.RowIndicators == null) { continue; } m_GroupResult.SubGroupInfos = i_GroupInfo.SubGroupInfos.Copy(); for (int i = 0; i < m_GroupResult.SubGroupInfos.Count; i++) { GroupInfo resultGroupInfo = m_GroupResult.SubGroupInfos[i]; GroupInfo subGroupInfo = i_GroupInfo.SubGroupInfos[i]; resultGroupInfo.IsSectionOutSide = false; subGroupInfo.IsSectionOutSide = false; System.Diagnostics.Trace.Assert(resultGroupInfo != null && subGroupInfo != null, "Calculate Section Group Error"); resultGroupInfo.CalculateGroupResult(i_Table, i_OuterRows, i_FilterRows, m_GroupResult.RowIndicators, subGroupInfo); } //End Edit } } #endregion //Modify at 2008-12-19 11:29:27@Simon }
public override void CalculateGroupResult(DataTable i_Table, Webb.Collections.Int32Collection i_OuterRows, Webb.Collections.Int32Collection i_InnerRows, GroupInfo i_GroupInfo) { i_GroupInfo.UpdateSectionSummaries(); //Modified at 2009-1-21 15:08:49@Scott this._Filter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this._Filter); //2009-4-29 11:37:37@Simon Add UpdateAdvFilter #region Modified Area if (this._GroupResults == null) { this._GroupResults = new GroupResultCollection(); } this._GroupResults.Clear(); i_InnerRows = this.Filter.GetFilteredRows(i_Table, i_InnerRows); //Added this code at 2008-12-24 8:26:50@Simon if (this.SectionFilters.Count > 0) //modify this code at 2009-2-6 10:15:01@Simon { int LimitCount = 0; foreach (SectionFilter m_Section in this.SectionFilters) { if (this.TopCount > 0 && LimitCount >= this.TopCount) { break; //Added this code at 2009-2-9 9:36:32@Simon } GroupResult m_Result = new GroupResult(); m_Result.GroupValue = m_Section.FilterName; m_Result.Filter = m_Section.Filter.Copy(); m_Result.ParentGroupInfo = this; m_Result.ClickEvent = i_GroupInfo.ClickEvent; m_Result.CalculateRowIndicators(i_Table, i_InnerRows); if (m_Result.RowIndicators.Count == 0 && !this.ShowZero) { continue; } if (this.Summaries != null) { m_Result.Summaries = this.Summaries.CopyStructure(); m_Result.CalculateSummaryResult(i_Table, i_OuterRows, i_InnerRows); } this._GroupResults.Add(m_Result); LimitCount++; } } else { GroupResult m_GroupResult = new GroupResult(); m_GroupResult.GroupValue = string.Empty; m_GroupResult.ParentGroupInfo = this; m_GroupResult.RowIndicators = new Int32Collection(); i_InnerRows.CopyTo(m_GroupResult.RowIndicators); m_GroupResult.ClickEvent = i_GroupInfo.ClickEvent; this._GroupResults.Add(m_GroupResult); if (this.Summaries != null) { m_GroupResult.Summaries = this.Summaries.CopyStructure(); m_GroupResult.CalculateSummaryResult(i_Table, i_OuterRows, i_InnerRows); } } if (i_GroupInfo.SubGroupInfos.Count > 0) { foreach (GroupResult m_GroupResult in this._GroupResults) { if (m_GroupResult.RowIndicators == null) { continue; } m_GroupResult.SubGroupInfos = i_GroupInfo.SubGroupInfos.Copy(); for (int i = 0; i < m_GroupResult.SubGroupInfos.Count; i++) { GroupInfo resultGroupInfo = m_GroupResult.SubGroupInfos[i]; GroupInfo subGroupInfo = i_GroupInfo.SubGroupInfos[i]; resultGroupInfo.IsSectionOutSide = false; subGroupInfo.IsSectionOutSide = false; System.Diagnostics.Trace.Assert(resultGroupInfo != null && subGroupInfo != null, "Calculate Section Group Error"); resultGroupInfo.CalculateGroupResult(i_Table, i_OuterRows, m_GroupResult.RowIndicators, subGroupInfo); } } } #endregion //Modify at 2008-11-4 11:29:27@Scott }