Exemple #1
0
        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
            }
        }
Exemple #2
0
        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
            }
        }
Exemple #3
0
            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;
                }
            }
Exemple #4
0
 public bool IsActiveAt(IScheduleChecker pValidator, DateTime pDate)
 {
     return(pValidator.IsActiveAt(this, pDate));
 }
Exemple #5
0
 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;
 }