Exemplo n.º 1
0
 public EventCategoryQueryResult Handle(EventCategoryQuery query)
 {
     if (query.Id == 0)
     {
         if (!string.IsNullOrWhiteSpace(query.Slug))
         {
             var eventResult = _eventCategoryRepository.GetBySlug(query.Slug);
             List<FIL.Contracts.Models.EventCategory> EventCategories = new List<Contracts.Models.EventCategory>();
             EventCategories.Add(AutoMapper.Mapper.Map<FIL.Contracts.Models.EventCategory>(eventResult));
             return new EventCategoryQueryResult
             {
                 EventCategories = EventCategories
             };
         }
         else
         {
             var eventResult = _eventCategoryRepository.GetActiveEventCategory().OrderBy(o => o.Order);
             return new EventCategoryQueryResult
             {
                 EventCategories = AutoMapper.Mapper.Map<List<FIL.Contracts.Models.EventCategory>>(eventResult)
             };
         }
     }
     else
     {
         var eventResult = _eventCategoryRepository.Get(query.Id);
         List<FIL.Contracts.Models.EventCategory> EventCategories = new List<Contracts.Models.EventCategory>();
         EventCategories.Add(AutoMapper.Mapper.Map<FIL.Contracts.Models.EventCategory>(eventResult));
         return new EventCategoryQueryResult
         {
             EventCategories = EventCategories
         };
     }
 }
Exemplo n.º 2
0
        public WebEventLearnPageQueryResults Handle(EventLearnPageQuery query)
        {
            var eventDataModel = _eventRepository.GetByAltId(query.EventAltId);
            var eventModel     = AutoMapper.Mapper.Map <Contracts.Models.Event>(eventDataModel);

            if (eventModel != null)
            {
                var eventDetailDataModel = _eventDetailRepository.GetAllByEventId(eventDataModel.Id);
                var eventDetailModel     = AutoMapper.Mapper.Map <List <Contracts.Models.EventDetail> >(eventDetailDataModel);

                var venueDataModel = _venueRepository.GetByVenueIds(eventDetailDataModel.Select(s => s.VenueId).Distinct());
                var venueModel     = AutoMapper.Mapper.Map <List <Contracts.Models.Venue> >(venueDataModel);

                var cityDataModel = _cityRepository.GetByCityIds(venueDataModel.Select(s => s.CityId));
                var cityModel     = AutoMapper.Mapper.Map <List <Contracts.Models.City> >(cityDataModel);

                var stateDataModel = _stateRepository.GetByStateIds(cityDataModel.Select(s => s.StateId));
                var stateModel     = AutoMapper.Mapper.Map <List <Contracts.Models.State> >(stateDataModel);

                var countryDataModel = _countryRepository.GetByCountryIds(stateDataModel.Select(s => s.CountryId));
                var countryModel     = AutoMapper.Mapper.Map <List <Contracts.Models.Country> >(countryDataModel);

                var eventGallaryDataModel = _eventGalleryImageRepository.GetByEventId(eventModel.Id);
                var galleryDataModel      = AutoMapper.Mapper.Map <List <Contracts.Models.EventGalleryImage> >(eventGallaryDataModel);

                var ratingDataModel = _ratingRepository.GetByEventId(eventDataModel.Id);
                var ratingModel     = AutoMapper.Mapper.Map <List <Contracts.Models.Rating> >(ratingDataModel);

                var userdataModel = _userRepository.GetByUserIds(ratingModel.Select(s => s.UserId).Distinct());
                var userModel     = AutoMapper.Mapper.Map <List <Contracts.Models.UserProfile> >(userdataModel);

                var eventCategoryDataModel = _eventCategoryRepository.Get(eventModel.EventCategoryId);
                var eventCategoryModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryDataModel);

                return(new WebEventLearnPageQueryResults
                {
                    EventType = (EventType)eventModel.EventTypeId != 0 ? (EventType)eventModel.EventTypeId : EventType.Regular,
                    EventCategory = eventCategoryModel,
                    Event = eventModel,
                    EventDetail = eventDetailModel,
                    Venue = venueModel,
                    City = cityModel,
                    Rating = ratingModel,
                    User = userModel,
                    State = stateModel,
                    Country = countryModel,
                    EventGalleryImage = galleryDataModel
                });
            }
            else
            {
                return(new WebEventLearnPageQueryResults
                {
                });
            }
        }
Exemplo n.º 3
0
 public EventDetailsQueryResult Handle(EventDetailsQuery query)
 {
     try
     {
         var currentEvent = _eventRepository.Get(query.EventId);
         if (currentEvent == null)
         {
             return(new EventDetailsQueryResult {
                 Success = true
             });
         }
         currentEvent.MetaDetails = currentEvent.MetaDetails == "NA" ? null : currentEvent.MetaDetails;
         var eventCategoryMappings = _eventCategoryMappingRepository.GetByEvent(currentEvent.Id);
         var eventCategory         = _eventCategory.Get(eventCategoryMappings.EventCategoryId);
         var parentCategory        = _eventCategory.Get(eventCategory.EventCategoryId);
         FIL.Contracts.Models.CreateEventV1.EventDetailModel eventDetailModel = new FIL.Contracts.Models.CreateEventV1.EventDetailModel();
         eventDetailModel.EventId          = currentEvent.Id;
         eventDetailModel.EventCategories  = eventCategoryMappings.EventCategoryId.ToString();
         eventDetailModel.Slug             = currentEvent.Slug;
         eventDetailModel.Name             = currentEvent.Name;
         eventDetailModel.IsEnabled        = currentEvent.IsEnabled;
         eventDetailModel.AltId            = currentEvent.AltId;
         eventDetailModel.Description      = currentEvent.Description;
         eventDetailModel.DefaultCategory  = eventCategory.DisplayName;
         eventDetailModel.ItemsForViewer   = !String.IsNullOrEmpty(currentEvent.MetaDetails) ? currentEvent.MetaDetails.Split("|").ToList() : new List <string>();
         eventDetailModel.ParentCategory   = parentCategory.DisplayName;
         eventDetailModel.ParentCategoryId = parentCategory.Id;
         eventDetailModel.IsPrivate        = currentEvent.IsTokenize;
         return(new EventDetailsQueryResult
         {
             Success = true,
             IsValidLink = true,
             IsDraft = false,
             EventDetail = eventDetailModel
         });
     }
     catch (Exception e)
     {
         return(new EventDetailsQueryResult {
         });
     }
 }
Exemplo n.º 4
0
        public EventLearnPageQueryResults GetEventResult(Event eventDataModel)
        {
            var eventModel = AutoMapper.Mapper.Map <Contracts.Models.Event>(eventDataModel);

            var eventDetailDataModel = _eventDetailRepository.GetByEventId(eventDataModel.Id);
            var eventDetailModel     = AutoMapper.Mapper.Map <Contracts.Models.EventDetail>(eventDetailDataModel);

            if (eventDetailModel == null)
            {
                return(new EventLearnPageQueryResults {
                });
            }
            var venueDataModel = _venueRepository.Get(eventDetailDataModel.VenueId);
            var venueModel     = AutoMapper.Mapper.Map <Contracts.Models.Venue>(venueDataModel);

            var cityDataModel = _cityRepository.Get(venueDataModel.CityId);
            var cityModel     = AutoMapper.Mapper.Map <Contracts.Models.City>(cityDataModel);

            var stateDataModel = _stateRepository.Get(cityDataModel.StateId);
            var stateModel     = AutoMapper.Mapper.Map <Contracts.Models.State>(stateDataModel);

            var countryDataModel = _countryRepository.Get(stateDataModel.CountryId);
            var countryModel     = AutoMapper.Mapper.Map <Contracts.Models.Country>(countryDataModel);

            var eventGallaryDataModel = _eventGalleryImageRepository.GetByEventId(eventModel.Id);
            var galleryDataModel      = AutoMapper.Mapper.Map <List <Contracts.Models.EventGalleryImage> >(eventGallaryDataModel);

            //if (eventModel.EventSourceId == EventSource.ExperienceOz)
            //{
            var eventCategoryIds = new HashSet <int>(_eventCategoryMappingRepository.GetByEventId((int)eventModel.Id)
                                                     .Select(ce => ce.EventCategoryId));

            eventModel.EventCategoryId = (Int16)eventCategoryIds.FirstOrDefault();
            //}

            var eventCategoryDataModel = _eventCategoryRepository.Get(eventModel.EventCategoryId);
            var eventCategoryModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryDataModel);

            return(new EventLearnPageQueryResults
            {
                EventType = (EventType)eventModel.EventTypeId,
                EventCategory = eventCategoryModel,
                Event = eventModel,
                EventDetail = eventDetailModel,
                Venue = venueModel,
                City = cityModel,
                State = stateModel,
                Country = countryModel,
                EventGalleryImage = galleryDataModel
            });
        }
Exemplo n.º 5
0
        public FeelUserJourneyQueryResult Handle(FeelUserJourneyQuery query)
        {
            try
            {
                var isCategoryLevel     = query.CategoryId != 0;
                var isSubcategoryLevel  = query.SubCategoryId != 0;
                var isCountryLevel      = query.CountryId != 0;
                var isStateLevel        = query.StateId != 0;
                var isCityLevel         = query.CityId != 0;
                var isOnlineExperiences = false;
                var EventCategory       = query.MasterEventType == Contracts.Enums.MasterEventType.Online ? _eventCategory.GetAll().Where(s => s.MasterEventTypeId == Contracts.Enums.MasterEventType.Online).FirstOrDefault() : _eventCategory.Get(query.CategoryId);
                var allCategories       = new List <FIL.Contracts.DataModels.EventCategory>();
                if (EventCategory == null && query.PageType == Contracts.Enums.PageType.Category)
                {
                    return(new FeelUserJourneyQueryResult {
                    });
                }
                if (!isCountryLevel && query.PageType == Contracts.Enums.PageType.Country)
                {
                    return(new FeelUserJourneyQueryResult {
                    });
                }
                if (isCountryLevel && query.PageType == Contracts.Enums.PageType.Country)
                {
                    if (isCategoryLevel && query.CategoryId == 0) // If Global country/state/city page
                    {
                        isCategoryLevel = false;
                    }
                    if (isSubcategoryLevel && query.SubCategoryId == 0) // If Global country/state/city page
                    {
                        isSubcategoryLevel = false;
                    }
                    var country = _countryRepository.Get(query.CountryId);
                    if (country == null)
                    {
                        return(new FeelUserJourneyQueryResult {
                        });
                    }
                }
                var subCategories = _eventCategory.GetByEventCategoryId(query.CategoryId).Where(s => s.IsEnabled).ToList();
                if (query.MasterEventType == Contracts.Enums.MasterEventType.Online || query.MasterEventType == Contracts.Enums.MasterEventType.InRealLife)
                {
                    isOnlineExperiences = query.MasterEventType == Contracts.Enums.MasterEventType.Online ? true : false;
                    allCategories       = _eventCategory.GetAll().ToList();
                    var parentCategoryIds = allCategories.Where(s => s.MasterEventTypeId == query.MasterEventType).Select(s => s.Id);
                    subCategories = allCategories.Where(s => parentCategoryIds.Any(p => p == s.EventCategoryId)).ToList();
                }
                if (isSubcategoryLevel)
                {
                    subCategories = subCategories.Where(s => s.Id == query.SubCategoryId).ToList();
                }
                var firstEventCategory = _eventCategory.Get(subCategories.FirstOrDefault().EventCategoryId);
                if (firstEventCategory != null && (!isCountryLevel && !isStateLevel && !isCategoryLevel && !isCityLevel && !isSubcategoryLevel))
                {
                    isOnlineExperiences = firstEventCategory.MasterEventTypeId == Contracts.Enums.MasterEventType.Online ? true : false;
                }
                var placeDetails = _placeProvider.GetAllPlaces(query, subCategories, EventCategory, query.MasterEventType, isCountryLevel, isStateLevel, isCityLevel).Where(s => s.CurrencyId != 0 && !s.IsTokenize).ToList();
                if (!placeDetails.Any())
                {
                    return(new FeelUserJourneyQueryResult {
                    });
                }
                var pageDetail = new PageDetail
                {
                    PageType           = query.PageType,
                    PagePath           = query.PagePath,
                    IsCategoryLevel    = isCategoryLevel,
                    IsSubCategoryLevel = isSubcategoryLevel,
                    IsCountryLevel     = isCountryLevel,
                    IsStateLevel       = isStateLevel,
                    IsCityLevel        = isCityLevel
                };
                List <DynamicPlaceSections> DynamicPlaceSections = new List <DynamicPlaceSections>();
                CountryPageDetail           countryPageDetail    = new CountryPageDetail();
                DynamicPlaceSections        AllplaceTiles        = new DynamicPlaceSections();
                List <GeoLocation>          Cities           = new List <GeoLocation>();
                List <GeoLocation>          States           = new List <GeoLocation>();
                List <GeoLocation>          Countries        = new List <GeoLocation>();
                List <SubCategory>          allSubCategories = new List <SubCategory>();

                if (((!isCityLevel || isCategoryLevel) && query.PageType == Contracts.Enums.PageType.Category) ||
                    (query.PageType == Contracts.Enums.PageType.Country && (!isSubcategoryLevel && !isCityLevel))
                    ) // Get subcat for category => category/country/state OR Country => category/country/state
                {
                    if (query.MasterEventType == Contracts.Enums.MasterEventType.Online || query.MasterEventType == Contracts.Enums.MasterEventType.InRealLife)
                    {
                        subCategories = allCategories.Where(s => s.MasterEventTypeId == query.MasterEventType).ToList();
                    }
                    if (((isCountryLevel || isStateLevel || isCityLevel) && query.PageType == Contracts.Enums.PageType.Category) ||
                        ((isStateLevel || isCityLevel || isCountryLevel) && (isCategoryLevel) && query.PageType == Contracts.Enums.PageType.Category)) // filter the subcat if it's category => state/country or country => category page
                    {
                        subCategories = subCategories.Where(x => placeDetails.Any(y => y.EventCategoryId == x.Id)).ToList();
                    }
                    else if (query.PageType == Contracts.Enums.PageType.Country && !isCategoryLevel && !isSubcategoryLevel) // Global country/city/state landing page
                    {
                        subCategories = _eventCategory.GetByIds(placeDetails.Select(s => s.ParentCategoryId).Distinct()).ToList();
                    }
                    allSubCategories = _subCategoryProvider.GetSubCategories(query, placeDetails, subCategories, pageDetail).OrderBy(s => s.Order).ToList();
                }

                if (((!isCityLevel || isCountryLevel) && pageDetail.PageType == Contracts.Enums.PageType.Category) ||
                    (pageDetail.PageType == Contracts.Enums.PageType.Country && !(isSubcategoryLevel && isCityLevel)))
                {
                    var cityGroup  = placeDetails.Select(s => new { s.CityId, s.CityName }).Distinct().Take(10);
                    var stateGroup = placeDetails.Select(s => new { s.StateId, s.StateName }).Distinct().Take(10);
                    // If it's online then don't show city/state/country
                    if (!isOnlineExperiences)
                    {
                        foreach (var group in cityGroup)
                        {
                            GeoLocation city = new GeoLocation();
                            if (group.CityName != "")
                            {
                                Cities.Add(GeoLocation(group.CityName, group.CityId, placeDetails.First().ParentCategorySlug, subCategories.First().Slug, isCategoryLevel, placeDetails.First().ParentCategoryId, subCategories.First().Id, query.CountryId, "city", pageDetail));
                            }
                        }
                        foreach (var group in stateGroup)
                        {
                            GeoLocation state = new GeoLocation();
                            if (group.StateName != "")
                            {
                                States.Add(GeoLocation(group.StateName, group.StateId, placeDetails.First().ParentCategorySlug, subCategories.First().Slug, isCategoryLevel, placeDetails.First().ParentCategoryId, subCategories.First().Id, query.CountryId, "state", pageDetail));
                            }
                        }
                        if (query.PageType == Contracts.Enums.PageType.Category)
                        {
                            var countryGroup = placeDetails.Select(s => new { s.CountryId, s.CountryName }).Distinct().Take(10);
                            foreach (var group in countryGroup)
                            {
                                GeoLocation country = new GeoLocation();
                                if (group.CountryName != "")
                                {
                                    Countries.Add(GeoLocation(group.CountryName, group.CountryId, placeDetails.First().ParentCategorySlug, subCategories.First().Slug, isCategoryLevel, placeDetails.First().ParentCategoryId, subCategories.First().Id, query.CountryId, "country", pageDetail));
                                }
                            }
                        }
                    }
                    DynamicPlaceSections = _dynamicSectionProvider.GetDynamicSections(placeDetails, query.MasterEventType, pageDetail);
                }

                AllplaceTiles.PlaceDetails   = placeDetails.Take(320).ToList();
                AllplaceTiles.SectionDetails = new SectionDetail();
                if (query.MasterEventType == Contracts.Enums.MasterEventType.Online || query.MasterEventType == Contracts.Enums.MasterEventType.InRealLife)
                {
                    AllplaceTiles.SectionDetails.Heading = query.MasterEventType == Contracts.Enums.MasterEventType.Online ? "Top Online Experiences from around the World" :
                                                           "In-Real-Life experiences around the world";
                }
                else if (query.PageType == Contracts.Enums.PageType.Category)
                {
                    AllplaceTiles.SectionDetails.Heading = (isCategoryLevel ? EventCategory.DisplayName : subCategories.First().DisplayName) + (isOnlineExperiences ? " from around " : " around ") +
                                                           (isCountryLevel ? placeDetails.First().CountryName : isStateLevel ?
                                                            placeDetails.First().StateName : isCityLevel ? placeDetails.First().CityName : "the World");
                }
                else if (query.PageType == Contracts.Enums.PageType.Country)
                {
                    AllplaceTiles.SectionDetails.Heading = ((!pageDetail.IsCategoryLevel && !pageDetail.IsSubCategoryLevel) ? "Feels"
                        : pageDetail.IsCategoryLevel
                        ? placeDetails.First().ParentCategory
                        : pageDetail.IsSubCategoryLevel ? placeDetails.First().Category : "") + (isOnlineExperiences ? " from around " : " around ") + (pageDetail.IsCityLevel
                        ? placeDetails.First().CityName :
                                                                                                                                                        pageDetail.IsStateLevel ? placeDetails.First().StateName : placeDetails.First().CountryName);
                }
                AllplaceTiles.SectionDetails.IsShowMore = true;
                var searchValue = "";
                if (query.MasterEventType == Contracts.Enums.MasterEventType.Online || query.MasterEventType == Contracts.Enums.MasterEventType.InRealLife)
                {
                    searchValue = "";
                }
                else if (query.PageType == Contracts.Enums.PageType.Category)
                {
                    searchValue = placeDetails.First().ParentCategory + (isSubcategoryLevel ? ", " + placeDetails.First().Category : "") +
                                  (isCountryLevel ? ", " + placeDetails.First().CountryName : "") + (isStateLevel ? ", " + placeDetails.First().StateName : "") +
                                  (isCityLevel ? ", " + placeDetails.First().CityName : "");
                }
                else
                {
                    searchValue = placeDetails.First().CountryName + (isSubcategoryLevel ? ", " + placeDetails.First().Category : "" + (isCategoryLevel ? ", " + placeDetails.First().ParentCategory : "")) +
                                  (isStateLevel ? ", " + placeDetails.First().StateName : "") +
                                  (isCityLevel ? ", " + placeDetails.First().CityName : "");
                }
                if (query.PageType == Contracts.Enums.PageType.Country)
                {
                    DynamicPlaceSections = DynamicPlaceSections.OrderBy(a => Guid.NewGuid()).ToList();
                    var description = "";
                    if (pageDetail.IsCityLevel)
                    {
                        var cityDescription = _cityDescriptionRepository.GetBycityId(placeDetails.First().CityId);
                        description = cityDescription != null ? cityDescription.Description : "";
                    }
                    else if (pageDetail.IsStateLevel)
                    {
                        var stateDescription = _stateDescriptionRepository.GetByStateId(placeDetails.First().StateId);
                        description = stateDescription != null ? stateDescription.Description : "";
                    }
                    else
                    {
                        var countryDescription = _countryDescriptionRepository.GetByCountryId(query.CountryId);
                        description = countryDescription != null ? countryDescription.Description : "";
                    }
                    countryPageDetail.Count        = (pageDetail.IsCountryLevel && !pageDetail.IsStateLevel && !pageDetail.IsCityLevel) ? _countryRepository.GetAllCountryPlace().Where(s => s.Id == query.CountryId).FirstOrDefault().Count : placeDetails.GroupBy(x => x.Name, (key, group) => group.First()).Count();
                    countryPageDetail.Description  = description;
                    countryPageDetail.SectionTitle = pageDetail.IsCityLevel ? placeDetails.First().CityName : isStateLevel?placeDetails.First().StateName:
                                                     placeDetails.First().CountryName;
                }

                return(new FeelUserJourneyQueryResult
                {
                    AllPlaceTiles = AllplaceTiles,
                    SubCategories = allSubCategories,
                    GeoData = new GeoData {
                        Cities = Cities, Countries = Countries, States = States
                    },
                    DynamicPlaceSections = DynamicPlaceSections,
                    SearchValue = searchValue,
                    ContryPageDetails = countryPageDetail,
                    Success = true
                });
            }
            catch (Exception e)
            {
                _logger.Log(LogCategory.Error, new Exception("", e));
                return(new FeelUserJourneyQueryResult
                {
                });
            }
        }
Exemplo n.º 6
0
        private FeelSearchQueryResult AdvanceSearch(FeelSearchQuery query)
        {
            var siteEvents = _eventSiteIdMappingRepository
                             .GetBySiteId(query.SiteId)
                             .OrderBy(o => o.SortOrder).ToList();

            List <Contracts.DataModels.Event> searchEvents = new List <Contracts.DataModels.Event>();

            if (query.PlaceAltIds != null && query.PlaceAltIds.Count() > 0)
            {
                searchEvents = _eventRepository.GetEventsByAltIds(query.PlaceAltIds)
                               .ToList();
            }
            else
            {
                searchEvents = _eventRepository.GetFeelEventsBySearchString(query.Name, query.SiteId)
                               .ToList();
            }

            var eventMapping          = searchEvents.ToDictionary(e => e.Id);
            var eventIds              = eventMapping.Keys;
            var eventCategoryMappings = _eventCategoryMappingRepository.GetByEventIds(eventIds).Where(ed => ed.IsEnabled == true);
            var allEventDetails       = _eventDetailRepository.GetByEventIds(eventIds).Where(ed => ed.IsEnabled == true);
            var allEventRatings       = _ratingRepository.GetByEventIds(eventIds);
            var venueMapping          = _venueRepository.GetByVenueIds(allEventDetails.Select(ed => ed.VenueId).Distinct())
                                        .ToDictionary(v => v.Id);
            var eventDetailsMapping = allEventDetails.GroupBy(ed => ed.EventId)
                                      .ToDictionary(g => g.Key, g => g.ToList());
            var eventCategoryMapping = eventCategoryMappings.GroupBy(ed => ed.EventId)
                                       .ToDictionary(g => g.Key, g => g.ToList());
            var eventRatingMapping = allEventRatings.GroupBy(ed => ed.EventId)
                                     .ToDictionary(g => g.Key, g => g.ToList());
            var cityIds     = venueMapping.Values.Select(s => s.CityId).Distinct();
            var cityMapping = _cityRepository.GetByCityIds(cityIds)
                              .ToDictionary(c => c.Id);
            var stateId      = cityMapping.Values.Select(c => c.StateId).Distinct();
            var stateMapping = _stateRepository.GetByStateIds(stateId)
                               .ToDictionary(s => s.Id);
            var countryIdList  = stateMapping.Values.Select(s => s.CountryId).Distinct();
            var countryMapping = _countryRepository.GetByCountryIds(countryIdList)
                                 .ToDictionary(c => c.Id);
            var eventsBySortOrder = new List <FIL.Contracts.DataModels.Event>();

            foreach (var item in siteEvents)
            {
                var events = searchEvents.FirstOrDefault(w => w.Id == item.EventId);
                if (events != null)
                {
                    eventsBySortOrder.Add(AutoMapper.Mapper.Map <FIL.Contracts.DataModels.Event>(events));
                }
            }
            var CategoryEventData = eventsBySortOrder.Select(ce =>
            {
                try
                {
                    var eventObj         = eventMapping[ce.Id];
                    var eventDetails     = eventDetailsMapping[ce.Id];
                    var eventCategoryMap = eventCategoryMapping[ce.Id];
                    List <FIL.Contracts.DataModels.Rating> eventRatings;
                    if (eventRatingMapping.ContainsKey(ce.Id))
                    {
                        eventRatings = eventRatingMapping[ce.Id];
                    }
                    else
                    {
                        eventRatings = null;
                    }
                    var eventDetailIdList           = eventDetails.Select(s => s.Id).Distinct().ToList();
                    var venues                      = eventDetails.Select(s => s.VenueId).Distinct().Select(v => venueMapping[v]);
                    var cities                      = venues.Select(s => s.CityId).Distinct().Select(c => cityMapping[c]);
                    var states                      = cities.Select(s => s.StateId).Distinct().Select(s => stateMapping[s]);
                    var countries                   = states.Select(s => s.CountryId).Distinct().Select(c => countryMapping[c]);
                    var eventTicketAttributeMapping = new List <Contracts.DataModels.EventTicketAttribute>
                    {
                        _eventTicketAttributeRepository.GetMaxPriceByEventDetailId(eventDetailIdList),
                        _eventTicketAttributeRepository.GetMinPriceByEventDetailId(eventDetailIdList)
                    };
                    var currencyMapping            = _currencyTypeRepository.GetByCurrencyId(eventTicketAttributeMapping.First().CurrencyId);
                    List <string> eventCatMappings = new List <string>();

                    foreach (var eventCat in eventCategoryMap)
                    {
                        var eventCategoryDataModel = _eventCategoryRepository.Get(eventCat.EventCategoryId);
                        var eventCategoryModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryDataModel);
                        eventCatMappings.Add(eventCategoryModel.DisplayName);
                    }
                    return(new CategoryEventContainer
                    {
                        CategoryEvent = Mapper.Map <Contracts.Models.CategoryEvent>(ce),
                        EventType = eventObj.EventTypeId.ToString(),
                        EventCategory = eventObj.EventCategoryId.ToString(),
                        City = Mapper.Map <IEnumerable <City> >(cities),
                        State = Mapper.Map <IEnumerable <State> >(states),
                        Country = Mapper.Map <IEnumerable <Country> >(countries),
                        Event = Mapper.Map <Event>(eventObj),
                        EventDetail = Mapper.Map <IEnumerable <EventDetail> >(eventDetails),
                        Rating = Mapper.Map <IEnumerable <Rating> >(eventRatings),
                        CurrencyType = Mapper.Map <CurrencyType>(currencyMapping),
                        Venue = Mapper.Map <IEnumerable <Venue> >(venues),
                        EventTicketAttribute = Mapper.Map <IEnumerable <EventTicketAttribute> >(eventTicketAttributeMapping),
                        EventCategories = eventCatMappings
                    });
                }
                catch (Exception e)
                {
                    return(new CategoryEventContainer
                    {
                    });
                }
            });

            return(new FeelSearchQueryResult
            {
                FeelAdvanceSearchQueryResult = new FeelCategoryEventQueryResult
                {
                    CategoryEvents = CategoryEventData.ToList()
                }
            });
        }
Exemplo n.º 7
0
        protected override async Task <ICommandResult> Handle(ApproveModeratePlaceCommand command)
        {
            ApproveModeratePlaceCommandResult approveModeratePlaceCommandResult = new ApproveModeratePlaceCommandResult();

            try
            {
                if (command.EventStatus != 0 && command.EventId != 0)
                {
                    var currentEvent = _eventRepository.Get(command.EventId);
                    currentEvent.EventStatusId = command.EventStatus;
                    currentEvent.IsEnabled     = command.EventStatus == Contracts.Enums.EventStatus.Draft ?
                                                 false : command.EventStatus == Contracts.Enums.EventStatus.Published ?
                                                 true : currentEvent.IsEnabled;
                    _eventRepository.Save(currentEvent);
                    if (currentEvent.EventStatusId == Contracts.Enums.EventStatus.WaitingForApproval)
                    {
                        var eventStepDetails = _stepProvider.SaveEventStepDetails(currentEvent.Id, 12, true, command.ModifiedBy);
                    }
                    return(new ApproveModeratePlaceCommandResult
                    {
                        Success = true,
                        IsTokanize = currentEvent.IsTokenize,
                        PlaceAltId = currentEvent.AltId
                    });
                }
                var eventData = _eventRepository.GetByAltId(command.PlaceAltId);
                eventData.IsEnabled     = !command.IsDeactivateFeels ? true : false;
                eventData.EventStatusId = !command.IsDeactivateFeels ? FIL.Contracts.Enums.EventStatus.Published : FIL.Contracts.Enums.EventStatus.Draft;
                _eventRepository.Save(eventData);
                var eveventSiteIds        = _eventSiteIdMappingRepository.GetAllByEventId(eventData.Id).ToList();
                var eventCategoryMappings = _eventCategoryMappingRepository.GetByEventId(eventData.Id).FirstOrDefault();
                var subCategory           = _eventCategoryRepository.Get(eventCategoryMappings.EventCategoryId);
                var parentCategory        = _eventCategoryRepository.Get(subCategory.EventCategoryId);
                var user = _userRepository.GetByAltId(eventData.CreatedBy);
                if (eveventSiteIds != null)
                {
                    foreach (FIL.Contracts.DataModels.EventSiteIdMapping eventSiteIdmappings in eveventSiteIds)
                    {
                        var eventSiteIdMap = _eventSiteIdMappingRepository.Get(eventSiteIdmappings.Id);
                        if (eventSiteIdMap != null)
                        {
                            eventSiteIdMap.IsEnabled = !command.IsDeactivateFeels ? true : false;
                            _eventSiteIdMappingRepository.Save(eventSiteIdMap);
                        }
                    }
                    approveModeratePlaceCommandResult.Slug = eventData.Slug;
                    approveModeratePlaceCommandResult.ParentCategorySlug = parentCategory.Slug;
                    approveModeratePlaceCommandResult.SubCategorySlug    = subCategory.Slug;
                    approveModeratePlaceCommandResult.Email             = user.Email;
                    approveModeratePlaceCommandResult.ParentCategoryId  = subCategory.EventCategoryId;
                    approveModeratePlaceCommandResult.Success           = true;
                    approveModeratePlaceCommandResult.MasterEventTypeId = eventData.MasterEventTypeId;
                    approveModeratePlaceCommandResult.PlaceAltId        = eventData.AltId;
                    approveModeratePlaceCommandResult.IsTokanize        = eventData.IsTokenize;
                }
                try
                {
                    if (!command.IsDeactivateFeels && command.UpdateAlgolia && !eventData.IsTokenize)
                    {
                        _algoliaAddEventProvider.AddEventToAlgolia(eventData.Id);
                    }
                    if (command.IsDeactivateFeels)
                    {
                        _algoliaClientProvider.DeleteObject(eventData.Id.ToString());
                    }
                }
                catch (Exception e)
                {
                    _logger.Log(Logging.Enums.LogCategory.Error, e);
                }
                return(approveModeratePlaceCommandResult);
            }
            catch (Exception ex)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, ex);
                return(new ApproveModeratePlaceCommandResult
                {
                    Success = false
                });
            }
        }
Exemplo n.º 8
0
        public EventsQueryResult Handle(EventsQuery query)
        {
            if (query.Channel == Channels.Feel)
            {
                var eventResult = _eventRepository.GetSEOEventsByProduct(query.Channel == Channels.Feel);

                var siteMap = eventResult.Select(eId =>
                {
                    var eventCategoryDataModel = _eventCategoryRepository.Get(eId.EventCategoryId);
                    var eventCategoryModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryDataModel);

                    if (eventCategoryModel != null)
                    {
                        var eventCategoryParentDataModel = _eventCategoryRepository.Get(eventCategoryModel.EventCategoryId);
                        var eventCategoryParentModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryParentDataModel);

                        if (eId.AltId != null && eventCategoryParentModel != null)
                        {
                            return(new EventsSiteMap
                            {
                                EventAltId = eId.AltId,
                                URL = eventCategoryParentModel.DisplayName.ToString().Replace(" ", "-").ToLower() + "/" + eId.Slug.ToString() + "/" + eventCategoryModel.DisplayName.ToString().Replace(" ", "-").ToLower(),
                                Description = eId.Description
                            });
                        }
                        else
                        {
                            return(new EventsSiteMap
                            {
                            });
                        }
                    }
                    else
                    {
                        return(new EventsSiteMap
                        {
                        });
                    }
                });

                return(new EventsQueryResult
                {
                    EventsURLs = siteMap.ToList()
                });
            }
            else
            {
                var eventResult = _eventRepository.GetSEOEventsByProduct(query.Channel == Channels.Feel);

                var siteMap = eventResult.Select(eId =>
                {
                    if (eId.AltId != null)
                    {
                        return(new EventsSiteMap
                        {
                            EventAltId = eId.AltId
                        });
                    }
                    else
                    {
                        return(new EventsSiteMap
                        {
                        });
                    }
                });

                return(new EventsQueryResult
                {
                    EventsURLs = siteMap.ToList()
                });
            }
        }
Exemplo n.º 9
0
        public SavedEventQueryResult Handle(SavedEventQuery query)
        {
            var eventDataModel = _eventRepository.GetByAltId(query.Id);
            var eventModel     = AutoMapper.Mapper.Map <Contracts.Models.Event>(eventDataModel);

            var placeVisitDuration = _placeVisitDurationRepository.GetBySingleEventId(eventModel.Id);

            var galleryImageResponse = _eventGalleryImageRepository.GetByEventId(eventModel.Id);
            var galleryImageModel    = AutoMapper.Mapper.Map <IEnumerable <EventGalleryImage> >(galleryImageResponse);

            var eventcatmapresponse = _eventCategoryMappingRepository.GetByEventId(eventModel.Id);
            var eventcatmap         = AutoMapper.Mapper.Map <IEnumerable <EventCategoryMapping> >(eventcatmapresponse);

            var eventsiteidresponse = _eventSiteIdMappingRepository.GetByEventId(eventModel.Id);
            var eventsitemap        = AutoMapper.Mapper.Map <EventSiteIdMapping>(eventsiteidresponse);

            var eventlearnmoreresponse = _eventLearnMoreAttributeRepository.GetByEventId(eventModel.Id);
            var eventlearnmore         = AutoMapper.Mapper.Map <IEnumerable <EventLearnMoreAttribute> >(eventlearnmoreresponse);

            var eventamenityresponse = _eventAmenityRepository.GetByEventId(eventModel.Id);
            var eventamenity         = AutoMapper.Mapper.Map <IEnumerable <EventAmenity> >(eventamenityresponse);

            var eventdetailresponse = _eventDetailRepository.GetSubeventByEventId(eventModel.Id).FirstOrDefault();
            var eventdetail         = AutoMapper.Mapper.Map <EventDetail>(eventdetailresponse);

            var eventTags = _eventTagMappingRepository.GetByEventId(eventModel.Id);

            Country countrydetail = new Country();
            City    citydetail    = new City();
            State   statedetail   = new State();
            Zipcode zipcodeDetail = new Zipcode();
            Venue   venuedetail   = new Venue();

            if (eventdetail != null)
            {
                var venuedetailresponse = _venueRepository.GetByVenueId(eventdetail.VenueId);
                venuedetail = AutoMapper.Mapper.Map <Venue>(venuedetailresponse);
                if (venuedetail != null)
                {
                    var citydetailresponse = _cityRepository.GetByCityId(venuedetail.CityId);
                    citydetail = AutoMapper.Mapper.Map <City>(citydetailresponse);
                    var Zip = _zipcodeRepository.GetAllByCityId(citydetail.Id).FirstOrDefault();
                    zipcodeDetail = AutoMapper.Mapper.Map <Zipcode>(Zip);
                }
                if (citydetail != null)
                {
                    var statedetailresponse = _stateRepository.GetByStateId(citydetail.StateId);
                    statedetail = AutoMapper.Mapper.Map <State>(statedetailresponse);
                }
                if (statedetail != null)
                {
                    var countrydetailresponse = _countryRepository.GetByCountryId(statedetail.CountryId);
                    countrydetail = AutoMapper.Mapper.Map <Country>(countrydetailresponse);
                }
            }

            var features   = Enum.GetValues(typeof(LearnMoreFeatures));
            var resultdata = new SavedEventQueryResult();

            resultdata.Country  = countrydetail.Name;
            resultdata.City     = citydetail.Name;
            resultdata.Address1 = venuedetail.AddressLineOne;
            resultdata.Address2 = venuedetail.AddressLineTwo;
            resultdata.State    = statedetail.Name;
            resultdata.Lat      = ((venuedetail.Latitude != null && venuedetail.Latitude != "" && venuedetail.Latitude != "NaN") ? venuedetail.Latitude : "18.5204");
            resultdata.Long     = ((venuedetail.Longitude != null && venuedetail.Longitude != "" && venuedetail.Latitude != "NaN") ? venuedetail.Longitude : "73.8567");
            List <string> amenityids = new List <string>();

            if (zipcodeDetail != null)
            {
                if (zipcodeDetail.Id != 0)
                {
                    resultdata.Zip = zipcodeDetail.Postalcode;
                }
            }
            foreach (var ea in eventamenity)
            {
                amenityids.Add((ea.AmenityId).ToString());
            }
            if (placeVisitDuration != null)
            {
                var data = placeVisitDuration.TimeDuration.Split("-");
                if (data.Length >= 2)
                {
                    resultdata.HourTimeDuration   = placeVisitDuration.TimeDuration;
                    resultdata.MinuteTimeDuration = "";
                }
            }
            resultdata.AmenityId = string.Join(",", amenityids);
            //resultdata.AmenityId = string.Join(",", amenityids);
            var archdesc = eventlearnmore.FirstOrDefault(p => p.LearnMoreFeatureId == LearnMoreFeatures.ArchitecturalDetail);

            if (archdesc != null)
            {
                resultdata.Archdetail   = archdesc.Description;
                resultdata.ArchdetailId = archdesc.Id;
            }
            var highlightdesc = eventlearnmore.FirstOrDefault(p => p.LearnMoreFeatureId == LearnMoreFeatures.HighlightNugget);

            if (highlightdesc != null)
            {
                resultdata.Highlights   = highlightdesc.Description;
                resultdata.HighlightsId = highlightdesc.Id;
            }
            var historydesc = eventlearnmore.FirstOrDefault(p => p.LearnMoreFeatureId == LearnMoreFeatures.History);

            if (historydesc != null)
            {
                resultdata.History   = historydesc.Description;
                resultdata.HistoryId = historydesc.Id;
            }
            var immersdesc = eventlearnmore.FirstOrDefault(p => p.LearnMoreFeatureId == LearnMoreFeatures.ImmersiveExperience);

            if (immersdesc != null)
            {
                resultdata.Immersiveexperience   = immersdesc.Description;
                resultdata.ImmersiveexperienceId = immersdesc.Id;
            }

            var tilesImages         = "";
            var galleryImages       = galleryImageModel.Where(p => p.Name.Contains("gallery"));
            var tilesSliderImages   = galleryImageModel.Where(p => p.Name.Contains("Tiles"));
            var descPageImages      = galleryImageModel.Where(p => p.Name.Contains("DescBanner"));
            var inventoryPageImages = galleryImageModel.Where(p => p.Name.Contains("InventoryBanner"));
            var placeMapImages      = galleryImageModel.Where(p => p.Name.Contains("placemapImages"));
            var timelineImages      = galleryImageModel.Where(p => p.Name.Contains("timelineImages"));
            var immersiveImages     = galleryImageModel.Where(p => p.Name.Contains("immersiveImages"));
            var architecturalImages = galleryImageModel.Where(p => p.Name.Contains("archdetailImages"));

            var galleryImagesList     = "";
            var tilesSliderImagesList = "";
            var descPageList          = "";
            var inventoryPageList     = "";
            var plaeMapImagesList     = "";
            var timelineImagesList    = "";
            var immerseImagesList     = "";
            var archImagesList        = "";

            foreach (EventGalleryImage eventGalleryImage in galleryImages)
            {
                galleryImagesList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in tilesSliderImages)
            {
                tilesSliderImagesList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in descPageImages)
            {
                descPageList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in inventoryPageImages)
            {
                inventoryPageList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in placeMapImages)
            {
                plaeMapImagesList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in timelineImages)
            {
                timelineImagesList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in immersiveImages)
            {
                immerseImagesList += eventGalleryImage.Name + ",";
            }
            foreach (EventGalleryImage eventGalleryImage in galleryImages)
            {
                archImagesList += eventGalleryImage.Name + ",";
            }

            resultdata.GalleryImages            = galleryImagesList;
            resultdata.TilesSliderImages        = tilesSliderImagesList;
            resultdata.DescpagebannerImage      = descPageList;
            resultdata.InventorypagebannerImage = inventoryPageList;
            resultdata.PlacemapImages           = plaeMapImagesList;
            resultdata.TimelineImages           = timelineImagesList;
            resultdata.ImmersiveexpImages       = immerseImagesList;
            resultdata.ArchdetailImages         = archImagesList;

            resultdata.Description = eventModel.Description;
            resultdata.Id          = eventModel.Id;
            resultdata.AltId       = eventModel.AltId;
            resultdata.Location    = eventModel.Name;
            List <int> subcatids  = new List <int>();
            List <int> tags       = new List <int>();
            int        categoryId = eventModel.EventCategoryId;

            foreach (var cat in eventcatmap)
            {
                categoryId = cat.EventCategoryId;
                subcatids.Add(cat.EventCategoryId);
            }
            foreach (var tag in eventTags)
            {
                tags.Add((int)tag.TagId);
            }
            var category = _eventCategoryRepository.Get(categoryId);

            resultdata.Subcategoryid = string.Join(",", subcatids);
            resultdata.TagIds        = string.Join(",", tags);
            resultdata.Categoryid    = category.EventCategoryId;
            //resultdata.Subcategoryid = subcatids.FirstOrDefault();

            /*var categorymapobj = eventcatmap.FirstOrDefault();
             * if (categorymapobj != null)
             * {
             *  resultdata.Categoryid = eventModel.EventCategoryId;
             * }*/
            resultdata.Metadescription = eventModel.MetaDetails;
            if (resultdata.Metadescription != null)
            {
                string[] metas = resultdata.Metadescription.Split(new string[] { "<br/>" }, StringSplitOptions.None);
                if (metas.Length == 3)
                {
                    resultdata.Metatitle       = metas[0].Split("title")[1].Replace(">", "").Replace("</", "");
                    resultdata.Metadescription = metas[1].Split("content=")[1].Replace(">", "").Replace("\"", "").Replace("</", "");
                    resultdata.Metatags        = metas[2].Split("content=")[1].Replace(">", "").Replace("\"", "").Replace("</", "");
                }
            }
            resultdata.PlaceName = venuedetail.Name;
            //resultdata.Subcategoryid = eventcatmap.Select(p => p.EventCategoryId).FirstOrDefault();
            //resultdata.Subcategoryid = string.Join(",", eventcatmap.Count() > 0 ? eventcatmap.Select(p => p.EventCategoryId).ToList() : new List<int>());
            resultdata.Title = eventModel.Name;
            var eventHostMappings = _eventHostMappingRepository.GetAllByEventId(eventModel.Id);

            resultdata.EventHostMappings = eventHostMappings.ToList();
            return(resultdata);
        }
Exemplo n.º 10
0
        public FeelEventLearnPageQueryResult Handle(FeelEventLearnPageQuery query)
        {
            EventLearnPageQueryResults eventLearnMorePage = new EventLearnPageQueryResults();

            if (!String.IsNullOrWhiteSpace(query.Slug))
            {
                eventLearnMorePage = _eventLearnPageProvider.GetBySlug(query.Slug);
            }
            else
            {
                eventLearnMorePage = _eventLearnPageProvider.GetByAltId(query.EventAltId);
            }

            if (eventLearnMorePage.Event != null)
            {
                var eventCategoryMappings = _eventCategoryMappingRepository.GetByEventId(eventLearnMorePage.Event.Id).FirstOrDefault();
                if (eventCategoryMappings == null)
                {
                    return(new FeelEventLearnPageQueryResult());
                }
                var subCategoryDataModel = _eventCategoryRepository.Get(eventCategoryMappings.EventCategoryId);
                var subCategory          = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(subCategoryDataModel);
                var categoryDataModel    = _eventCategoryRepository.Get(subCategory.EventCategoryId);
                var category             = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(categoryDataModel);

                var clientPointOfContact      = _clientPointOfContactRepository.Get(eventLearnMorePage.Event.ClientPointOfContactId);
                var clientPointOfContactModel = AutoMapper.Mapper.Map <Contracts.Models.ClientPointOfContact>(clientPointOfContact);

                var eventTicketDetails     = _eventTicketDetailRepository.GetByEventDetailId(eventLearnMorePage.EventDetail.Id).Where(s => s.IsEnabled == true);
                var EventTicketDetailModel = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketDetail> >(eventTicketDetails);

                var eventTicketCategories      = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId).Distinct());
                var eventTicketCategoriesModel = AutoMapper.Mapper.Map <List <Contracts.Models.TicketCategory> >(eventTicketCategories);

                var eventTicketAttributes      = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetails.Select(s => s.Id).Distinct());
                var eventTicketAttributesModel = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketAttribute> >(eventTicketAttributes);
                if (eventTicketAttributesModel.Count() == 0)
                {
                    return(new FeelEventLearnPageQueryResult {
                    });
                }
                var currencyMapping = _currencyTypeRepository.GetByCurrencyId(eventTicketAttributesModel.First().CurrencyId);

                var ratingDataModel = _ratingRepository.GetByEventId(eventLearnMorePage.Event.Id);
                var ratingModel     = AutoMapper.Mapper.Map <List <Contracts.Models.Rating> >(ratingDataModel);

                var userdataModel = _userRepository.GetByUserIds(ratingModel.Select(s => s.UserId).Distinct());
                var userModel     = AutoMapper.Mapper.Map <List <Contracts.Models.UserProfile> >(userdataModel);

                var           eventAmenities           = _eventAmenityRepository.GetByEventId(eventLearnMorePage.Event.Id);
                var           eventLearnMoreAttributes = _eventLearnMoreAttributeRepository.GetByEventId(eventLearnMorePage.Event.Id);
                var           learnMoreAttributes      = AutoMapper.Mapper.Map <List <Contracts.Models.EventLearnMoreAttribute> >(eventLearnMoreAttributes);
                var           ticketAlertEventMapping  = _ticketAlertEventMappingRepository.GetByEventId(eventCategoryMappings.EventId).FirstOrDefault();
                List <string> EventAmenitiesList       = new List <string>();
                foreach (var item in eventAmenities)
                {
                    var amenities = _amenityRepository.Get(item.AmenityId);
                    EventAmenitiesList.Add((amenities.Amenity).ToString());
                }
                var data = _calendarProvider.GetCalendarData(eventLearnMorePage.Event.Id);
                //For Hoho Routes
                var citySightSeeingRoute        = _citySightSeeingRouteRepository.GetByEventDetailId(eventLearnMorePage.EventDetail.Id);
                var citySightSeeingRouteDetails = _citySightSeeingRouteDetailRepository.GetByCitySightSeeingRouteIds(citySightSeeingRoute.Select(s => s.Id));

                //for Tiqets Places
                Contracts.Models.Tiqets.TiqetProductCheckoutDetail
                    tiqetCheckoutDetailsModel = new Contracts.Models.Tiqets.TiqetProductCheckoutDetail();
                if (eventLearnMorePage.Event.EventSourceId == EventSource.Tiqets)
                {
                    var tiqetEventDetailMapping = _tiqetEventDetailMappingRepository.GetByEventDetailId(eventLearnMorePage.EventDetail.Id);
                    var tiqetCheckoutDetails    = _tiqetProductCheckoutDetailRepository.GetByProductId(tiqetEventDetailMapping.ProductId);
                    tiqetCheckoutDetailsModel = Mapper.Map <Contracts.Models.Tiqets.TiqetProductCheckoutDetail>(tiqetCheckoutDetails);
                }

                //For Live Online Events
                List <EventHostMapping> eventHostMappings = new List <EventHostMapping>();
                DateTime formattedDateTime = new DateTime();
                string   eventDateTimeZome = string.Empty;
                if (eventLearnMorePage.Event.MasterEventTypeId == MasterEventType.Online)
                {
                    var eventHostMappingModel = _eventHostMappingRepository.GetAllByEventId(eventLearnMorePage.Event.Id);
                    eventHostMappings = AutoMapper.Mapper.Map <List <Contracts.Models.EventHostMapping> >(eventHostMappingModel);
                    var placeWeekOpenDays = _placeWeekOpenDaysRepository.GetByEventId(eventLearnMorePage.Event.Id).FirstOrDefault();
                    var dayTimeMapping    = _dayTimeMappingsRepository.GetAllByPlaceWeekOpenDay(placeWeekOpenDays.Id).FirstOrDefault();
                    var eventAttribute    = _eventAttributeRepository.GetByEventDetailId(eventLearnMorePage.EventDetail.Id);

                    //Getting Datetime for online Event
                    var eventDate      = _localTimeZoneConvertProvider.ConvertToLocal(eventLearnMorePage.EventDetail.StartDateTime, eventAttribute.TimeZone);
                    var dateTimeString = eventDate.ToString("yyyy/MM/dd") + " " + dayTimeMapping.StartTime + ":00.000";
                    formattedDateTime = DateTime.Parse(dateTimeString);

                    eventDateTimeZome = eventAttribute.TimeZoneAbbreviation;
                }
                return(new FeelEventLearnPageQueryResult
                {
                    EventType = (EventType)eventLearnMorePage.EventType,
                    EventCategory = eventLearnMorePage.EventCategory,
                    Event = eventLearnMorePage.Event,
                    EventDetail = eventLearnMorePage.EventDetail,
                    Venue = eventLearnMorePage.Venue,
                    City = eventLearnMorePage.City,
                    State = eventLearnMorePage.State,
                    Country = eventLearnMorePage.Country,
                    EventTicketAttribute = eventTicketAttributesModel,
                    EventTicketDetail = EventTicketDetailModel,
                    CurrencyType = Mapper.Map <CurrencyType>(currencyMapping),
                    Rating = ratingModel,
                    TicketCategory = eventTicketCategoriesModel,
                    User = userModel,
                    EventAmenitiesList = EventAmenitiesList,
                    ClientPointOfContact = clientPointOfContactModel,
                    EventGalleryImage = eventLearnMorePage.EventGalleryImage,
                    EventLearnMoreAttributes = learnMoreAttributes,
                    RegularTimeModel = data.RegularTimeModel,
                    SeasonTimeModel = data.SeasonTimeModel,
                    SpecialDayModel = data.SpecialDayModel,
                    Category = category,
                    SubCategory = subCategory,
                    CitySightSeeingRoutes = Mapper.Map <IEnumerable <FIL.Contracts.Models.CitySightSeeing.CitySightSeeingRoute> >(citySightSeeingRoute),
                    CitySightSeeingRouteDetails = Mapper.Map <IEnumerable <FIL.Contracts.Models.CitySightSeeing.CitySightSeeingRouteDetail> >(citySightSeeingRouteDetails),
                    TiqetsCheckoutDetails = tiqetCheckoutDetailsModel,
                    EventHostMappings = eventHostMappings,
                    OnlineStreamStartTime = formattedDateTime,
                    OnlineEventTimeZone = eventDateTimeZome,
                    TicketAlertEventMapping = ticketAlertEventMapping
                });
            }
            return(new FeelEventLearnPageQueryResult());
        }
Exemplo n.º 11
0
        protected override Task <ICommandResult> Handle(ApplyDiscountCommand command)
        {
            var transaction = _transactionRepository.Get(command.TransactionId);

            var     transactionDetails  = _transactionDetailRepository.GetByTransactionId(command.TransactionId);
            var     ipDetail            = _iPDetailRepository.Get((int)transaction.IPDetailId);
            decimal totalDiscountAmount = 0;
            decimal discountAmount      = 0;

            foreach (TransactionDetail currentTransactionDetail in transactionDetails)
            {
                var eventTicketDetailDiscount = _eventTicketDiscountDetailRepository.GetAllByEventTicketAttributeId(currentTransactionDetail.EventTicketAttributeId).ToList();
                if (eventTicketDetailDiscount.Count() > 0 && currentTransactionDetail.TicketTypeId != 4)
                {
                    List <long> discountIds = new List <long>();
                    foreach (var currentEventTicketDetailDiscount in eventTicketDetailDiscount)
                    {
                        discountIds.Add(currentEventTicketDetailDiscount.DiscountId);
                    }
                    var discounts = _discountRepository.GetAllDiscountsByIds(discountIds).Where(w => w.IsEnabled);
                    if (discounts.Count() > 0)
                    {
                        List <long> Ids = new List <long>();
                        foreach (var id in discounts)
                        {
                            Ids.Add(id.Id);
                        }
                        var discountPromoCode = _discountPromoCodeRepository.GetAllDiscountIds(Ids).Where(s => s.PromoCode == command.Promocode).FirstOrDefault();
                        if (discountPromoCode != null)
                        {
                            //Check for limit
                            bool limitFlag = true;
                            if (discountPromoCode.Limit != null && discountPromoCode.Limit != 0)
                            {
                                var promoCodeTransactions       = _transactionRepository.GetSuccessfullTransactionByPromoCode(discountPromoCode.PromoCode).ToList();
                                var promocodeTransactionDetails = _transactionDetailRepository.GetByTransactionIds(promoCodeTransactions.Select(s => s.Id)).Where(w => w.EventTicketAttributeId == currentTransactionDetail.EventTicketAttributeId);

                                if (promocodeTransactionDetails.Count() >= discountPromoCode.Limit)
                                {
                                    limitFlag = false;
                                }
                            }
                            if (limitFlag)
                            {
                                if (discounts.Where(s => s.Id == discountPromoCode.DiscountId).FirstOrDefault().DiscountValueTypeId == Contracts.Enums.DiscountValueType.Flat)
                                {
                                    discountAmount = (decimal)(currentTransactionDetail.TotalTickets * discounts.Where(s => s.Id == discountPromoCode.DiscountId).FirstOrDefault().DiscountValue);
                                    if (discountAmount == (currentTransactionDetail.PricePerTicket * currentTransactionDetail.TotalTickets))
                                    {
                                        currentTransactionDetail.ConvenienceCharges = 0;
                                        currentTransactionDetail.ServiceCharge      = 0;
                                    }
                                }
                                else if (discounts.Where(s => s.Id == discountPromoCode.DiscountId).FirstOrDefault().DiscountValueTypeId == Contracts.Enums.DiscountValueType.Percentage)
                                {
                                    discountAmount = (decimal)(((currentTransactionDetail.PricePerTicket * currentTransactionDetail.TotalTickets) * (decimal)discounts.Where(s => s.Id == discountPromoCode.DiscountId).FirstOrDefault().DiscountValue) / 100);
                                    if (discountAmount == (currentTransactionDetail.PricePerTicket * currentTransactionDetail.TotalTickets))
                                    {
                                        currentTransactionDetail.ConvenienceCharges = 0;
                                        currentTransactionDetail.ServiceCharge      = 0;
                                    }
                                }
                                totalDiscountAmount += discountAmount;

                                if (command.Channel == Contracts.Enums.Channels.Feel)
                                {
                                    var eventTicketAttribute = _eventTicketAttributeRepository.Get(currentTransactionDetail.EventTicketAttributeId);
                                    var eventCurreny         = _currencyTypeRepository.Get(eventTicketAttribute.CurrencyId);
                                    var targetCurrency       = _currencyTypeRepository.Get(transaction.CurrencyId);
                                    if (discounts.Where(s => s.Id == discountPromoCode.DiscountId).FirstOrDefault().DiscountValueTypeId == Contracts.Enums.DiscountValueType.Flat)
                                    {
                                        discountAmount      = _geoCurrency.GetConvertedDiscountAmount((Decimal)discountAmount, eventCurreny.Id, targetCurrency.Code);
                                        totalDiscountAmount = _geoCurrency.GetConvertedDiscountAmount((Decimal)totalDiscountAmount, eventCurreny.Id, targetCurrency.Code);
                                    }
                                }
                                currentTransactionDetail.DiscountAmount = discountAmount;
                                _transactionDetailRepository.Save(currentTransactionDetail);
                            }
                        }
                    }
                }
            }

            ApplyDiscountCommandResult applyDiscountCommandResult = new ApplyDiscountCommandResult();

            if (totalDiscountAmount == 0)
            {
                applyDiscountCommandResult.Id = 0;
            }
            else
            {
                transaction.DiscountAmount  = totalDiscountAmount;
                transaction.NetTicketAmount = transaction.NetTicketAmount - totalDiscountAmount;
                if (transaction.GrossTicketAmount == totalDiscountAmount)
                {
                    transaction.NetTicketAmount    = 0;
                    transaction.ConvenienceCharges = 0;
                    transaction.ServiceCharge      = 0;
                }
                transaction.DiscountCode = command.Promocode;
                _transactionRepository.Save(transaction);

                applyDiscountCommandResult.Id                 = transaction.Id;
                applyDiscountCommandResult.CurrencyId         = transaction.CurrencyId;
                applyDiscountCommandResult.GrossTicketAmount  = transaction.GrossTicketAmount;
                applyDiscountCommandResult.DeliveryCharges    = transaction.DeliveryCharges;
                applyDiscountCommandResult.ConvenienceCharges = transaction.ConvenienceCharges;
                applyDiscountCommandResult.ServiceCharge      = transaction.ServiceCharge;
                applyDiscountCommandResult.DiscountAmount     = transaction.DiscountAmount;
                applyDiscountCommandResult.NetTicketAmount    = transaction.NetTicketAmount;
            }

            try
            {
                if (transaction.NetTicketAmount <= 0)
                {
                    var liveOnlineTransactionDetailModel = _transactionRepository.GetFeelOnlineDetails(transaction.Id).FirstOrDefault();
                    if (liveOnlineTransactionDetailModel != null)
                    {
                        //check if subcategory is LiveOnline
                        var eventCategoryModel = _eventCategoryRepository.Get(Convert.ToInt16(liveOnlineTransactionDetailModel.EventcategoryId));
                        var eventModel         = _eventRepository.Get(liveOnlineTransactionDetailModel.EventId);
                        if ((eventCategoryModel != null && eventModel.MasterEventTypeId == Contracts.Enums.MasterEventType.Online && command.Channel == Contracts.Enums.Channels.Feel) || eventModel.EventCategoryId == 119)
                        {
                            _zoomMeetingProvider.CreateMeeting(transaction, true);
                            applyDiscountCommandResult.IsPaymentBypass = true;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, e);
            }

            return(Task.FromResult <ICommandResult>(applyDiscountCommandResult));
        }
Exemplo n.º 12
0
        public TicketCategoryQueryResult Handle(TicketCategoryQuery query)
        {
            try
            {
                var eventDataModel = _eventRepository.GetByAltId(query.EventAltId);
                var eventModel     = AutoMapper.Mapper.Map <Contracts.Models.Event>(eventDataModel);
                if (eventModel != null)
                {
                    var ASIMonumentMapping = _aSIMonumentEventTableMappingRepository.GetByEventId(eventModel.Id);
                    var ASIMonument        = new Contracts.Models.ASI.Item();
                    if (ASIMonumentMapping != null)
                    {
                        ASIMonument = Mapper.Map <Contracts.Models.ASI.Item>(_aSIMonumentRepository.Get(ASIMonumentMapping.ASIMonumentId));
                    }
                    var eventCategoryMappings     = _eventCategoryMappingRepository.GetByEventId(eventModel.Id).FirstOrDefault();
                    var eventDetailModelDataModel = _eventDetailRepository.GetSubEventByEventId(eventModel.Id);
                    var eventDetailModel          = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventDetail> >(eventDetailModelDataModel);
                    List <FIL.Contracts.Models.ASI.EventTimeSlotMapping> eventTimeSlotMappings = new List <Contracts.Models.ASI.EventTimeSlotMapping>();
                    List <EventVenueMappingTime>       eventVenueMappingTimeModel = new List <EventVenueMappingTime>();
                    FIL.Contracts.Models.EventCategory subCategory = new FIL.Contracts.Models.EventCategory();
                    FIL.Contracts.Models.EventCategory category    = new FIL.Contracts.Models.EventCategory();
                    try
                    {
                        var eventTimeSlot = _eventTimeSlotMappingRepository.GetByEventId(eventModel.Id);
                        eventTimeSlotMappings = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.ASI.EventTimeSlotMapping> >(eventTimeSlot).ToList();
                    }
                    catch (Exception e)
                    {
                    }
                    if (eventCategoryMappings != null)
                    {
                        var subCategoryDataModel = _eventCategoryRepository.Get(eventCategoryMappings.EventCategoryId);
                        if (subCategory != null)
                        {
                            subCategory = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(subCategoryDataModel);
                            var categoryDataModel = _eventCategoryRepository.Get(subCategory.EventCategoryId);
                            category = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(categoryDataModel);
                        }
                    }
                    var ticketCategoryType    = _ticketCategoryTypesRepository.GetAll();
                    var ticketCategorySubType = _ticketCategorySubTypesRepository.GetAll();

                    var placeHolidyDatesDataModel = _placeHolidayDatesRepository.GetAllByEventId(eventDataModel.Id);
                    var placeHolidyDatesModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.PlaceHolidayDate> >(placeHolidyDatesDataModel);

                    var placeWeekOffDataModel = _placeWeekOffRepository.GetAllByEventId(eventDataModel.Id);
                    var placeWeekOffModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.PlaceWeekOff> >(placeWeekOffDataModel);

                    var placeDocumentDataModel = _placeCustomerDocumentTypeMappingRepository.GetAllByEventId(eventDataModel.Id);
                    var placeDocumentModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.PlaceCustomerDocumentTypeMapping> >(placeDocumentDataModel);

                    var placeOpenDays      = _placeWeekOpenDaysRepository.GetByEventId(eventDataModel.Id);
                    var placeOpenDaysModel = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.PlaceWeekOpenDays> >(placeOpenDays);

                    var CustomerDocumentTypeDataModel = _customerDocumentTypeRepository.GetAll();
                    var CustomerDocumentTypeModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.CustomerDocumentType> >(CustomerDocumentTypeDataModel);

                    if (eventDetailModelDataModel != null && eventDetailModelDataModel.Any())
                    {
                        var eventDeliveryTypeDetailDataModel = _eventDeliveryTypeDetail.GetByEventDetailId(eventDetailModelDataModel.ElementAt(0).Id);
                        var eventDeliveryTypeDetailModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventDeliveryTypeDetail> >(eventDeliveryTypeDetailDataModel);

                        var RASVTicketTypeMappingsDataModel = _rasvTicketTypeMappingRepository.GetByEventDetailIds(eventDetailModelDataModel.Select(ed => ed.Id)).Where(sed => sed.IsEnabled == true);
                        var RASVTicketTypeMappingsModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.RASVTicketTypeMapping> >(RASVTicketTypeMappingsDataModel);

                        var venueDetailDataModel = _venueRepository.GetByVenueIds(eventDetailModel.Select(s => s.VenueId));
                        var venueDetailModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Venue> >(venueDetailDataModel);

                        //Multiple Venue option for MOVE AROUND category.
                        var eventVenueMappingDataModel = _eventVenueMappingRepository.GetOneByEventId(eventModel.Id);
                        var eventVenueMappingModel     = Mapper.Map <EventVenueMapping>(eventVenueMappingDataModel);
                        if (eventVenueMappingModel != null)
                        {
                            var eventVenueMappingTimeDataModel = _eventVenueMappingTimeRepository.GetAllByEventVenueMappingId(eventVenueMappingModel.Id);
                            eventVenueMappingTimeModel = Mapper.Map <IEnumerable <EventVenueMappingTime> >(eventVenueMappingTimeDataModel).ToList();
                        }

                        var CityList            = venueDetailDataModel.Select(s => s.CityId);
                        var cityDetailDataModel = _cityRepository.GetByCityIds(CityList);
                        var cityModel           = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.City> >(cityDetailDataModel);

                        var eventTicketDetailList      = eventDetailModelDataModel.Select(s => s.Id);
                        var eventTicketDetailDataModel = _eventTicketDetailRepository.GetByEventDetailIds(eventTicketDetailList);
                        var eventTicketDetailModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketDetail> >(eventTicketDetailDataModel);

                        // For Getting Pone venue Images
                        var pOneImageEventDetailMapping = new List <Contracts.Models.POne.POneImageEventDetailMapping>();
                        if (eventModel.EventSourceId == EventSource.POne)
                        {
                            var pOneEventDetailMappings = _pOneEventDetailMappingRepository.GetByEventDetailIds(eventTicketDetailModel.Select(s => s.EventDetailId).Distinct().ToList());
                            var allTicketCategories     = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetailModel.Select(s => s.TicketCategoryId).Distinct().ToList());
                            var allPoneETD = _pOneEventTicketDetailRepository.GetByManyPOneEventDetail(pOneEventDetailMappings.Select(s => s.POneEventDetailId).Distinct().ToList());
                            foreach (var item in eventTicketDetailModel)
                            {
                                var pOneEventDetailMappingData = pOneEventDetailMappings.Where(s => s.ZoongaEventDetailId == item.EventDetailId).FirstOrDefault();
                                var tc   = allTicketCategories.Where(s => s.Id == item.TicketCategoryId).FirstOrDefault();
                                var p1tc = _pOneTicketCategoryRepository.GetByName(tc.Name);
                                if (pOneEventDetailMappingData != null && p1tc != null)
                                {
                                    var p1etd = allPoneETD.Where(s => (s.POneEventDetailId == pOneEventDetailMappingData.POneEventDetailId && s.POneTicketCategoryId == p1tc.POneId)).FirstOrDefault();
                                    if (p1etd != null)
                                    {
                                        pOneImageEventDetailMapping.Add(new Contracts.Models.POne.POneImageEventDetailMapping
                                        {
                                            EventTicketDetailId = item.Id,
                                            ImageUrl            = p1etd.ImageUrl
                                        });
                                    }
                                }
                            }
                        }

                        var eventTicketDetailTicketCategoryMappings      = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(eventTicketDetailModel.Select(s => s.Id).ToList());
                        var eventTicketDetailTicketCategoryMappingsModel = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketDetailTicketCategoryTypeMapping> >(eventTicketDetailTicketCategoryMappings).ToList();

                        var matchAttribute = _matchAttributeRepository.GetByEventDetailIds(eventDetailModelDataModel.Select(ed => ed.Id).Distinct());
                        var team           = _teamRepository.GetAll();
                        var data           = _calendarProvider.GetCalendarData(eventModel.Id);
                        if (eventTicketDetailModel != null)
                        {
                            var ticketCategoryIdList    = eventTicketDetailModel.Select(s => s.TicketCategoryId);
                            var ticketCategoryDataModel = _ticketCategoryRepository.GetByEventDetailIds(ticketCategoryIdList);
                            var ticketCategoryModel     = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TicketCategory> >(ticketCategoryDataModel);

                            var eventTicketDetailIdList      = eventTicketDetailModel.Select(s => s.Id);
                            var eventTicketDetailIdDataModel = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetailIdList);
                            var eventTicketAttributeModel    = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketAttribute> >(eventTicketDetailIdDataModel);

                            var eventTicketAttributeIdList = eventTicketAttributeModel.Select(s => s.Id);
                            var ticketFeeDetailIdDataModel = _ticketFeeDetail.GetByEventTicketAttributeIds(eventTicketAttributeIdList);
                            var ticketFeeDetailModel       = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TicketFeeDetail> >(ticketFeeDetailIdDataModel);

                            var currencyList  = eventTicketAttributeModel.Select(s => s.CurrencyId).Distinct().FirstOrDefault();
                            var currencyModel = AutoMapper.Mapper.Map <Contracts.Models.CurrencyType>(_currencyTypeRepository.Get(currencyList));

                            var days      = _daysRepository.GetAll();
                            var daysModel = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Days> >(days);

                            var CountryRegionalOrganisation = _countryRegionalOrganisationMappingRepository.GetAll();

                            var eventAttribute = _eventAttributeRepository.GetByEventDetailIds(eventDetailModel.Select(s => (long)s.Id).ToList());

                            var           Country             = _countryRepository.GetAll();
                            var           Countrymodel        = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Country> >(Country);
                            List <string> reginalOrganisation = new List <string>();
                            reginalOrganisation.AddRange(Enum.GetNames(typeof(FIL.Contracts.Enums.RegionalOrganisation)));

                            // For Tiqet's gettting Checkout Details
                            TiqetProductCheckoutDetail
                                tiqetCheckoutDetailsModel = new TiqetProductCheckoutDetail();
                            List <ValidWithVariantModel> validWithVariantList = new List <ValidWithVariantModel>();
                            if (eventModel.EventSourceId == EventSource.Tiqets)
                            {
                                var tiqetEventDetailMapping = _tiqetEventDetailMappingRepository.GetByEventDetailId(eventDetailModel.ElementAt(0).Id);
                                var tiqetCheckoutDetails    = _tiqetProductCheckoutDetailRepository.GetByProductId(tiqetEventDetailMapping.ProductId);
                                tiqetCheckoutDetailsModel = Mapper.Map <TiqetProductCheckoutDetail>(tiqetCheckoutDetails);
                                // for checking valid with tiqetVariant details
                                var tiqetVariantDetails = _tiqetVariantDetailRepository.GetAllByProductId(tiqetCheckoutDetailsModel.ProductId);

                                List <long> eventTicketDetailIds = new List <long>();
                                foreach (var currentVariantDetail in tiqetVariantDetails)
                                {
                                    if (currentVariantDetail.ValidWithVariantIds != null && currentVariantDetail.ValidWithVariantIds != "")
                                    {
                                        ValidWithVariantModel validWithVariantModel = new ValidWithVariantModel();
                                        var validWithVariantIds = currentVariantDetail.ValidWithVariantIds.Split(",");
                                        foreach (var currentValidvariantId in validWithVariantIds)
                                        {
                                            var currentValidVariantDetail = tiqetVariantDetails.Where(s => s.VariantId == Convert.ToInt64(currentValidvariantId)).FirstOrDefault();
                                            if (currentValidVariantDetail != null)
                                            {
                                                var eventTicketDetailMapping = _tiqetEventTicketDetailMappingRepository.GetByTiqetVariantId(currentValidVariantDetail.Id);
                                                eventTicketDetailIds.Add(eventTicketDetailMapping.EventTicketDetailId);
                                            }
                                        }
                                        var currentEventTicketDetailMapping = _tiqetEventTicketDetailMappingRepository.GetByTiqetVariantId(currentVariantDetail.Id);
                                        validWithVariantModel.EventTicketDetailId          = currentEventTicketDetailMapping.EventTicketDetailId;
                                        validWithVariantModel.ValidWithEventTicketDetailId = eventTicketDetailIds;
                                        validWithVariantList.Add(validWithVariantModel);
                                    }
                                }
                            }
                            // Check for Hoho Places if any
                            FIL.Contracts.DataModels.CitySightSeeingTicketDetail citySightSeeingTicketDetail = new FIL.Contracts.DataModels.CitySightSeeingTicketDetail();
                            var citySightSeeingEventDetailMapping = _citySightSeeingEventDetailMappingRepository.GetByEventDetailId(eventDetailModel.ElementAt(0).Id);
                            if (citySightSeeingEventDetailMapping != null)
                            {
                                var citySightSeeingTickets = _citySightSeeingTicketRepository.Get(citySightSeeingEventDetailMapping.CitySightSeeingTicketId);
                                citySightSeeingTicketDetail = _citySightSeeingTicketDetailRepository.GetByTicketId(citySightSeeingTickets.TicketId);
                            }
                            //Get Host Details for FIL Online Events
                            var eventHostMappingList = new List <FIL.Contracts.DataModels.EventHostMapping>();
                            var formattedDateString  = "";
                            if (eventDataModel.MasterEventTypeId == MasterEventType.Online)
                            {
                                eventHostMappingList = _eventHostMappingRepository.GetAllByEventId(eventDataModel.Id).ToList();
                                var formattedDateTime = _localTimeZoneConvertProvider.ConvertToLocal(eventDetailModel.FirstOrDefault().StartDateTime, eventAttribute.FirstOrDefault().TimeZone);
                                formattedDateString = formattedDateTime.DayOfWeek + ", " + formattedDateTime.ToString(@"MMM dd, yyyy, hh:mm tt", new CultureInfo("en-US"));
                            }
                            //Get Recurrance Schedule
                            List <FIL.Contracts.Models.CreateEventV1.EventRecurranceScheduleModel> recurranceScheduleModels = new List <Contracts.Models.CreateEventV1.EventRecurranceScheduleModel>();
                            if (eventDetailModel.FirstOrDefault().EventFrequencyType == EventFrequencyType.Recurring)
                            {
                                recurranceScheduleModels = _getScheduleDetailProvider.GetScheduleDetails(eventDataModel.Id, DateTime.UtcNow, DateTime.UtcNow, false, true).Where(s => s.EndDateTime > DateTime.UtcNow).ToList();
                            }
                            try
                            {
                                return(new TicketCategoryQueryResult
                                {
                                    Event = eventModel,
                                    EventDetail = eventDetailModel,
                                    EventTicketAttribute = eventTicketAttributeModel,
                                    TicketFeeDetail = ticketFeeDetailModel,
                                    Venue = venueDetailModel,
                                    City = cityModel,
                                    EventTicketDetail = eventTicketDetailModel,
                                    TicketCategory = ticketCategoryModel,
                                    CurrencyType = currencyModel,
                                    RASVTicketTypeMappings = RASVTicketTypeMappingsModel,
                                    EventDeliveryTypeDetails = eventDeliveryTypeDetailModel,
                                    EventCategory = eventModel.EventCategoryId,
                                    MatchAttribute = Mapper.Map <IEnumerable <MatchAttribute> >(matchAttribute),
                                    Team = Mapper.Map <IEnumerable <Team> >(team),
                                    PlaceCustomerDocumentTypeMappings = placeDocumentModel,
                                    PlaceHolidayDates = placeHolidyDatesModel,
                                    PlaceWeekOffs = placeWeekOffModel,
                                    CustomerDocumentTypes = CustomerDocumentTypeModel,
                                    TicketCategorySubTypes = ticketCategorySubType.ToList(),
                                    TicketCategoryTypes = ticketCategoryType.ToList(),
                                    EventTicketDetailTicketCategoryTypeMappings = eventTicketDetailTicketCategoryMappingsModel,
                                    EventCategoryMappings = eventCategoryMappings,
                                    RegularTimeModel = data.RegularTimeModel,
                                    SeasonTimeModel = data.SeasonTimeModel,
                                    SpecialDayModel = data.SpecialDayModel,
                                    EventVenueMappings = eventVenueMappingModel,
                                    EventVenueMappingTimes = eventVenueMappingTimeModel,
                                    EventTimeSlotMappings = eventTimeSlotMappings,
                                    PlaceWeekOpenDays = placeOpenDaysModel,
                                    Days = daysModel,
                                    CountryRegionalOrganisationMappings = CountryRegionalOrganisation.ToList(),
                                    Countries = Countrymodel,
                                    Category = category,
                                    SubCategory = subCategory,
                                    RegionalOrganisation = reginalOrganisation,
                                    TiqetsCheckoutDetails = tiqetCheckoutDetailsModel,
                                    ValidWithVariantModel = validWithVariantList,
                                    CitySightSeeingTicketDetail = Mapper.Map <FIL.Contracts.Models.CitySightSeeing.CitySightSeeingTicketDetail>(citySightSeeingTicketDetail),
                                    POneImageEventDetailMapping = pOneImageEventDetailMapping,
                                    EventHostMapping = eventHostMappingList,
                                    EventAttributes = eventAttribute.ToList(),
                                    eventRecurranceScheduleModels = recurranceScheduleModels,
                                    ASIMonument = ASIMonument,
                                    FormattedDateString = formattedDateString
                                });
                            }
                            catch (Exception e)
                            {
                                return(new TicketCategoryQueryResult
                                {
                                });
                            }
                        }
                        else
                        {
                            return(new TicketCategoryQueryResult
                            {
                                Event = eventModel,
                                EventDetail = eventDetailModel,
                                EventTicketAttribute = null,
                                TicketFeeDetail = null,
                                Venue = venueDetailModel,
                                City = cityModel,
                                EventTicketDetail = eventTicketDetailModel,
                                TicketCategory = null,
                                CurrencyType = null,
                                RASVTicketTypeMappings = RASVTicketTypeMappingsModel,
                                EventDeliveryTypeDetails = eventDeliveryTypeDetailModel,
                                EventCategory = eventModel.EventCategoryId,
                                MatchAttribute = null,
                                Team = null,
                                CitySightSeeingTicketDetail = null
                            });
                        }
                    }
                    else
                    {
                        return(new TicketCategoryQueryResult {
                        });
                    }
                }
                else
                {
                    return(new TicketCategoryQueryResult {
                    });
                }
            }
            catch (Exception e)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, e);
                return(new TicketCategoryQueryResult {
                });
            }
        }
Exemplo n.º 13
0
        public List <FeelExportContainer> Get()
        {
            var eventDataModel       = _eventRepository.GetEventsForIA(true);
            var feelExportContainers = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Export.FeelExportContainer> >(eventDataModel);

            foreach (Contracts.Models.Export.FeelExportContainer item in feelExportContainers)
            {
                var eventCategoryDataModel = _eventCategoryRepository.Get(item.CategoryId);
                var eventCategoryModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryDataModel);

                var eventCategoryParentDataModel = _eventCategoryRepository.Get(eventCategoryModel.EventCategoryId);
                var eventCategoryParentModel     = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(eventCategoryParentDataModel);

                item.ParentImage1       = "https://static1.feelaplace.com/images/places/about/" + item.ParentId.ToString().ToUpper() + "-about.jpg";
                item.ParentUrl          = "https://www.feelaplace.com/place/" + eventCategoryParentModel.DisplayName.Replace("&", "and").Replace(" ", "-").ToLower() + "/" + item.Slug.ToString() + "/" + eventCategoryModel.DisplayName.Replace("&", "and").Replace(" ", "-").ToLower();
                item.CategoryName       = eventCategoryModel.DisplayName;
                item.ParentCategoryId   = eventCategoryParentModel.Id;
                item.ParentCategoryName = eventCategoryParentModel.Category;
            }
            return(feelExportContainers.ToList());
            //return eventDataModel.SelectMany(eId =>
            //{
            //    var tEventDetails = _eventDetailRepository.GetByEventId(eId.Id);
            //    if (tEventDetails == null)
            //    {
            //        return new List<FeelExportContainer>();
            //    }
            //    var tEventTicketDetail = _eventTicketDetailRepository.GetByEventDetailId(tEventDetails.Id).ToList();

            //    var tEventTickDetailLookup = tEventTicketDetail
            //        .ToDictionary(etd => etd.Id);
            //    var ticketCategories = _ticketCategoryRepository
            //        .GetByTicketCategoryIds(tEventTicketDetail.Select(etd => etd.TicketCategoryId).Distinct())
            //        .ToDictionary(tc => tc.Id);
            //    var tEventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(tEventTickDetailLookup.Keys);
            //    var tSiteDetail = _eventSiteIdMappingRepository.GetByEventId(tEventDetails.EventId);
            //    var tVenueDetail = _venueRepository.GetByVenueId(tEventDetails.VenueId);
            //    var tCityDetail = _cityRepository.GetByCityId(tVenueDetail.CityId);
            //    var tStateDetail = _stateRepository.GetByStateId(tCityDetail.StateId);
            //    var tCountryDetail = _countryRepository.GetByCountryId(tStateDetail.CountryId);

            //    var eventCategoryDataModel = _eventCategoryRepository.Get(eId.EventCategoryId);
            //    var eventCategoryModel = AutoMapper.Mapper.Map<Contracts.Models.EventCategory>(eventCategoryDataModel);

            //    var eventCategoryParentDataModel = _eventCategoryRepository.Get(eventCategoryModel.EventCategoryId);
            //    var eventCategoryParentModel = AutoMapper.Mapper.Map<Contracts.Models.EventCategory>(eventCategoryParentDataModel);

            //    return tEventTicketAttribute.Select(etd =>
            //    {
            //        var tEventTicketDetails = tEventTickDetailLookup[etd.EventTicketDetailId];
            //        var tTicketCategory = ticketCategories[(int)tEventTicketDetails.TicketCategoryId];

            //        return new FeelExportContainer
            //        {
            //            Id = etd.Id,
            //            SiteId = (int)tSiteDetail.SiteId,
            //            ParentId = eId.AltId,
            //            ParentName = eId.Name,
            //            ParentDescription = eId.Description,
            //            ParentImage1 = "https://static1.feelaplace.com/images/event/AboutEvent/" + eId.AltId.ToString().ToUpper() + "-about.jpg",
            //            ParentUrl = "https://www.feelaplace.com/place/" + eventCategoryParentModel.DisplayName.Replace("&", "and").Replace(" ", "-").ToLower() + "/" + eId.Slug.ToString() + "/" + eventCategoryModel.DisplayName.Replace("&", "and").Replace(" ", "-").ToLower(),
            //            CategoryId = (int)eId.EventCategoryId,
            //            CategoryName = eId.EventCategoryId.ToString(),
            //            ParentCategoryId = eventCategoryParentModel.Id,
            //            ParentCategoryName = eventCategoryParentModel.Category,
            //            Name = tTicketCategory.Name,
            //            Description = etd.TicketCategoryDescription,
            //            Price = etd.Price,
            //            CityId = tCityDetail.Id,
            //            CityName = tCityDetail.Name,
            //            StateId = tStateDetail.Id,
            //            StateName = tStateDetail.Name,
            //            CountryId = tCountryDetail.Id,
            //            CountryName = tCountryDetail.Name
            //        };
            //    });
            //}).ToList();
        }
 protected override async Task <ICommandResult> Handle(StripeConnectAccountCommand command)
 {
     try
     {
         var eventData = _eventRepository.GetByAltId(command.EventId);
         if (eventData != null)
         {
             var eventDetails          = _eventDetailRepository.GetByEventId(eventData.Id);
             var eventTicketDetails    = _eventTicketDetailRepository.GetByEventDetailId(eventDetails.Id);
             var ticketCategories      = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId));
             var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetails.Select(s => s.Id));
             var placeWeekOpenDay      = _placeWeekOpenDaysRepository.GetByEventId(eventData.Id).FirstOrDefault();
             var dayTimeMappings       = _dayTimeMappingsRepository.GetAllByPlaceWeekOpenDay(placeWeekOpenDay.Id).FirstOrDefault();
             var eventCategoryMappings = _eventCategoryMappingRepository.GetByEventId(eventData.Id).FirstOrDefault();
             var subCategory           = _eventCategoryRepository.Get(eventCategoryMappings.EventCategoryId);
             var user           = _userRepository.GetByAltId(eventData.CreatedBy);
             var currencyType   = _currencyTypeRepository.Get(eventTicketAttributes.FirstOrDefault().CurrencyId);
             var eventAttribute = _eventAttributeRepository.GetByEventDetailId(eventDetails.Id);
             eventDetails.StartDateTime = _localTimeZoneConvertProvider.ConvertToLocal(eventDetails.StartDateTime, eventAttribute.TimeZone);
             var stripeConnectAccountId = command.IsStripeConnect ? _generateStripeConnectProvider.GenerateStripeAccessToken(command.AuthorizationCode, command.channels, eventData.Id) : null;
             if (stripeConnectAccountId != null && stripeConnectAccountId != "")
             {
                 var eventStripeConnect = _eventStripeConnectMasterRepository.GetByEventId(eventData.Id);
                 var eventStepDetails   = _stepProvider.SaveEventStepDetails(eventData.Id, 9, true, command.ModifiedBy);
                 var stripeConnnect     = new EventStripeConnectMaster
                 {
                     Id = eventStripeConnect != null ? eventStripeConnect.Id : 0,
                     StripeConnectAccountID = stripeConnectAccountId,
                     CreatedBy                = eventStripeConnect != null ? eventStripeConnect.CreatedBy : command.ModifiedBy,
                     CreatedUtc               = eventStripeConnect != null ? eventStripeConnect.CreatedUtc : DateTime.UtcNow,
                     ExtraCommisionFlat       = command.ExtraCommisionFlat,
                     ExtraCommisionPercentage = command.ExtraCommisionPercentage,
                     EventId    = eventData.Id,
                     IsEnabled  = true,
                     ModifiedBy = command.ModifiedBy,
                     UpdatedBy  = command.ModifiedBy,
                     UpdatedUtc = DateTime.UtcNow,
                 };
                 _eventStripeConnectMasterRepository.Save(stripeConnnect);
             }
             return(new StripeConnectAccountCommandResult
             {
                 Success = true,
                 EventTicketAttribute = eventTicketAttributes.ToList(),
                 DayTimeMappings = dayTimeMappings,
                 Event = eventData,
                 EventDetail = eventDetails,
                 EventTicketDetail = eventTicketDetails.ToList(),
                 TicketCategories = ticketCategories.ToList(),
                 ParentCategoryId = subCategory.EventCategoryId,
                 CurrencyType = currencyType,
                 Email = user.Email
             });
         }
         else
         {
             return(new StripeConnectAccountCommandResult {
             });
         }
     }
     catch (Exception e)
     {
         _logger.Log(FIL.Logging.Enums.LogCategory.Error, e);
         return(new StripeConnectAccountCommandResult {
         });
     }
 }
Exemplo n.º 15
0
        public OrderConfirmationQueryResult Get(
            long transactionId,
            bool isConfirmationFromMyOrders,
            FIL.Contracts.Enums.Channels channel)
        {
            var transactionScheduleDetails = new List <FIL.Contracts.DataModels.TransactionScheduleDetail>();
            var scheduleDetails            = new List <FIL.Contracts.DataModels.ScheduleDetail>();
            var transaction = _transactionRepository.GetSuccessfulTransactionDetails(transactionId);
            var transactionModel = AutoMapper.Mapper.Map <FIL.Contracts.Models.Transaction>(transaction);
            var IsASI = false; var IsHoho = false;

            if (transactionModel == null)
            {
                return(new OrderConfirmationQueryResult());
            }

            var transactionDetails     = _transactionDetailsRepository.GetByTransactionId(transactionModel.Id);
            var transactionDetailModel = AutoMapper.Mapper.Map <List <TransactionDetail> >(transactionDetails);

            var eventTicketAttributeDetails = _eventTicketAttributeRepository.GetByEventTicketAttributeIds(transactionDetails.Select(s => s.EventTicketAttributeId));

            var eventTicketDetails     = _eventTicketDetailRepository.GetByEventTicketDetailIds(eventTicketAttributeDetails.Select(s => s.EventTicketDetailId));
            var eventTicketDetailModel = AutoMapper.Mapper.Map <List <EventTicketDetail> >(eventTicketDetails);

            var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId));
            var eventDetails     = _eventDetailRepository.GetByEventDetailIds(eventTicketDetails.Select(s => s.EventDetailId).Distinct());
            var eventAttribute   = _eventAttributeRepository.GetByEventDetailIds(eventTicketDetails.Select(s => s.EventDetailId).Distinct());

            var eventDetailModel = AutoMapper.Mapper.Map <List <EventDetail> >(eventDetails);
            var venues           = _venueRepository.GetByVenueIds(eventDetailModel.Select(s => s.VenueId));
            var city             = _cityRepository.GetByCityIds(venues.Select(s => s.CityId));
            var state            = _stateRepository.GetByStateIds(city.Select(s => s.StateId));
            var country          = _countryRepository.GetByCountryIds(state.Select(s => s.CountryId));

            if (channel == Contracts.Enums.Channels.Feel && eventDetailModel.FirstOrDefault().EventFrequencyType == Contracts.Enums.EventFrequencyType.Recurring)
            {
                transactionScheduleDetails = _transactionScheduleDetail.GetAllByTransactionDetails(transactionDetailModel.Select(s => s.Id).ToList()).ToList();
                scheduleDetails            = _scheduleDetailRepository.GetAllByIds(transactionScheduleDetails.Select(s => s.ScheduleDetailId).ToList()).ToList();
            }
            List <FIL.Contracts.DataModels.Event> events = new List <FIL.Contracts.DataModels.Event>();

            if (isConfirmationFromMyOrders == true)
            {
                events = _eventRepository.GetByAllEventIds(eventDetails.Select(s => s.EventId).Distinct()).ToList();
            }
            else
            {
                events = _eventRepository.GetByAllTypeEventIds(eventDetails.Select(s => s.EventId).Distinct()).ToList();
            }

            var transactionPaymentDetails = _transactionPaymentDetailRepository.GetAllByTransactionId(transactionId);
            var transactionPaymentDetail  = transactionPaymentDetails.Where(s => s.UserCardDetailId != null).FirstOrDefault();
            var currencyDetail            = _currencyTypeRepository.GetByCurrencyId(transactionModel.CurrencyId);
            var paymentOption             = (dynamic)null;
            var userCardDetail            = (dynamic)null;

            if (transactionPaymentDetail != null)
            {
                paymentOption  = transactionPaymentDetail.PaymentOptionId.ToString();
                userCardDetail = _userCardDetailRepository.GetByUserCardDetailId(transactionPaymentDetail.UserCardDetailId);
            }
            var cardTypes = (dynamic)null;

            if (userCardDetail != null)
            {
                cardTypes = userCardDetail.CardTypeId.ToString();
            }

            var orderConfirmationSubContainer = events.Select(eId =>
            {
                var tEvent       = events.Where(s => s.Id == eId.Id).FirstOrDefault();
                var tEventDetail = _eventDetailRepository.GetByEventIdAndEventDetailId(eId.Id, eventDetails.Select(edId => edId.Id)).OrderBy(s => s.StartDateTime).OrderByDescending(od => od.Id);

                var subEventContainer = tEventDetail.Select(edetail =>
                {
                    var teventCategory = new FIL.Contracts.DataModels.EventCategory();
                    if (channel == FIL.Contracts.Enums.Channels.Feel)
                    {
                        var eventCategotyMappings = _eventCategoryMappingRepository.GetByEventId(tEvent.Id).FirstOrDefault();
                        if (eventCategotyMappings != null)
                        {
                            teventCategory = _eventCategoryRepository.Get(eventCategotyMappings.EventCategoryId);
                        }
                    }
                    else
                    {
                        teventCategory = _eventCategoryRepository.Get(tEvent.EventCategoryId);
                    }
                    var tEventDetails    = eventDetails.Where(s => s.Id == edetail.Id).FirstOrDefault();
                    var tEventAttributes = eventAttribute.Where(s => s.EventDetailId == tEventDetails.Id).FirstOrDefault();
                    var tVenue           = venues.Where(s => s.Id == edetail.VenueId).FirstOrDefault();
                    var tCity            = city.Where(s => s.Id == tVenue.CityId).FirstOrDefault();
                    var tState           = state.Where(s => s.Id == tCity.StateId).FirstOrDefault();
                    var tCountry         = country.Where(s => s.Id == tState.CountryId).FirstOrDefault();

                    var tEventTicketDetail = _eventTicketDetailRepository.GetByEventDetailIdsAndIds(tEventDetail.Where(w => w.Id == edetail.Id).Select(s => s.Id), eventTicketDetailModel.Select(s => s.Id));

                    var tEventTicketAttribute = eventTicketAttributeDetails.Where(x => tEventTicketDetail.Any(y => y.Id == x.EventTicketDetailId));

                    var tTicketCategory = ticketCategories.Where(x => tEventTicketDetail.Any(y => y.TicketCategoryId == x.Id));

                    var tTransactionDetail = transactionDetails.Where(x => tEventTicketAttribute.Any(y => y.Id == x.EventTicketAttributeId)).ToList();
                    List <MatchLayoutSectionSeat> tMatchLayoutSectionSeats = new List <MatchLayoutSectionSeat>();
                    List <FIL.Contracts.DataModels.MatchLayoutCompanionSeatMapping> tMatchLayoutCompanionSeatMapping = new List <FIL.Contracts.DataModels.MatchLayoutCompanionSeatMapping>();

                    var tMatchSeatTicketDetails = _matchSeatTicketDetailRepository.GetByTransactionIdAndTicketDetailIds(tTransactionDetail.Select(w => w.TransactionId).FirstOrDefault(), tEventTicketDetail.Select(w => w.Id));
                    if (tMatchSeatTicketDetails.Any())
                    {
                        var matchSeatTicketDetails = tMatchSeatTicketDetails.Where(w => w.MatchLayoutSectionSeatId != null).FirstOrDefault();
                        if (matchSeatTicketDetails != null)
                        {
                            tMatchLayoutSectionSeats         = AutoMapper.Mapper.Map <List <MatchLayoutSectionSeat> >(_matchLayoutSectionSeatRepository.GetByIds(tMatchSeatTicketDetails.Select(s => (long)s.MatchLayoutSectionSeatId).Distinct()));
                            tMatchLayoutCompanionSeatMapping = AutoMapper.Mapper.Map <List <FIL.Contracts.DataModels.MatchLayoutCompanionSeatMapping> >(_matchLayoutCompanionSeatMappingRepository.GetByWheelChairSeatIds(tMatchLayoutSectionSeats.Select(s => s.Id).Distinct()));
                        }
                    }

                    var taSITransactionDetailTimeSlotIdMapping = _aSITransactionDetailTimeSlotIdMappingRepository.GetByTransactionDetailIds(tTransactionDetail.Select(s => s.Id));
                    var tGuestDetails = _guestDetailRepository.GetByTransactionDetailIds(tTransactionDetail.Select(s => s.Id));
                    var taSIPaymentResponseDetailTicketMappings = _aSIPaymentResponseDetailTicketMappingRepository.GetByVisitorIds(tGuestDetails.Select(s => (long)s.Id).ToList());
                    var teventTimeSlotMapping = _eventTimeSlotMappingRepository.GetByIds(taSITransactionDetailTimeSlotIdMapping.Select(s => s.EventTimeSlotMappingId));
                    if (tEvent.EventSourceId == Contracts.Enums.EventSource.ASI)
                    {
                        IsASI = true;
                        foreach (FIL.Contracts.DataModels.TransactionDetail currentTransacitionDetail in tTransactionDetail)
                        {
                            var visitDate = (DateTime)currentTransacitionDetail.VisitDate;
                            currentTransacitionDetail.VisitDate = visitDate.AddHours(5).AddMinutes(30);
                        }
                    }

                    if (tEvent.EventSourceId == Contracts.Enums.EventSource.CitySightSeeing)
                    {
                        IsHoho = true;
                    }
                    var tEventDeliveryTypeDetail = _eventDeliveryTypeDetailRepository.GetByEventDetailIds(tEventDetail.Select(s => s.Id));

                    var tTransactionDeliveryDetail = _transactionDeliveryDetailRepository.GetByTransactionDetailIds(tTransactionDetail.Select(s => s.Id));

                    var tUser        = _userRepository.GetByAltId(transaction.CreatedBy);
                    var tUserAddress = (dynamic)null;
                    if (tUser != null)
                    {
                        tUserAddress = _userAddressDetailRepository.GetByUserId(tUser.Id).LastOrDefault();
                    }
                    var tZipCode = (dynamic)null;
                    if (tUserAddress != null)
                    {
                        tZipCode = _zipcodeRepository.Get(tUserAddress.Zipcode);
                    }
                    var transctionScheduleDetails = transactionScheduleDetails.Where(s => tTransactionDetail.Any(x => x.Id == s.TransactionDetailId)).ToList();
                    var scheduleDetail            = scheduleDetails.Where(s => transctionScheduleDetails.Any(x => x.ScheduleDetailId == s.Id)).ToList();
                    return(new SubEventContainer
                    {
                        Event = AutoMapper.Mapper.Map <Event>(tEvent),
                        EventCategory = AutoMapper.Mapper.Map <EventCategory>(teventCategory),
                        EventAttribute = AutoMapper.Mapper.Map <EventAttribute>(tEventAttributes),
                        EventDetail = AutoMapper.Mapper.Map <EventDetail>(tEventDetails),
                        Venue = AutoMapper.Mapper.Map <Venue>(tVenue),
                        City = AutoMapper.Mapper.Map <City>(tCity),
                        State = AutoMapper.Mapper.Map <State>(tState),
                        Country = AutoMapper.Mapper.Map <Country>(tCountry),
                        Zipcode = AutoMapper.Mapper.Map <Zipcode>(tZipCode),
                        EventTicketDetail = AutoMapper.Mapper.Map <IEnumerable <EventTicketDetail> >(tEventTicketDetail),
                        EventTicketAttribute = AutoMapper.Mapper.Map <IEnumerable <EventTicketAttribute> >(tEventTicketAttribute),
                        EventDeliveryTypeDetail = AutoMapper.Mapper.Map <IEnumerable <EventDeliveryTypeDetail> >(tEventDeliveryTypeDetail),
                        TicketCategory = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.Models.TicketCategory> >(tTicketCategory),
                        TransactionDetail = AutoMapper.Mapper.Map <IEnumerable <TransactionDetail> >(tTransactionDetail),
                        MatchSeatTicketDetail = AutoMapper.Mapper.Map <IEnumerable <MatchSeatTicketDetail> >(tMatchSeatTicketDetails),
                        MatchLayoutSectionSeat = AutoMapper.Mapper.Map <IEnumerable <MatchLayoutSectionSeat> >(tMatchLayoutSectionSeats),
                        MatchLayoutCompanionSeatMappings = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.DataModels.MatchLayoutCompanionSeatMapping> >(tMatchLayoutCompanionSeatMapping),
                        TransactionDeliveryDetail = AutoMapper.Mapper.Map <IEnumerable <TransactionDeliveryDetail> >(tTransactionDeliveryDetail),
                        EventTimeSlotMappings = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.Models.ASI.EventTimeSlotMapping> >(teventTimeSlotMapping),
                        ASITransactionDetailTimeSlotIdMappings = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.Models.ASI.ASITransactionDetailTimeSlotIdMapping> >(taSITransactionDetailTimeSlotIdMapping),
                        ASIPaymentResponseDetailTicketMappings = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.Models.ASI.ASIPaymentResponseDetailTicketMapping> >(taSIPaymentResponseDetailTicketMappings),
                        TransactionScheduleDetails = transctionScheduleDetails,
                        ScheduleDetails = scheduleDetail
                    });
                });

                return(new OrderConfirmationSubContainer
                {
                    Event = AutoMapper.Mapper.Map <Event>(tEvent),
                    subEventContainer = subEventContainer.ToList()
                });
            });

            decimal TotalGst      = 0;
            decimal GST           = 0;
            decimal AdditionalGST = 0;

            try
            {
                if (transactionModel != null)
                {
                    if (orderConfirmationSubContainer.Any() && orderConfirmationSubContainer.ToList().ElementAt(0).Event.AltId.ToString().ToUpper() == "1F0257FA-EEA6-4469-A7BC-B878A215C8A9") //RASV Email
                    {
                        TotalGst = (decimal)transactionModel.ConvenienceCharges / 11;
                    }
                }
            }
            catch (Exception e)
            {
            }

            return(new OrderConfirmationQueryResult
            {
                Transaction = transactionModel,
                TransactionPaymentDetail = AutoMapper.Mapper.Map <FIL.Contracts.Models.TransactionPaymentDetail>(transactionPaymentDetail),
                UserCardDetail = AutoMapper.Mapper.Map <FIL.Contracts.Models.UserCardDetail>(userCardDetail),
                CurrencyType = AutoMapper.Mapper.Map <FIL.Contracts.Models.CurrencyType>(currencyDetail),
                PaymentOption = paymentOption,
                GoodsAndServiceTax = TotalGst,
                cardTypes = cardTypes,
                orderConfirmationSubContainer = orderConfirmationSubContainer.ToList(),
                TicketQuantity = eventTicketAttributeDetails.ToArray().Length,
                IsASI = IsASI,
                IsHoho = IsHoho
            });
        }
Exemplo n.º 16
0
        public ActionResult <EventCategory> GetById(int id)
        {
            EventCategory eventCategory = _eventCategoryRepository.Get(id);

            return(eventCategory != null ? (ActionResult <EventCategory>)Ok(eventCategory) : NotFound());
        }
Exemplo n.º 17
0
        public CurrentOrderDataQueryResult Handle(CurrentOrderDataQuery query)
        {
            var transaction = _transactionRepository.GetByAltId(query.TransactionAltId);

            if (transaction == null)
            {
                return(new CurrentOrderDataQueryResult
                {
                });
            }

            var transactionDetails     = _transactionDetailRepository.GetByTransactionId(transaction.Id);
            var transactionDetailModel = AutoMapper.Mapper.Map <List <Contracts.Models.TransactionDetail> >(transactionDetails);

            var eventTicketAttributeDetails = _eventTicketAttributeRepository.GetByEventTicketAttributeIds(transactionDetails.Select(s => s.EventTicketAttributeId));

            var eventTicketDetails     = _eventTicketDetailRepository.GetByEventTicketDetailIds(eventTicketAttributeDetails.Select(s => s.EventTicketDetailId));
            var eventTicketDetailModel = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketDetail> >(eventTicketDetails);

            var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId));
            var eventDetails     = _eventDetailRepository.GetByEventDetailIds(eventTicketDetails.Select(s => s.EventDetailId).Distinct());
            var eventAttribute   = _eventAttributeRepository.GetByEventDetailIds(eventTicketDetails.Select(s => s.EventDetailId).Distinct());

            var eventDetailModel = AutoMapper.Mapper.Map <List <Contracts.Models.EventDetail> >(eventDetails);
            var venues           = _venueRepository.GetByVenueIds(eventDetailModel.Select(s => s.VenueId));
            var city             = _cityRepository.GetByCityIds(venues.Select(s => s.CityId));
            var state            = _stateRepository.GetByStateIds(city.Select(s => s.StateId));
            var country          = _countryRepository.GetByCountryIds(state.Select(s => s.CountryId));

            List <FIL.Contracts.DataModels.Event> events = events = _eventRepository.GetByAllEventIds(eventDetails.Select(s => s.EventId).Distinct()).ToList();

            var currencyDetail = _currencyTypeRepository.GetByCurrencyId(transaction.CurrencyId);
            var orderConfirmationSubContainer = events.Select(eId =>
            {
                var tEvent            = events.Where(s => s.Id == eId.Id).FirstOrDefault();
                var tEventDetail      = _eventDetailRepository.GetByEventIdAndEventDetailId(eId.Id, eventDetails.Select(edId => edId.Id)).OrderBy(s => s.StartDateTime).OrderByDescending(od => od.Id);
                var subEventContainer = tEventDetail.Select(edetail =>
                {
                    var teventCategory        = new FIL.Contracts.DataModels.EventCategory();
                    var eventCategotyMappings = _eventCategoryMappingRepository.GetByEventId(tEvent.Id).FirstOrDefault();
                    if (eventCategotyMappings != null)
                    {
                        teventCategory = _eventCategoryRepository.Get(eventCategotyMappings.EventCategoryId);
                    }
                    var tEventDetails              = eventDetails.Where(s => s.Id == edetail.Id).FirstOrDefault();
                    var tEventAttributes           = eventAttribute.Where(s => s.EventDetailId == tEventDetails.Id).FirstOrDefault();
                    var tVenue                     = venues.Where(s => s.Id == edetail.VenueId).FirstOrDefault();
                    var tCity                      = city.Where(s => s.Id == tVenue.CityId).FirstOrDefault();
                    var tState                     = state.Where(s => s.Id == tCity.StateId).FirstOrDefault();
                    var tCountry                   = country.Where(s => s.Id == tState.CountryId).FirstOrDefault();
                    var tEventTicketDetail         = _eventTicketDetailRepository.GetByEventDetailIdsAndIds(tEventDetail.Where(w => w.Id == edetail.Id).Select(s => s.Id), eventTicketDetailModel.Select(s => s.Id));
                    var tEventTicketAttribute      = eventTicketAttributeDetails.Where(x => tEventTicketDetail.Any(y => y.Id == x.EventTicketDetailId));
                    var tTicketCategory            = ticketCategories.Where(x => tEventTicketDetail.Any(y => y.TicketCategoryId == x.Id));
                    var tTransactionDetail         = transactionDetails.Where(x => tEventTicketAttribute.Any(y => y.Id == x.EventTicketAttributeId)).ToList();
                    var tEventDeliveryTypeDetail   = _eventDeliveryTypeDetailRepository.GetByEventDetailIds(tEventDetail.Select(s => s.Id));
                    var tTransactionDeliveryDetail = _transactionDeliveryDetailRepository.GetByTransactionDetailIds(tTransactionDetail.Select(s => s.Id));
                    var tUser                      = _userRepository.GetByAltId(transaction.CreatedBy);
                    var tUserAddress               = (dynamic)null;
                    if (tUser != null)
                    {
                        tUserAddress = _userAddressDetailRepository.GetByUserId(tUser.Id).LastOrDefault();
                    }
                    var tZipCode = (dynamic)null;
                    if (tUserAddress != null)
                    {
                        tZipCode = _zipcodeRepository.Get(tUserAddress.Zipcode);
                    }

                    return(new SubEventContainer
                    {
                        Event = AutoMapper.Mapper.Map <Contracts.Models.Event>(tEvent),
                        EventCategory = AutoMapper.Mapper.Map <Contracts.Models.EventCategory>(teventCategory),
                        EventAttribute = AutoMapper.Mapper.Map <Contracts.Models.EventAttribute>(tEventAttributes),
                        EventDetail = AutoMapper.Mapper.Map <Contracts.Models.EventDetail>(tEventDetails),
                        Venue = AutoMapper.Mapper.Map <Contracts.Models.Venue>(tVenue),
                        City = AutoMapper.Mapper.Map <Contracts.Models.City>(tCity),
                        State = AutoMapper.Mapper.Map <Contracts.Models.State>(tState),
                        Country = AutoMapper.Mapper.Map <Contracts.Models.Country>(tCountry),
                        Zipcode = AutoMapper.Mapper.Map <Contracts.Models.Zipcode>(tZipCode),
                        EventTicketDetail = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketDetail> >(tEventTicketDetail),
                        EventTicketAttribute = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketAttribute> >(tEventTicketAttribute),
                        EventDeliveryTypeDetail = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventDeliveryTypeDetail> >(tEventDeliveryTypeDetail),
                        TicketCategory = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.Models.TicketCategory> >(tTicketCategory),
                        TransactionDetail = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TransactionDetail> >(tTransactionDetail),
                        TransactionDeliveryDetail = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TransactionDeliveryDetail> >(tTransactionDeliveryDetail),
                    });
                });

                return(new OrderConfirmationSubContainer
                {
                    Event = AutoMapper.Mapper.Map <Contracts.Models.Event>(tEvent),
                    subEventContainer = subEventContainer.ToList()
                });
            });

            return(new CurrentOrderDataQueryResult
            {
                Transaction = AutoMapper.Mapper.Map <Contracts.Models.Transaction>(transaction),
                CurrencyType = AutoMapper.Mapper.Map <FIL.Contracts.Models.CurrencyType>(currencyDetail),
                orderConfirmationSubContainer = orderConfirmationSubContainer.ToList(),
                TicketQuantity = eventTicketAttributeDetails.ToArray().Length,
            });
        }
Exemplo n.º 18
0
        public FeelCategoryEventQueryResult Handle(FeelCategoryEventQuery query)
        {
            try
            {
                query.SiteId = FIL.Contracts.Enums.Site.feelaplaceSite;
                var countryDescription = new FIL.Contracts.DataModels.CountryDescription();
                var cityDescription    = new FIL.Contracts.DataModels.CityDescription();
                var countryContents    = new List <FIL.Contracts.DataModels.CountryContentMapping>();
                var indexEventId       = eventIdProvider(query);
                var siteEvents         = _eventSiteIdMappingRepository
                                         .GetBySiteId(query.SiteId)
                                         .OrderBy(o => o.SortOrder).ToList();
                var categoryEvents = _eventRepository.GetByAllEventIds(indexEventId)
                                     .Where(e => e.IsEnabled)
                                     .ToList();

                var eventMapping = categoryEvents.ToDictionary(e => e.Id);

                var eventIds = eventMapping.Keys;
                var eventCategoryMappings = _eventCategoryMappingRepository.GetByEventIds(eventIds).Where(ed => ed.IsEnabled == true);
                var allEventDetails       = _eventDetailRepository.GetByEventIds(eventIds).Where(ed => ed.IsEnabled == true);
                var allEventAttributes    = _eventAttributeRepository.GetByEventDetailIds(allEventDetails.Select(s => s.Id));
                var allEventTicketDetails = _eventTicketDetailRepository.GetAllByEventDetailIds(allEventDetails.Select(s => s.Id));
                var allEventTicketDetailTicketCategoryTypeMapping = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(allEventTicketDetails.Select(s => s.Id).ToList()).Where(s => s.TicketCategoryTypeId == 2);
                allEventTicketDetails = allEventTicketDetails.Where(s => allEventTicketDetailTicketCategoryTypeMapping.All(p => p.EventTicketDetailId != s.Id));
                var allLiveEventDetails = _liveEventDetailRepository.GetAllByEventIds(eventIds.ToList());
                var allEventRatings     = _ratingRepository.GetByEventIds(eventIds);
                var venueMapping        = _venueRepository.GetByVenueIds(allEventDetails.Select(ed => ed.VenueId).Distinct())
                                          .ToDictionary(v => v.Id);
                var eventDetailsMapping = allEventDetails.GroupBy(ed => ed.EventId)
                                          .ToDictionary(g => g.Key, g => g.ToList());
                var eventCategoryMapping = eventCategoryMappings.GroupBy(ed => ed.EventId)
                                           .ToDictionary(g => g.Key, g => g.ToList());
                var eventRatingMapping = allEventRatings.GroupBy(ed => ed.EventId)
                                         .ToDictionary(g => g.Key, g => g.ToList());

                var cityIds      = venueMapping.Values.Select(s => s.CityId).Distinct();
                var allCities    = _cityRepository.GetByCityIds(cityIds);
                var cityMapping  = allCities.ToDictionary(c => c.Id);
                var stateId      = cityMapping.Values.Select(c => c.StateId).Distinct();
                var stateMapping = _stateRepository.GetByStateIds(stateId)
                                   .ToDictionary(s => s.Id);
                var countryIdList  = stateMapping.Values.Select(s => s.CountryId).Distinct();
                var countryMapping = _countryRepository.GetByCountryIds(countryIdList)
                                     .ToDictionary(c => c.Id);
                if (query.IsCountryLandingPage)
                {
                    if (countryIdList.ToList().Any())
                    {
                        countryDescription = _countryDescriptionRepository.GetByCountryId(countryIdList.ToList().ElementAt(0));
                        countryContents    = _countryContentMappingRepository.GetByCountryId(countryIdList.ToList().ElementAt(0)).ToList();
                    }
                }
                if (query.IsCityLandingPage)
                {
                    if (cityIds.ToList().Any())
                    {
                        var cities = _cityRepository.GetAllByName(allCities.ElementAt(0).Name);
                        foreach (var currentCity in allCities)
                        {
                            cityDescription = _cityDescriptionRepository.GetBycityId(currentCity.Id);
                            if (cityDescription != null)
                            {
                                break;
                            }
                        }
                    }
                }
                var eventsBySortOrder = new List <FIL.Contracts.DataModels.Event>();
                foreach (var item in siteEvents)
                {
                    var events = categoryEvents.FirstOrDefault(w => w.Id == item.EventId);
                    if (events != null)
                    {
                        eventsBySortOrder.Add(AutoMapper.Mapper.Map <FIL.Contracts.DataModels.Event>(events));
                    }
                }
                eventsBySortOrder = eventsBySortOrder.Where(s => !s.IsTokenize).ToList();
                var CategoryEventData = eventsBySortOrder.Select(ce =>
                {
                    try
                    {
                        var eventObj           = eventMapping[ce.Id];
                        var EventCategory      = eventObj.EventCategoryId.ToString();
                        var parentCategory     = "";
                        var eventDetails       = eventDetailsMapping[ce.Id];
                        var eventAttribute     = allEventAttributes.Where(s => s.EventDetailId == eventDetails.FirstOrDefault().Id).FirstOrDefault();
                        var eventTicketDetails = allEventTicketDetails.Where(s => eventDetails.Exists(p => p.Id == s.EventDetailId));
                        var eventCategoryMap   = eventCategoryMapping[ce.Id];
                        if (eventCategoryMap.Any())
                        {
                            var eventCategory = _eventCategoryRepository.Get(eventCategoryMap.FirstOrDefault().EventCategoryId);
                            if (eventCategory != null)
                            {
                                EventCategory           = eventCategory.Slug;
                                var parentCategoryModel = _eventCategoryRepository.Get(eventCategory.EventCategoryId);
                                parentCategory          = parentCategoryModel.Slug;
                            }
                        }
                        List <FIL.Contracts.DataModels.Rating> eventRatings;
                        if (eventRatingMapping.ContainsKey(ce.Id))
                        {
                            eventRatings = eventRatingMapping[ce.Id];
                        }
                        else
                        {
                            eventRatings = null;
                        }
                        var eventDetailIdList       = eventDetails.Select(s => s.Id).Distinct().ToList();
                        var eventTicketDetailIdList = eventTicketDetails.Select(s => s.Id).Distinct().ToList();
                        var venues    = eventDetails.Select(s => s.VenueId).Distinct().Select(v => venueMapping[v]);
                        var cities    = venues.Select(s => s.CityId).Distinct().Select(c => cityMapping[c]);
                        var states    = cities.Select(s => s.StateId).Distinct().Select(s => stateMapping[s]);
                        var countries = states.Select(s => s.CountryId).Distinct().Select(c => countryMapping[c]);
                        var eventTicketAttributeMapping = new List <Contracts.DataModels.EventTicketAttribute>
                        {
                            _eventTicketAttributeRepository.GetMaxPriceByEventTicketDetailId(eventTicketDetailIdList),
                            _eventTicketAttributeRepository.GetMinPriceByEventTicketDetailId(eventTicketDetailIdList)
                        };
                        var currencyMapping            = _currencyTypeRepository.GetByCurrencyId(eventTicketAttributeMapping.Where(s => s.IsEnabled == true).ToList().First().CurrencyId);
                        List <string> eventCatMappings = new List <string>();
                        var eventCategoryDataModel     = _eventCategoryRepository.GetByIds(eventCategoryMap.Select(s => s.EventCategoryId));
                        foreach (var eventCat in eventCategoryDataModel)
                        {
                            eventCatMappings.Add(eventCat.DisplayName);
                        }
                        var localDateTime = eventDetails.FirstOrDefault().StartDateTime.DayOfWeek + ", " + eventDetails.FirstOrDefault().StartDateTime.ToString(@"MMM dd, yyyy HH:mm", new CultureInfo("en-US")).ToUpper();
                        if (eventAttribute != null)
                        {
                            localDateTime = eventDetails.FirstOrDefault().StartDateTime.DayOfWeek + ", " + _localTimeZoneConvertProvider.ConvertToLocal(eventDetails.FirstOrDefault().StartDateTime, eventAttribute.TimeZone).ToString(@"MMM dd, yyyy HH:mm", new CultureInfo("en-US")).ToUpper();
                        }

                        return(new CategoryEventContainer
                        {
                            CategoryEvent = Mapper.Map <Contracts.Models.CategoryEvent>(ce),
                            EventType = eventObj.EventTypeId.ToString(),
                            EventCategory = EventCategory,
                            City = Mapper.Map <IEnumerable <City> >(cities),
                            State = Mapper.Map <IEnumerable <State> >(states),
                            Country = Mapper.Map <IEnumerable <Country> >(countries),
                            Event = Mapper.Map <Event>(eventObj),
                            EventDetail = Mapper.Map <IEnumerable <EventDetail> >(eventDetails),
                            Rating = Mapper.Map <IEnumerable <Rating> >(eventRatings),
                            CurrencyType = Mapper.Map <CurrencyType>(currencyMapping),
                            Venue = Mapper.Map <IEnumerable <Venue> >(venues),
                            EventTicketAttribute = Mapper.Map <IEnumerable <EventTicketAttribute> >(eventTicketAttributeMapping),
                            EventCategories = eventCatMappings,
                            LocalStartDateTime = localDateTime,
                            TimeZoneAbbrivation = eventAttribute != null ? eventAttribute.TimeZoneAbbreviation : "UTC",
                            EventFrequencyType = eventDetails.FirstOrDefault().EventFrequencyType,
                            ParentCategory = parentCategory,
                            LiveEventDetail = allLiveEventDetails.Where(s => s.EventId == ce.Id).FirstOrDefault()
                        });
                    }
                    catch (Exception e)
                    {
                        return(new CategoryEventContainer
                        {
                        });
                    }
                });

                return(new FeelCategoryEventQueryResult
                {
                    CategoryEvents = CategoryEventData.ToList(),
                    CountryDescription = Mapper.Map <Contracts.Models.CountryDescription>(countryDescription),
                    CityDescription = cityDescription,
                    CountryContentMapping = Mapper.Map <List <CountryContentMapping> >(countryContents)
                });
            }
            catch (Exception e)
            {
                return(new FeelCategoryEventQueryResult
                {
                });
            }
        }