Example #1
0
        void IJobAdsRepository.ChangeStatus(Guid jobAdId, JobAdStatus newStatus, DateTime?newExpiryTime, DateTime time)
        {
            using (var dc = CreateContext())
            {
                // Update the status on the job ad itself.

                var entity         = GetJobAdEntity(dc, jobAdId);
                var previousStatus = entity.status;
                entity.status          = (byte)newStatus;
                entity.lastUpdatedTime = time;

                if (newExpiryTime != null)
                {
                    entity.expiryTime = newExpiryTime.Value;
                }

                // Record the change.

                var change = new JobAdStatusChange
                {
                    Id             = Guid.NewGuid(),
                    Time           = time,
                    PreviousStatus = (JobAdStatus)previousStatus,
                    NewStatus      = newStatus
                };
                dc.JobAdStatusEntities.InsertOnSubmit(change.Map(jobAdId));

                dc.SubmitChanges();
            }
        }
Example #2
0
        public static JobAdStatusEntity Map(this JobAdStatusChange change, Guid jobAdId)
        {
            var entity = new JobAdStatusEntity
            {
                id      = change.Id,
                jobAdId = jobAdId,
            };

            change.MapTo(entity);
            return(entity);
        }
Example #3
0
 void IJobAdsRepository.UpdateStatusChange(JobAdStatusChange change)
 {
     using (var dc = CreateContext())
     {
         var entity = GetJobAdStatusEntity(dc, change.Id);
         if (entity != null)
         {
             change.MapTo(entity);
             dc.SubmitChanges();
         }
     }
 }
Example #4
0
 void IJobAdsRepository.UpdateStatusChange(JobAdStatusChange change)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public static void MapTo(this JobAdStatusChange change, JobAdStatusEntity entity)
 {
     entity.previousStatus = (byte)change.PreviousStatus;
     entity.newStatus      = (byte)change.NewStatus;
     entity.time           = change.Time;
 }