public virtual void AddSchedule(IScheduleChecker pValidator, Schedule pInterval) { if (pInterval == null) { throw new EntidadNulaException("El intervalo de fechas indicado es nulo"); } else if (!pValidator.CanAddSchedule(this, pInterval)) { throw new IntervaloFechaInvalidoException("El intervalo de fechas indicado no puede ser agregado al Banner debido a que se superpone con un intervalo existente"); } else { this.ActivePeriods.Add(pInterval); //TODO excepción si no es valido por interseccion, si es intervalo nulo. irian arriba } }
public Campaign Convert(CampaignDTO source, Campaign destination, ResolutionContext context) { if (source == null) { return(null); } try { destination = destination ?? new Campaign(); destination.Id = source.Id; destination.LastModified = DateTimeResolver.Resolve(source.ModificationDate); destination.CreationDate = DateTimeResolver.Resolve(source.CreationDate); destination.Name = source.Name; destination.Description = source.Description; IScheduleChecker lScheduleChecker = DomainServiceLocator.Resolve <IScheduleChecker>(); foreach (var item in source.ActiveIntervals) { destination.AddSchedule(lScheduleChecker, Mapper.Map <Schedule>(item)); } //foreach (var item in source.Slides) //{ // destination.AddSlide( // Mapper.Map<SlideDTO, Slide>(item) // ); //} return(destination); } catch (Exception) { throw; } }
public bool IsActiveAt(IScheduleChecker pValidator, DateTime pDate) { return(pValidator.IsActiveAt(this, pDate)); }
public bool IsActiveAt(IScheduleChecker pValidator, DateTime pDate) { return pValidator.IsActiveAt(this, pDate); }
public CampaignService(ILog pLogger, IRepository <Campaign> pRepo, IScheduleService pScheService, IScheduleChecker pCheckService) : base(pLogger) { this.iRepo = pRepo; this.iSchServ = pScheService; this.iSchChecker = pCheckService; }