Esempio n. 1
0
        public static void SetDirectUrl(ObjectContext context, EventV2 source, Event theEvent)
        {
            //theEvent.DirectUrl is a Cleaned SEO string, do the same for the source directUrl
            var cleanedSourceDirectUrl = StringUtils.CleanupSeoString(source.DirectUrl);

            if (source.DirectUrl == null || string.Compare(theEvent.DirectUrl, cleanedSourceDirectUrl, CultureInfo.CurrentUICulture, CompareOptions.OrdinalIgnoreCase) == 0)
                return;

            theEvent.SetDirectUrl(source.DirectUrl);

            var eventsCheck = context.CreateObjectSet<Event>().Any(e => e.DirectUrl == theEvent.DirectUrl);

            if (eventsCheck)
            {
                throw new BusinessException("There is already an event with the DirectUrl of " + source.DirectUrl);
            }
        }
Esempio n. 2
0
 public void TestSetDirectUrl_tooLong()
 {
     var anEvent = new Event();
     anEvent.SetDirectUrl(new string('X', 256));
 }