// public static List <ConceptSchemeSummary> Search(MainSearchInput data, ref int totalRows) { string where = ""; List <string> messages = new List <string>(); List <string> competencies = new List <string>(); //int userId = 0; //AppUser user = AccountServices.GetCurrentUser(); //if ( user != null && user.Id > 0 ) // userId = user.Id; //only target records with a ctid where = " (len(Isnull(base.Ctid,'')) = 39) "; SetKeywordFilter(data.Keywords, false, ref where); //SearchServices.SetLanguageFilter( data, CodesManager.ENTITY_TYPE_CONCEPT_SCHEME, ref where ); //// //SearchServices.SetAuthorizationFilter( user, "ConceptScheme_Summary", ref where ); //SearchServices.HandleCustomFilters( data, 60, ref where ); // //can this be replaced by following SearchServices.SetRolesFilter(data, ref where); //owned/offered //SearchServices.SetOrgRolesFilter( data, 3, ref where ); //probably N/A SearchServices.SetBoundariesFilter(data, ref where); LoggingHelper.DoTrace(5, "ConceptSchemeServices.Search(). Filter: " + where); return(Manager.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows)); }
/// <summary> /// Main search /// </summary> /// <param name="data"></param> /// <param name="pTotalRows"></param> /// <returns></returns> public static List <OrganizationSummary> DoSearch(MainSearchInput data, ref int pTotalRows) { string where = ""; int userId = 0; AppUser user = AccountServices.GetCurrentUser(); if (user != null && user.Id > 0) { userId = user.Id; } //only target full entities where = " ( base.EntityStateId = 3 ) "; SetKeywordFilter(data.Keywords, true, ref where); //SetAuthorizationFilter( user, ref where ); SearchServices.HandleCustomFilters(data, 59, ref where); SetPropertiesFilter(data, ref where); SearchServices.SetRolesFilter(data, ref where); SetBoundariesFilter(data, ref where); SetFrameworksFilter(data, ref where); SetOrgServicesFilter(data, ref where); //check for org category (credentially, or QA). Only valid if one item //SetOrgCategoryFilter( data, ref where ); //Not updated - I'm not sure we're still using this. - NA 5/12/2017 LoggingHelper.DoTrace(5, thisClassName + ".Search(). Filter: " + where); return(EntityMgr.MainSearch(where, data.SortOrder, data.StartPage, data.PageSize, ref pTotalRows)); }
public static List <ThisEntity> DoSearch(MainSearchInput data, ref int totalRows) { string where = ""; List <string> competencies = new List <string>(); //only target full entities where = " ( base.EntityStateId = 3 ) "; SearchServices.HandleCustomFilters(data, 61, ref where); SetKeywordFilter(data.Keywords, false, ref where); SearchServices.SetSubjectsFilter(data, CodesManager.ENTITY_TYPE_LEARNING_OPP_PROFILE, ref where); SetPropertiesFilter(data, ref where); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); //SetBoundariesFilter( data, ref where ); //CIP SetFrameworksFilter(data, ref where); //Competencies SetCompetenciesFilter(data, ref where, ref competencies); LoggingHelper.DoTrace(5, "LearningOpportunityServices.Search(). Filter: " + where); return(EntityMgr.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows, ref competencies)); }
public static List <ThisEntity> DoSearch(MainSearchInput data, ref int totalRows) { string where = ""; List <string> competencies = new List <string>(); int userId = 0; AppUser user = AccountServices.GetCurrentUser(); if (user != null && user.Id > 0) { userId = user.Id; } //only target full entities where = " ( base.EntityStateId = 3 ) "; SetKeywordFilter(data.Keywords, false, ref where); SearchServices.SetSubjectsFilter(data, CodesManager.ENTITY_TYPE_ASSESSMENT_PROFILE, ref where); SearchServices.HandleCustomFilters(data, 60, ref where); SetPropertiesFilter(data, ref where); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); //CIP SetFrameworksFilter(data, ref where); //Competencies SetCompetenciesFilter(data, ref where, ref competencies); LoggingHelper.DoTrace(5, "AssessmentServices.Search(). Filter: " + where); return(EntityMgr.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows)); }
} // public static List <PathwaySetSummary> DoPathwaySetSearch(MainSearchInput data, ref int totalRows) { string where = ""; //only target full entities where = " ( base.EntityStateId = 3 ) "; //need to create a new category id for custom filters //SearchServices.HandleCustomFilters( data, 61, ref where ); SetKeywordFilter(data.Keywords, false, ref where); SearchServices.SetSubjectsFilter(data, CodesManager.ENTITY_TYPE_PATHWAY, ref where); //SetPropertiesFilter( data, ref where ); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); LoggingHelper.DoTrace(5, "PathwayServices.DoPathwaySetSearch(). Filter: " + where); return(PathwaySetManager.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows)); }
} // public static List <ThisEntity> DoSearch(MainSearchInput data, ref int totalRows) { string where = ""; List <string> competencies = new List <string>(); //only target full entities where = " ( base.EntityStateId = 3 ) "; //need to create a new category id for custom filters //SearchServices.HandleCustomFilters( data, 61, ref where ); SetKeywordFilter(data.Keywords, false, ref where); //SearchServices.SetSubjectsFilter( data, CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE, ref where ); //SetPropertiesFilter( data, ref where ); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); //Competencies //SetCompetenciesFilter( data, ref where, ref competencies ); LoggingHelper.DoTrace(5, "TransferValueServices.Search(). Filter: " + where); return(EntityMgr.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows)); }
/// <summary> /// Full credentials search /// </summary> /// <param name="data"></param> /// <param name="pTotalRows"></param> /// <returns></returns> public static List <ThisSearchEntity> DoSearch(MainSearchInput data, ref int pTotalRows) { string where = ""; DateTime start = DateTime.Now; //Stopwatch stopwatch = new Stopwatch(); //stopwatch.Start(); LoggingHelper.DoTrace(6, string.Format("===CredentialServices.Search === Started: {0}", start)); int userId = 0; List <string> competencies = new List <string>(); AppUser user = AccountServices.GetCurrentUser(); if (user != null && user.Id > 0) { userId = user.Id; } //only target full entities where = " ( base.EntityStateId = 3 ) "; SetKeywordFilter(data.Keywords, false, ref where); where = where.Replace("[USERID]", user.Id.ToString()); SearchServices.SetSubjectsFilter(data, CodesManager.ENTITY_TYPE_CREDENTIAL, ref where); SearchServices.HandleCustomFilters(data, 58, ref where); //Should probably move this to its own method? string agentRoleTemplate = " ( id in (SELECT [CredentialId] FROM [dbo].[CredentialAgentRelationships_Summary] where RelationshipTypeId = {0} and OrgId = {1})) "; int roleId = 0; int orgId = 0; string AND = ""; if (where.Length > 0) { AND = " AND "; } //Updated to use FilterV2 foreach (var filter in data.FiltersV2.Where(m => m.Name == "qualityAssuranceBy").ToList()) { roleId = filter.GetValueOrDefault("RoleId", 0); orgId = filter.GetValueOrDefault("AgentId", 0); where = where + AND + string.Format(agentRoleTemplate, roleId, orgId); AND = " AND "; } /* //Retained for reference * foreach ( MainSearchFilter filter in data.Filters.Where( s => s.Name == "qualityAssuranceBy" ) ) * { * if ( filter.Data.ContainsKey( "RoleId" ) ) * roleId = (int)filter.Data[ "RoleId" ]; * if ( filter.Data.ContainsKey( "AgentId" ) ) * orgId = ( int ) filter.Data[ "AgentId" ]; * where = where + AND + string.Format( agentRoleTemplate, roleId, orgId ); * } */ SetPropertiesFilter(data, ref where); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); //need to fix rowId //naics, ONET SetFrameworksFilter(data, ref where); //Competencies SetCompetenciesFilter(data, ref where, ref competencies); SetCredCategoryFilter(data, ref where); //Not updated for FiltersV2 - I don't think we're using this anymore - NA 5/11/2017 SetConnectionsFilter(data, ref where); TimeSpan timeDifference = start.Subtract(DateTime.Now); LoggingHelper.DoTrace(5, thisClassName + string.Format(".Search(). Filter: {0}, elapsed: {1} ", where, timeDifference.TotalSeconds)); List <ThisSearchEntity> list = EntityMgr.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref pTotalRows); //stopwatch.Stop(); timeDifference = start.Subtract(DateTime.Now); LoggingHelper.DoTrace(6, string.Format("===CredentialServices.Search === Ended: {0}, Elapsed: {1}, Filter: {2}", DateTime.Now, timeDifference.TotalSeconds, where)); return(list); }