private static IEnumerable <Guid> GetAllJobAdSearchExecutionIds(IDbConnectionFactory connectionFactory) { using (var dc = new JobAdsDataContext(connectionFactory.CreateConnection())) { return((from s in dc.JobSearchEntities select s.id).ToList()); } }
private static void DeleteCriteria(JobAdsDataContext dc, SavedJobSearchEntity entity) { if (entity.JobSearchCriteriaSetEntity != null) { // Need to check that there are no other searches or executions that are using this criteria. if (!IsCriteriaOwnedByOtherSearch(dc, entity.JobSearchCriteriaSetEntity.id, entity.id) && !IsCriteriaOwnedByExecution(dc, entity.JobSearchCriteriaSetEntity.id)) { dc.JobSearchCriteriaEntities.DeleteAllOnSubmit(entity.JobSearchCriteriaSetEntity.JobSearchCriteriaEntities); dc.JobSearchCriteriaSetEntities.DeleteOnSubmit(entity.JobSearchCriteriaSetEntity); } } }
private static Guid CreateSavedJobAdSearch(string type, ICollection <KeyValuePair <string, string> > criteria) { var id = Guid.NewGuid(); using (var dc = new JobAdsDataContext(CreateDbConnectionFactory(false).CreateConnection())) { var entity = new SavedJobSearchEntity { id = id, displayText = string.Empty, JobSearchCriteriaSetEntity = new JobSearchCriteriaSetEntity { id = Guid.NewGuid(), type = type, JobSearchCriteriaEntities = CreateJobSearchCriteria(criteria), }, }; dc.SavedJobSearchEntities.InsertOnSubmit(entity); dc.SubmitChanges(); } return(id); }
private IEnumerable <JobAdSearchExecution> GetJobAdSearchExecutions(JobAdsDataContext dc, Guid ownerId, int maxResults) { dc.LoadOptions = ExecutionLoadOptions; return(GetMaxJobAdSearchExecutionsQuery(dc, ownerId, maxResults, _criteriaPersister)); }
private IEnumerable <JobAdSearchExecution> GetJobAdSearchExecutions(JobAdsDataContext dc, Guid ownerId, DateTimeRange range) { dc.LoadOptions = ExecutionLoadOptions; return(GetJobAdSearchExecutionsQuery(dc, ownerId, range, _criteriaPersister)); }
private JobAdSearchExecution GetJobAdSearchExecution(JobAdsDataContext dc, Guid id) { dc.LoadOptions = ExecutionLoadOptions; return(GetJobAdSearchExecutionQuery(dc, id, _criteriaPersister)); }
private IEnumerable <JobAdSearch> GetJobAdSearches(JobAdsDataContext dc, Guid ownerId) { dc.LoadOptions = SearchLoadOptions; return(GetJobAdSearchesQuery(dc, ownerId, _criteriaPersister)); }
private JobAdSearch GetJobAdSearch(JobAdsDataContext dc, Guid id) { dc.LoadOptions = SearchLoadOptions; return(GetJobAdSearchQuery(dc, id, _criteriaPersister)); }
private static SavedJobSearchEntity GetSavedJobSearchEntity(JobAdsDataContext dc, Guid id) { dc.LoadOptions = SearchLoadOptions; return(GetSavedJobSearchEntityQuery(dc, id)); }