Beispiel #1
0
        private static void CheckDeleteLocation(JobAdsDataContext dc, JobAd jobAd, IHaveDescriptionEntity entity)
        {
            var entityLocations = Locations(entity);

            if (entityLocations == 0)
            {
                return;
            }

            var locations = Locations(jobAd);

            // There were locations but they have now been removed.

            if (locations == 0)
            {
                DeleteLocations(dc, entity);
            }

            // There were locations but there is now a different number of them.
            // (shouldn't happen, only one location per job ad is allowed but just in case ...)

            if (locations > 0 && entityLocations != locations)
            {
                DeleteLocations(dc, entity);
            }
        }
Beispiel #2
0
        private static void DeleteIndustries(JobAdsDataContext dc, IHaveDescriptionEntity entity)
        {
            // Cannot update in place so delete whatever is already there.

            if (entity.JobAdIndustryEntities != null && entity.JobAdIndustryEntities.Count > 0)
            {
                dc.JobAdIndustryEntities.DeleteAllOnSubmit(entity.JobAdIndustryEntities);
            }
        }
Beispiel #3
0
 private static IEnumerable <Guid> GetRecentOpenJobAdIds(JobAdsDataContext dc, Range range)
 {
     if (range.Skip == 0)
     {
         return(range.Take != null
             ? GetRecentOpenJobAdIdsTakeQuery(dc, range)
             : GetRecentOpenJobAdIdsQuery(dc));
     }
     return(range.Take != null
         ? GetRecentOpenJobAdIdsSkipTakeQuery(dc, range)
         : GetRecentOpenJobAdIdsSkipQuery(dc, range));
 }
Beispiel #4
0
 private static void DeleteLocations(JobAdsDataContext dc, IHaveDescriptionEntity entity)
 {
     dc.LocationReferenceEntities.DeleteAllOnSubmit(from e in entity.JobAdLocationEntities select e.LocationReferenceEntity);
     dc.JobAdLocationEntities.DeleteAllOnSubmit(entity.JobAdLocationEntities);
     entity.JobAdLocationEntities.Clear();
 }
Beispiel #5
0
 private IQueryable <JobAd> GetJobAds(JobAdsDataContext dc, IEnumerable <Guid> ids)
 {
     dc.LoadOptions = JobAdLoadOptions;
     return(GetJobAdsQuery(dc, new SplitList <Guid>(ids).ToString(), _commands));
 }
Beispiel #6
0
 private static IQueryable <JobAdEntry> GetJobAdEntries(JobAdsDataContext dc, IEnumerable <Guid> ids)
 {
     dc.LoadOptions = JobAdEntryLoadOptions;
     return(GetJobAdEntriesQuery(dc, new SplitList <Guid>(ids).ToString()));
 }
Beispiel #7
0
 private JobAd GetJobAd(JobAdsDataContext dc, Guid id)
 {
     dc.LoadOptions = JobAdLoadOptions;
     return(GetJobAdQuery(dc, id, _commands));
 }
Beispiel #8
0
 private static JobAdEntry GetJobAdEntry(JobAdsDataContext dc, Guid id)
 {
     dc.LoadOptions = JobAdEntryLoadOptions;
     return(GetJobAdEntryQuery(dc, id));
 }