Esempio n. 1
0
        public string GenerateQueryCount(EntityMetadata metadata, SearchRequestDto searchDTO)
        {
            var externalTemplateIds = _changeWhereClauseProvider.GetTemplateIds();
            var user = SecurityFacade.CurrentUser();
            var personGroupsForQuery = user.GetPersonGroupsForQuery();
            var filterQueryMain      = GetFilterQuery("wochange", searchDTO);

            var parameters = searchDTO.GetParameters();

            var extraUnions = NonTicketCountUnions.Fmt(getMainQueryExcludingTicketId(searchDTO), personGroupsForQuery);

            if (parameters != null && parameters.ContainsKey("hlagchangeticketid") && parameters.Count == 1)
            {
                extraUnions = "";
            }

            var filterQuerySecondary = GetFilterQuery("srforchange", searchDTO.unionDTO);

            return(BaseCountQuery.Fmt(externalTemplateIds, personGroupsForQuery, filterQueryMain, filterQuerySecondary, extraUnions, user.MaximoPersonId));
        }