private void PrepareGroupFetchingProcessSimple(FilterInterpritationResult filterCriteriaProcessingResult, SortInfoInterpritationResult groupSortInfoProcessingResult, PropertiesCollectionProcessingResult groupPropertiesProcessingResult, SummaryInterpritationResult groupSummaryProcessingResult) { var groupQueryJOINSection = JoinProcessor.PrepareSimpleJoinSection( filterCriteriaProcessingResult.UsedJOINS, groupSortInfoProcessingResult.UsedJOINS, groupPropertiesProcessingResult.UsedJOINS, groupSummaryProcessingResult.UsedJOINS ); var queryWHERESection = filterCriteriaProcessingResult.ResultString.IsNotEmpty() ? "WHERE " + filterCriteriaProcessingResult.ResultString : string.Empty; var groupQueryORDERBYSection = groupSortInfoProcessingResult.ResultString.IsNotEmpty() ? "ORDER BY " + groupSortInfoProcessingResult.ResultString : string.Empty; SetGROUPQueryInfo( FillTemplatePlaceholders( ("SELECT [PROPERTIES], [SUMMARIES] FROM [SOURCETYPE] [BASEALIAS] " + "[QUERY JOIN SECTION]" + "[QUERY WHERE SECTION]" + "GROUP BY [PROPERTIES] " + "[QUERY ORDERBY SECTION]") .Replace("[QUERY JOIN SECTION]", groupQueryJOINSection.Add(" ")) .Replace("[QUERY WHERE SECTION]", queryWHERESection.Add(" ")) .Replace("[QUERY ORDERBY SECTION]", groupQueryORDERBYSection.Add(" ")) .Replace("[PROPERTIES]", groupPropertiesProcessingResult.ResultString) .Replace("[SUMMARIES]", groupSummaryProcessingResult.ResultString) ), string.Empty, groupPropertiesProcessingResult.PropertyExpressions, groupSummaryProcessingResult.SummaryDescriptors ); }
protected override void PrepareForFetchingProcess() { var filterCriteriaProcessingResult = JoinProcessor.Process(FilterCriteriaProcessor.Process(FilterCriteria)); var baseSortInfoProcessingResult = JoinProcessor.Process(SortInfoProcessor.Process(SortInfo)); var selectQueryJOINSection = JoinProcessor.PrepareJoinSection(filterCriteriaProcessingResult.UsedJOINS, baseSortInfoProcessingResult.UsedJOINS); var queryWHERESection = filterCriteriaProcessingResult.ResultString.IsNotEmpty() ? "WHERE " + filterCriteriaProcessingResult.ResultString : string.Empty; var queryORDERBYSection = baseSortInfoProcessingResult.ResultString.IsNotEmpty() ? "ORDER BY " + baseSortInfoProcessingResult.ResultString : string.Empty; var queryPARAMETERS = filterCriteriaProcessingResult.Parameters; SetSELECTQuery( FillTemplatePlaceholders( ("SELECT [BASEALIAS] FROM [SOURCETYPE] [BASEALIAS] " + "[QUERY JOIN SECTION]" + "[QUERY WHERE SECTION]" + "[QUERY ORDERBY SECTION]") .Replace("[QUERY JOIN SECTION]", selectQueryJOINSection.Add(" ")) .Replace("[QUERY WHERE SECTION]", queryWHERESection.Add(" ")) .Replace("[QUERY ORDERBY SECTION]", queryORDERBYSection.Add(" ")) ) ); if (GroupCount > 0) { var groupSortInfo = SortInfo.Take(GroupCount).ToList(); var groupSortInfoProcessingResult = JoinProcessor.Process(GroupSortInfoProcessor.Process(groupSortInfo)); var groupExpressions = groupSortInfo.Select(x => x.SortExpression).ToList(); var groupPropertiesProcessingResult = JoinProcessor.Process(GroupPropertiesProcessor.Process(groupExpressions)); var groupSummaryProcessingResult = JoinProcessor.Process(GroupSummaryProcessor.Process(GroupSummaryInfo)); if (SortInfoProcessor.HasSpecialMappingsFor(groupSortInfo)) { PrepareGroupFetchingProcessComplicated( filterCriteriaProcessingResult, groupSortInfoProcessingResult, groupPropertiesProcessingResult, groupSummaryProcessingResult ); } else { PrepareGroupFetchingProcessSimple( filterCriteriaProcessingResult, groupSortInfoProcessingResult, groupPropertiesProcessingResult, groupSummaryProcessingResult ); } } else { SetGROUPQueryInfo(null); } var totalSummaryProcessingResult = JoinProcessor.Process(TotalSummaryProcessor.Process(TotalSummaryInfo)); var totalQueryJOINSection = JoinProcessor.PrepareSimpleJoinSection( filterCriteriaProcessingResult.UsedJOINS, totalSummaryProcessingResult.UsedJOINS ); SetTOTALQueryInfo( FillTemplatePlaceholders( ("SELECT [SUMMARIES] FROM [SOURCETYPE] [BASEALIAS] " + "[QUERY JOIN SECTION]" + "[QUERY WHERE SECTION]") .Replace("[QUERY JOIN SECTION]", totalQueryJOINSection.Add(" ")) .Replace("[QUERY WHERE SECTION]", queryWHERESection.Add(" ")) .Replace("[SUMMARIES]", totalSummaryProcessingResult.ResultString) ), totalSummaryProcessingResult.SummaryDescriptors ); SetQueryPARAMETERS(queryPARAMETERS); }