Ejemplo n.º 1
0
        private JobAdEntry PostRefreshJobAd(IEmployer employer, DateTime createdTime, DateTime?lastRefreshTime)
        {
            var jobAd = employer.CreateTestJobAd(BusinessAnalyst);

            jobAd.CreatedTime = createdTime;
            jobAd.Features    = lastRefreshTime == null ? JobAdFeatures.None : JobAdFeatures.Refresh;
            _jobAdsCommand.PostJobAd(jobAd);
            if (lastRefreshTime != null)
            {
                _jobAdsRepository.UpdateRefresh(jobAd.Id, lastRefreshTime.Value);
            }
            return(jobAd);
        }
Ejemplo n.º 2
0
        void IJobAdsCommand.RefreshJobAd(JobAdEntry jobAd)
        {
            if (!CanBeRefreshed(jobAd))
            {
                throw new InvalidOperationException(string.Format("Cannot refresh the '{0}' job ad.", jobAd.Id));
            }

            _repository.UpdateRefresh(jobAd.Id, DateTime.Now);

            jobAd.LastUpdatedTime = DateTime.Now;
            _repository.UpdateJobAd(jobAd);

            // Fire events.

            var handlers = JobAdUpdated;

            if (handlers != null)
            {
                handlers(this, new JobAdEventArgs(jobAd.Id));
            }
        }