Ejemplo n.º 1
0
        public EventSearchResult Build(InfiniteFeelAnalyticsItem item, EventCategoryQueryResult ParentCategory)
        {
            try
            {
                UpdateInfiniteFeelAnalyticsItem(item);

                var parentCategory = ParentCategory.EventCategories.Where(w => w.Category == item.Category).FirstOrDefault();

                //Logic to check if parentCategory variable is null or not [Sentry error handling NullReferenceException]
                int parentId = -1;
                if (parentCategory != null)
                {
                    parentId = parentCategory.EventCategoryId;
                }

                var parent = ParentCategory.EventCategories.Where(w => w.Id == parentId).FirstOrDefault();
                if (parent != null)
                {
                    EventSearchResult _EventSearchResult = new EventSearchResult
                    {
                        AltId          = new Guid(item.DeDuplicator), // DeDuplicator returning the altIds
                        Name           = item.Name,
                        ParentCategory = parent.Category,
                        CityName       = item.City,
                        CountryName    = item.Country,
                        RedirectUrl    = item.Url
                    };
                    return(_EventSearchResult);
                }
                else
                {
                    EventSearchResult _EventSearchResult = new EventSearchResult
                    {
                        AltId          = new Guid(item.DeDuplicator), // DeDuplicator returning the altIds
                        Name           = item.Name,
                        ParentCategory = "SeeAndDo",
                        CityName       = item.City,
                        CountryName    = item.Country,
                        RedirectUrl    = item.Url
                    };
                    return(_EventSearchResult);
                }
            }
            catch (Exception ex)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, ex);
                UpdateInfiniteFeelAnalyticsItem(item);
                EventSearchResult _EventSearchResult = new EventSearchResult
                {
                    AltId          = new Guid(item.DeDuplicator), // DeDuplicator returning the altIds
                    Name           = item.Name,
                    ParentCategory = "SeeAndDo",
                    CityName       = item.City,
                    CountryName    = item.Country,
                    RedirectUrl    = item.Url
                };

                return(_EventSearchResult);
            }
        }
Ejemplo n.º 2
0
 void UpdateInfiniteFeelAnalyticsItem(InfiniteFeelAnalyticsItem item)
 {
     //dont do anything if already contains geo sites for dev or prod
     if (!item.Url.ToLower().Contains("feelitlive.co.uk") && !item.Url.ToLower().Contains("feelitlive.co.in") && !item.Url.ToLower().Contains("feelitlive.com.au") && !item.Url.ToLower().Contains("feelitlive.de") && !item.Url.ToLower().Contains("feelitlive.es") && !item.Url.ToLower().Contains("feelitlive.fr") && !item.Url.ToLower().Contains("feelitlive.co.nz"))
     {
         //else do the geo changes
         if (item.Url.ToLower().Contains("dev.feelitlive.com"))
         {
             item.Url = item.Url.ToLower().Replace("dev.feelitlive.com", GetBaseUrl());
         }
         else if (item.Url.ToLower().Contains("www.feelitlive.com"))
         {
             item.Url = item.Url.ToLower().Replace("www.feelitlive.com", GetBaseUrl());
         }
         else if (item.Url.ToLower().Contains("feelitlive.com"))
         {
             item.Url = item.Url.ToLower().Replace("feelitlive.com", GetBaseUrl());
         }
         //do a localhost test to see all works.
         if (GetBaseUrl().ToLower().Contains("localhost") || GetBaseUrl().ToLower().Contains("dev.feelitlive.com"))
         {
             //manually removing www. as we dont need it in localhost
             item.Url = item.Url.ToLower().Replace("www.", string.Empty);
         }
     }
 }