示例#1
0
 private static IEnumerable <Guid> GetAllJobAdSearchExecutionIds(IDbConnectionFactory connectionFactory)
 {
     using (var dc = new JobAdsDataContext(connectionFactory.CreateConnection()))
     {
         return((from s in dc.JobSearchEntities
                 select s.id).ToList());
     }
 }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
 private IEnumerable <JobAdSearchExecution> GetJobAdSearchExecutions(JobAdsDataContext dc, Guid ownerId, int maxResults)
 {
     dc.LoadOptions = ExecutionLoadOptions;
     return(GetMaxJobAdSearchExecutionsQuery(dc, ownerId, maxResults, _criteriaPersister));
 }
示例#5
0
 private IEnumerable <JobAdSearchExecution> GetJobAdSearchExecutions(JobAdsDataContext dc, Guid ownerId, DateTimeRange range)
 {
     dc.LoadOptions = ExecutionLoadOptions;
     return(GetJobAdSearchExecutionsQuery(dc, ownerId, range, _criteriaPersister));
 }
示例#6
0
 private JobAdSearchExecution GetJobAdSearchExecution(JobAdsDataContext dc, Guid id)
 {
     dc.LoadOptions = ExecutionLoadOptions;
     return(GetJobAdSearchExecutionQuery(dc, id, _criteriaPersister));
 }
示例#7
0
 private IEnumerable <JobAdSearch> GetJobAdSearches(JobAdsDataContext dc, Guid ownerId)
 {
     dc.LoadOptions = SearchLoadOptions;
     return(GetJobAdSearchesQuery(dc, ownerId, _criteriaPersister));
 }
示例#8
0
 private JobAdSearch GetJobAdSearch(JobAdsDataContext dc, Guid id)
 {
     dc.LoadOptions = SearchLoadOptions;
     return(GetJobAdSearchQuery(dc, id, _criteriaPersister));
 }
示例#9
0
 private static SavedJobSearchEntity GetSavedJobSearchEntity(JobAdsDataContext dc, Guid id)
 {
     dc.LoadOptions = SearchLoadOptions;
     return(GetSavedJobSearchEntityQuery(dc, id));
 }