public BarcodeLookupQueryResult Handle(BarcodeLookupQuery query) { try { var eventTicketDetails = _eventTicketDetailRepository.GetRASVRideEventTicketDetails() .ToDictionary(k => k.Id); var matchSeatTicketDetails = _matchSeatTicketDetailRepository.GetByTransactionIdAndTicketDetailIds(query.TransactionId, eventTicketDetails.Keys) .ToList(); if (matchSeatTicketDetails.Any()) { var transaction = _transactionRepository.Get((long)matchSeatTicketDetails.First().TransactionId); var currency = _currencyTypeRepository.GetById(transaction.CurrencyId); var userAltId = transaction.CreatedBy; var userId = _userRepository.GetByAltId(userAltId).Id; var userAddressDetail = _userAddressDetailRepository.GetByUser(userId); var zipcodeId = userAddressDetail != null ? userAddressDetail.Zipcode : 9; var postalcode = _zipcodeRepository.Get(zipcodeId).Postalcode; // var ticketCategories = _ticketCategoryRepository.GetByEventDetailIds(eventTicketDetails.Keys).ToDictionary(k =>k.Id); var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.Value.TicketCategoryId)).ToDictionary(k => k.Id); var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Keys).ToDictionary(k => k.EventTicketDetailId); var barcodedetails = matchSeatTicketDetails.Select(mst => { var eventTicketDetail = eventTicketDetails[mst.EventTicketDetailId]; var attributes = eventTicketAttributes[eventTicketDetail.Id]; var value = JsonConvert.DeserializeObject <TicketValue>(attributes.AdditionalInfo).value; return(new BarcodeDetailsContainer { AltId = (System.Guid)mst.AltId, BarcodeNumber = mst.BarcodeNumber, CurrencyCode = currency.Code, TicketCategoryId = eventTicketDetail.TicketCategoryId, TicketCategory = ticketCategories[(int)eventTicketDetail.TicketCategoryId].Name, Value = value, Postalcode = postalcode, IsConsumed = mst.IsConsumed, ConsumedDateTime = mst.ConsumedDateTime, TransactionUTC = transaction.CreatedUtc, }); }); return(new BarcodeLookupQueryResult { BarcodeDetailsContainer = barcodedetails.ToList(), IsValid = true }); } } catch (Exception ex) { _logger.Log(Logging.Enums.LogCategory.Error, ex); } return(new BarcodeLookupQueryResult { BarcodeDetailsContainer = null, IsValid = false }); }
protected void UpdateAllOptions(SaveExOzProductOptionCommand command) { List <long> apiProductOptionIds = command.OptionList.Select(w => w.Id).ToList(); var exOzProductOptions = _exOzProductOptionRepository.GetByOptionIds(apiProductOptionIds); var eventTicketDetailIds = exOzProductOptions.Select(w => w.EventTicketDetailId).ToList(); var FilEventTicketDetails = _eventTicketDetailRepository.GetByIds(eventTicketDetailIds); var ticketCategoryIds = FilEventTicketDetails.Select(w => w.TicketCategoryId).ToList(); var FilTicketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(ticketCategoryIds); foreach (var item in command.OptionList) { int optionCount = command.OptionList.Where(w => w.SessionId == item.SessionId).ToList().Count; try { string TicketCategoryName = GetTicketCategoryName(item, optionCount); ExOzProductOption exOzProductOption = exOzProductOptions.Where(w => w.ProductOptionId == item.Id).FirstOrDefault(); ExOzProductSession exOzProductSession = _exOzProductSessionRepository.GetBySessionId(item.SessionId); ExOzProduct exOzProduct = _exOzProductRepository.Get(exOzProductSession.ProductId); EventTicketDetail FilEventTicketDetail = FilEventTicketDetails.Where(w => w.Id == exOzProductOption.EventTicketDetailId).FirstOrDefault(); TicketCategory FilTicketCategory = FilTicketCategories.Where(w => w.Name == TicketCategoryName).FirstOrDefault(); TicketCategory retTicketCategory = UpdateTicketCategory(TicketCategoryName, FilTicketCategory, command.ModifiedBy); EventTicketDetail retEventTicketDetail = UpdateEventTicketDetail(FilEventTicketDetail, exOzProduct.EventDetailId, retTicketCategory.Id, command.ModifiedBy); EventTicketAttribute eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(retEventTicketDetail.Id); EventTicketAttribute FilTicketAttribute = UpdateEventTicketAttribute(item, eventTicketAttribute, retEventTicketDetail.Id, command.ModifiedBy); TicketFeeDetail ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeId(FilTicketAttribute.EventTicketDetailId); TicketFeeDetail FilTicketFeedDetail = UpdateTicketFeeDetails(ticketFeeDetail, FilTicketAttribute.Id, command.ModifiedBy); ExOzProductOption retOption = updateProductOption(item, exOzProductOption, retEventTicketDetail.Id, exOzProductSession.Id, command.ModifiedBy); updatedOptions.OptionList.Add(retOption); } catch (Exception e) { throw; } } }
public ReviewsAndRatingQueryResult Handle(ReviewsAndRatingQuery query) { var userDataModel = _userRepository.GetByAltId(query.UserAltId); bool isPurchased = false; if (userDataModel.Email.Contains("feelaplace")) { isPurchased = true; } var transactionModel = _transactionRepository.GetByUserAltId(query.UserAltId); var transactionDetailmodel = _transactionDetailRepository.GetByTransactionIds(transactionModel.Select(s => s.Id)); var transDetailModel = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TransactionDetail> >(transactionDetailmodel); var eventTicketAttributeModel = _eventTicketAttributeRepository.GetByEventTicketAttributeIds(transactionDetailmodel.Select(s => s.EventTicketAttributeId)); var eventAttributeTicketModel = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketAttribute> >(eventTicketAttributeModel); var eventticketDetailModel = _eventTicketDetailRepository.GetByEventTicketDetailIds(eventTicketAttributeModel.Select(s => s.EventTicketDetailId)); var eventticketDetailModels = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketDetail> >(eventticketDetailModel); var ticketCategorymodel = _ticketCategoryRepository.GetByTicketCategoryIds(eventticketDetailModel.Select(s => s.TicketCategoryId)); var ticketCategorymodel1 = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TicketCategory> >(ticketCategorymodel); var eventDetailModel = _eventDetailRepository.GetByEventDetailIds(eventticketDetailModel.Select(s => s.EventDetailId)); var eventmodel = _eventRepository.GetByEventIds(eventDetailModel.Select(s => s.EventId)); var eventmodel1 = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.Event> >(eventmodel); if (transactionModel.ToList().Count > 0) { isPurchased = true; } return(new ReviewsAndRatingQueryResult { IsPurchase = isPurchased }); }
public GetPlaceInventoryQueryResult Handle(GetPlaceInventoryQuery query) { try { var eventData = _eventRepository.GetByAltId(query.PlaceAltId); var eventModel = AutoMapper.Mapper.Map <FIL.Contracts.Models.Event>(eventData); List <string> TicketValidityTypes = new List <string>(); List <string> DeliveryTypes = new List <string>(); foreach (FIL.Contracts.Enums.TicketValidityTypes ticketValidity in Enum.GetValues(typeof(FIL.Contracts.Enums.TicketValidityTypes))) { TicketValidityTypes.Add(ticketValidity.ToString()); } foreach (FIL.Contracts.Enums.DeliveryTypes DeliveryType in Enum.GetValues(typeof(FIL.Contracts.Enums.DeliveryTypes))) { DeliveryTypes.Add(DeliveryType.ToString()); } var eventDetail = _eventDetailRepository.GetAllByEventId(eventData.Id); var eventDetailModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.EventDetail> >(eventDetail).Where(s => s.IsEnabled == true).ToList(); var eventTicketDetils = _eventTicketDetail.GetByEventDetailId(eventDetail.ElementAt(0).Id).Where(s => s.IsEnabled == true); var eventAttribute = _eventAttributeRepository.GetByEventDetailId(eventDetail.FirstOrDefault().Id); var EventTicketDetailTicketCategoryTypeMappingDataModel = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(eventTicketDetils.Select(s => s.Id).ToList()).Where(s => s.IsEnabled == true); var EventTicketDetailTicketCategoryTypeMappingModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.EventTicketDetailTicketCategoryTypeMapping> >(EventTicketDetailTicketCategoryTypeMappingDataModel); var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetils.Select(s => s.TicketCategoryId)).Where(s => s.IsEnabled == true); var placeCustomerDocumentTypes = _placeCustomerDocumentTypeMappingRepository.GetAllByEventId(eventData.Id); var placeCustomerDocumentTypeModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.PlaceCustomerDocumentTypeMapping> >(placeCustomerDocumentTypes); var placeTicketRedemptionDetails = _placeTicketRedemptionDetailRepository.GetAllByEventDetailIds(eventDetail.Select(s => s.Id)); var placeTicketRedemptionDetailModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.PlaceTicketRedemptionDetail> >(placeTicketRedemptionDetails); var placeDeliveryTypes = _eventDeliveryTypeDetailRepository.GetByEventDetailId(eventDetail.ElementAt(0).Id); var placeDeliveryTypesModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.EventDeliveryTypeDetail> >(placeDeliveryTypes); var customerDoumentType = _customerDocumentTypeRepository.GetAll(); var customerDoumentTypeModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.CustomerDocumentType> >(customerDoumentType); var placeHolidayDates = _placeHolidydates.GetAllByEventId(eventData.Id); var placeHolidayDatesModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.PlaceHolidayDate> >(placeHolidayDates); var placeWeekOffs = _placeWeekOffRepository.GetAllByEventId(eventData.Id); var placeWeekOffsModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.PlaceWeekOff> >(placeWeekOffs); var customerInformationMapping = _customerInformationRepository.GetAll(); var customerInformationMappingModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.CustomerInformation> >(customerInformationMapping); var eventCustomerInformationMapping = _eventCustomerInformationMappingRepository.GetAllByEventID(eventModel.Id).ToList(); List <FIL.Contracts.Models.EventCustomerInformationMapping> eventCustomerInformationMappingModel = new List <Contracts.Models.EventCustomerInformationMapping>();; if (eventCustomerInformationMapping.Count() > 0) { eventCustomerInformationMappingModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.EventCustomerInformationMapping> >(eventCustomerInformationMapping); } List <FIL.Contracts.DataModels.EventTicketDetail> etdList = new List <FIL.Contracts.DataModels.EventTicketDetail>(); foreach (FIL.Contracts.DataModels.EventTicketDetail currentTicketCat in eventTicketDetils.ToList()) { /*--------------- Add those ETD whose eventticketdetail and ETA exists */ var etaData = _eventTicketAttribute.GetByEventTicketDetailIdFeelAdmin(currentTicketCat.Id); if (etaData != null) { etdList.Add(currentTicketCat); } } var ticketCategoryContainer = etdList.Select(td => { try { var ticketDetailModel = AutoMapper.Mapper.Map <FIL.Contracts.Models.EventTicketDetail>(td); var ticketCategory = _ticketCategoryRepository.Get((int)td.TicketCategoryId); var ticketCategoryModel = AutoMapper.Mapper.Map <FIL.Contracts.Models.TicketCategory>(ticketCategory); var eventTicketAttributes = _eventTicketAttribute.GetByEventTicketDetailIdFeelAdmin(td.Id); var eventTicketAttributeModel = AutoMapper.Mapper.Map <FIL.Contracts.Models.EventTicketAttribute>(eventTicketAttributes); var TicketCategoryTypeTypeMapping = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetail(td.Id); var ticketFeeDetail = _ticketFeeDetailRepository.GetAllByEventTicketAttributeId(eventTicketAttributeModel.Id); var ticketFeeDetailModel = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.TicketFeeDetail> >(ticketFeeDetail); return(new TicketCategoryInfo { TicketCategory = ticketCategoryModel, EventTicketAttribute = eventTicketAttributeModel, EventTicketDetail = ticketDetailModel, TicketCategorySubTypeId = (TicketCategoryTypeTypeMapping != null ? TicketCategoryTypeTypeMapping.TicketCategorySubTypeId : 1), TicketCategoryTypeId = (TicketCategoryTypeTypeMapping != null ? TicketCategoryTypeTypeMapping.TicketCategoryTypeId : 1), TicketFeeDetails = ticketFeeDetailModel }); } catch (Exception e) { return(new TicketCategoryInfo { }); } }).ToList(); var data = _calendarProvider.GetCalendarData(eventData.Id); return(new GetPlaceInventoryQueryResult { Event = eventModel, EventDetails = eventDetailModel, TicketCategoryContainer = ticketCategoryContainer, PlaceCustomerDocumentTypeMappings = placeCustomerDocumentTypeModel, DeliveryTypes = DeliveryTypes, eventDeliveryTypeDetails = placeDeliveryTypesModel, EventTicketDetailTicketCategoryTypeMappings = EventTicketDetailTicketCategoryTypeMappingModel, PlaceTicketRedemptionDetails = placeTicketRedemptionDetailModel, TicketValidityTypes = TicketValidityTypes, CustomerDocumentTypes = customerDoumentTypeModel, PlaceHolidayDates = placeHolidayDatesModel, PlaceWeekOffs = placeWeekOffsModel, CustomerInformations = customerInformationMappingModel, EventCustomerInformationMappings = eventCustomerInformationMappingModel, RegularTimeModel = data.RegularTimeModel, SeasonTimeModel = data.SeasonTimeModel, SpecialDayModel = data.SpecialDayModel, EventAttribute = eventAttribute }); } catch (Exception e) { return(new GetPlaceInventoryQueryResult { }); } }
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, }); }
public SearchVenueQueryResult Handle(SearchVenueQuery query) { List <FIL.Contracts.DataModels.SearchVenue> VenueResult = new List <Contracts.DataModels.SearchVenue>(); try { var citiesArray = query.CityName != null?query.CityName.Split(",") : null; var eventCategoriesRepositoryData = _eventCategoryRepository.GetAll().Where(s => s.IsFeel == true); var categories = query.Categories != null?query.Categories.Split(",") : null; List <long> categoryList = new List <long>(); if (categories != null && categories.Count() > 0 && query.PlaceId == 0) { foreach (var item in categories) { try { var categoryInfo = eventCategoriesRepositoryData.FirstOrDefault(x => x.DisplayName == item).Id; categoryList.Add(categoryInfo); } catch (Exception ex) { _logger.Log(Logging.Enums.LogCategory.Error, ex); } } } else if (categories != null && categories.Count() == 0 && query.PlaceId == 0) { var categoryInfo = eventCategoriesRepositoryData.FirstOrDefault(x => x.DisplayName == query.Categories).Id; categoryList.Add(categoryInfo); } var cityLists = query.CityIds != null?_cityRepository.GetByCityIds(query.CityIds) : null; var itineraryPlaces = query.PlaceId == 0 ? _eventRepository.GetAllItineraryPlaces(cityLists.Select(s => s.Id).ToList(), categoryList).GroupBy(x => x.Id, (key, group) => group.First()) : _eventRepository.GetItinerarySearchPlaces(query.PlaceId).GroupBy(x => x.Id, (key, group) => group.First()); var placeWeekOpenDayList = _placeWeekOpenDaysRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList()); var dayTimeMappingLists = _dayTimeMappingsRepository.GetAllByPlaceWeekOpenDays(placeWeekOpenDayList.Select(s => (long)s.Id).Distinct().ToList()); var placeHolidayDatesRepositoryLists = _placeHolidayDatesRepository.GetAllByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList()); var placeVisitDurationRepositoryLists = _PlaceVisitDurationRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList()); var eventDetails = _eventDetailRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true); var eventTicketDetails = _eventTicketDetailRepository.GetByEventDetailIds(eventDetails.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true); var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true); var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => (long)s.TicketCategoryId).Distinct().ToList()); var Days = _daysRepository.GetAll(); foreach (var currentPlace in itineraryPlaces) { var PlaceVisitDuration = placeVisitDurationRepositoryLists.FirstOrDefault(x => x.EventId == currentPlace.Id); var placeWeekOpenDays = placeWeekOpenDayList.Where(x => x.EventId == currentPlace.Id); var dayTimeMappings = dayTimeMappingLists.Where(s => placeWeekOpenDays.Any(p => p.Id == s.PlaceWeekOpenDayId)); SearchVenue searchVenue = new SearchVenue(); searchVenue.CategoryName = currentPlace.Category; searchVenue.EventId = currentPlace.Id; searchVenue.CityId = currentPlace.CityId; searchVenue.EventSource = currentPlace.EventSource; searchVenue.CityName = currentPlace.CityName; searchVenue.CountryName = currentPlace.CountryName; searchVenue.Currency = currentPlace.Currency; searchVenue.EventName = currentPlace.Name; searchVenue.EventAltId = currentPlace.AltId; searchVenue.EventSlug = currentPlace.Slug; searchVenue.Address = (currentPlace.AddressLineOne == null ? string.Empty : currentPlace.AddressLineOne) + "," + (currentPlace.AddressLineTwo == null ? string.Empty : currentPlace.AddressLineTwo); searchVenue.Id = currentPlace.Id; searchVenue.PlaceWeekOpenDays = placeWeekOpenDays.ToList(); searchVenue.DayTimeMappings = dayTimeMappings.ToList(); searchVenue.PlaceHolidaysList = placeHolidayDatesRepositoryLists.Where(x => x.EventId == currentPlace.Id).ToList(); searchVenue.EventDescription = currentPlace.EventDescription; searchVenue.EventDetails = eventDetails.Where(x => x.EventId == currentPlace.Id).ToList(); searchVenue.EventTicketDetails = eventTicketDetails.Where(x => searchVenue.EventDetails.Any(s => s.Id == x.EventDetailId)).ToList(); searchVenue.EventTicketAttributes = eventTicketAttributes.Where(x => searchVenue.EventTicketDetails.Any(s => s.Id == x.EventTicketDetailId)).ToList(); searchVenue.ticketCategories = ticketCategories.Where(x => searchVenue.EventTicketDetails.Any(s => s.TicketCategoryId == x.Id)).ToList(); if (currentPlace.Latitude != null) { var latArr = currentPlace.Latitude.Split("E"); var longArr = currentPlace.Longitude.Split("E"); searchVenue.Latitude = latArr[0]; searchVenue.Longitude = longArr[0]; } else { searchVenue.Latitude = null; searchVenue.Longitude = null; } VenueResult.Add(searchVenue); } return(new SearchVenueQueryResult() { Venues = VenueResult.Distinct().ToList(), Days = Days.ToList() }); } catch (Exception e) { return(new SearchVenueQueryResult() { Venues = VenueResult.Distinct().ToList() }); } }
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 { }); } }
public TicketQueryResult Handle(TicketQuery query) { try { List <FIL.Contracts.Models.CreateEventV1.TicketModel> ticketModelList = new List <FIL.Contracts.Models.CreateEventV1.TicketModel>(); var currentEvent = _eventRepository.Get(query.EventId); if (currentEvent == null) { return(new TicketQueryResult { Success = true }); } var eventDetail = _eventDetailRepository.GetByEventId(query.EventId); if (eventDetail == null) { return(new TicketQueryResult { Success = true, IsDraft = true, IsValidLink = true, Tickets = ticketModelList }); } var eventTicketDetails = _eventTicketDetailRepository.GetByEventDetailId(eventDetail.Id); var eventTicketDetailTicketCategoryMappingData = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(eventTicketDetails.Select(s => s.Id).ToList()).ToList(); if (query.TicketCategoryTypeId == 2) { eventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.TicketCategoryTypeId == 2).ToList(); eventTicketDetails = eventTicketDetails.Where(p => eventTicketDetailTicketCategoryMappingData.Any(p2 => p2.EventTicketDetailId == p.Id) || (p.TicketCategoryId == 19452 || p.TicketCategoryId == 12259)); if (!eventTicketDetails.Any()) { return(new TicketQueryResult { EventDetailId = eventDetail.Id, EventId = currentEvent.Id, Success = true, IsValidLink = true, Tickets = ticketModelList }); } } else { eventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.TicketCategoryTypeId != 2).ToList(); eventTicketDetails = eventTicketDetails.Where(p => eventTicketDetailTicketCategoryMappingData.Any(p2 => p2.EventTicketDetailId == p.Id)); } var ticketCategories = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId)); var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => s.Id)); var currency = _currencyTypeRepository.GetByCurrencyIds(eventTicketAttributes.Select(s => s.CurrencyId).ToList()); var eventTicketDiscountDetails = _eventTicketDiscountDetailRepository.GetAllByEventTicketAttributeIds(eventTicketAttributes.Select(s => s.Id).ToList()); var discounts = _discountRepository.GetAllDiscountsByIds(eventTicketDiscountDetails.Select(s => (long)s.DiscountId).ToList()); var discountPromoCodes = _discountPromoCodeRepository.GetAllDiscountIds(discounts.Select(s => (long)s.Id).ToList()); foreach (var currentEventTicketDetail in eventTicketDetails) { FIL.Contracts.Models.CreateEventV1.TicketModel newTicketModel = new FIL.Contracts.Models.CreateEventV1.TicketModel(); var currentTicketCat = ticketCategories.Where(s => s.Id == currentEventTicketDetail.TicketCategoryId).FirstOrDefault(); var currentEventTicketAttribute = eventTicketAttributes.Where(s => s.EventTicketDetailId == currentEventTicketDetail.Id).FirstOrDefault(); var currentEventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.EventTicketDetailId == currentEventTicketDetail.Id).FirstOrDefault(); var currentEventTicketDiscountDetails = eventTicketDiscountDetails.Where(s => s.EventTicketAttributeId == currentEventTicketAttribute.Id).FirstOrDefault(); var currentDiscount = currentEventTicketDiscountDetails != null?discounts.Where(s => s.Id == currentEventTicketDiscountDetails.DiscountId).FirstOrDefault() : null; var currentDiscountPromoCodes = currentDiscount != null?discountPromoCodes.Where(s => s.DiscountId == currentDiscount.Id).FirstOrDefault() : null; var donationDetail = new FIL.Contracts.DataModels.DonationDetail(); if (currentEventTicketDetail.TicketCategoryId == 19452 || currentEventTicketDetail.TicketCategoryId == 12259) { donationDetail = _donationDetailRepository.GetByEventId(query.EventId); } newTicketModel.TicketAltId = currentEventTicketDetail.AltId; newTicketModel.ETDId = currentEventTicketDetail.Id; newTicketModel.TicketCategoryId = currentTicketCat.Id; newTicketModel.Name = currentTicketCat.Name; newTicketModel.Price = currentEventTicketAttribute.Price; newTicketModel.Quantity = currentEventTicketAttribute.AvailableTicketForSale; newTicketModel.Description = currentEventTicketAttribute.TicketCategoryDescription; newTicketModel.CurrencyId = currentEventTicketAttribute.CurrencyId; newTicketModel.TicketCategoryTypeId = currentEventTicketDetailTicketCategoryMappingData == null ? 1 : (currentEventTicketDetailTicketCategoryMappingData != null && currentEventTicketDetailTicketCategoryMappingData.TicketCategoryTypeId == 1) ? 1 : 2; newTicketModel.isEnabled = currentEventTicketDetail.IsEnabled; newTicketModel.CurrencyCode = currency.Where(s => s.Id == currentEventTicketAttribute.CurrencyId).FirstOrDefault().Code; newTicketModel.TotalQuantity = currentEventTicketAttribute.AvailableTicketForSale; newTicketModel.RemainingQuantity = currentEventTicketAttribute.RemainingTicketForSale; newTicketModel.DiscountAmount = currentDiscount != null && currentDiscount.DiscountValueTypeId == Contracts.Enums.DiscountValueType.Flat ? currentDiscount.DiscountValue : 0; newTicketModel.IsDiscountEnable = currentEventTicketDiscountDetails != null ? currentEventTicketDiscountDetails.IsEnabled : false; newTicketModel.DiscountPercentage = currentDiscount != null && currentDiscount.DiscountValueTypeId == Contracts.Enums.DiscountValueType.Percentage ? currentDiscount.DiscountValue : 0; newTicketModel.PromoCode = currentDiscountPromoCodes != null ? currentDiscountPromoCodes.PromoCode : null; newTicketModel.DiscountValueType = currentDiscount != null ? currentDiscount.DiscountValueTypeId : Contracts.Enums.DiscountValueType.Flat; newTicketModel.DonationAmount1 = donationDetail != null ? donationDetail.DonationAmount1 : 0; newTicketModel.DonationAmount2 = donationDetail != null ? donationDetail.DonationAmount2 : 0; newTicketModel.DonationAmount3 = donationDetail != null ? donationDetail.DonationAmount3 : 0; ticketModelList.Add(newTicketModel); } return(new TicketQueryResult { EventDetailId = eventDetail.Id, EventId = currentEvent.Id, Success = true, IsValidLink = true, Tickets = ticketModelList }); } catch (Exception e) { return(new TicketQueryResult { }); } }
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 { }); } }
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 }); }
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()); }
protected override async Task <ICommandResult> Handle(ReserveTimeSlotCommand command) { ReserveTimeSlotCommandResult results = new ReserveTimeSlotCommandResult(); ReserveTimeSlotReqestModel reserveTimelotRequestModel = new ReserveTimeSlotReqestModel(); IEnumerable <long> eventTicketAttributeIds = command.EventTicketAttributeList.Select(s => s.Id).Distinct(); IEnumerable <Contracts.Models.EventTicketAttribute> eventTicketAttributes = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketAttribute> >(_eventTicketAttributeRepository.GetByIds(eventTicketAttributeIds)); var allETD = _eventTicketDetailRepository.GetByEventTicketDetailsIds(eventTicketAttributes.Select(s => s.EventTicketDetailId).Distinct()).Distinct(); var allTC = _ticketCategoryRepository.GetByTicketCategoryIds(allETD.Select(s => s.TicketCategoryId).Distinct()).Distinct(); var allED = _eventDetailRepository.GetByIds(allETD.Select(s => s.EventDetailId).Distinct()).Distinct().FirstOrDefault(); var citySightEventDetails = _citySightSeeingEventDetailMappingRepository.GetByEventDetailId(allED.Id); var citySightSeeingTickets = _citySightSeeingTicketRepository.Get(citySightEventDetails.CitySightSeeingTicketId); var citySightSeeingTicketDetails = _citySightSeeingTicketDetailRepository.GetByTicketId(citySightSeeingTickets.TicketId); var citySightSeeingLocations = _citySightSeeingLocationRepository.Get(citySightSeeingTickets.CitySightSeeingLocationId); var locationDetail = await _googleMapApi.GetLatLongFromAddress(citySightSeeingLocations.Name); string tz = ""; DateTime fromDate = DateTime.Now;; var offset = ""; if (locationDetail.Success) { double lat = Convert.ToDouble(locationDetail.Result.lat); double lng = Convert.ToDouble(locationDetail.Result.lng); tz = TimeZoneLookup.GetTimeZone(lat, lng).Result; TimeZoneInfo tzi = TZConvert.GetTimeZoneInfo(tz); var visitDate = command.EventTicketAttributeList[0].VisitDate; var timeSlot = command.EventTicketAttributeList[0].TimeSlot; var utcOffset = tzi.BaseUtcOffset.ToString().Split(":")[0]; var minutes = Convert.ToInt64(tzi.BaseUtcOffset.ToString().Split(":")[1]); if (utcOffset.Contains("-")) { var hours = Convert.ToInt64((tzi.BaseUtcOffset.ToString().Split(":")[0]).Split("-")[1]); visitDate = visitDate.AddHours(hours).AddMinutes(minutes); offset = utcOffset; } else { var hours = Convert.ToInt64((tzi.BaseUtcOffset.ToString().Split(":")[0])); visitDate = visitDate.AddHours(-hours).AddMinutes(-minutes); offset = "+" + utcOffset; } var formattedDateTime = visitDate.Year + "-" + visitDate.Month + "-" + visitDate.Day + "T" + timeSlot; fromDate = Convert.ToDateTime(formattedDateTime); } var duration = citySightSeeingTicketDetails.Duration; reserveTimelotRequestModel.request_type = "reserve"; TimeSlotData timeSlotData = new TimeSlotData(); timeSlotData.distributor_id = _settings.GetConfigSetting <string>(SettingKeys.Integration.CitySightSeeing.DistributorId); timeSlotData.ticket_id = citySightSeeingTickets.TicketId; timeSlotData.pickup_point_id = (citySightSeeingTicketDetails.PickupPoints != null && citySightSeeingTicketDetails.PickupPoints != "") ? citySightSeeingTicketDetails.PickupPoints : ""; DateTime endDate = DateTime.Now; List <BookingTimeSlotDetail> bookingTimeSlotDetailList = new List <BookingTimeSlotDetail>(); foreach (Contracts.Commands.Transaction.EventTicketAttribute ticketAttributes in command.EventTicketAttributeList) { BookingTimeSlotDetail bookingTimeSlotDetail = new BookingTimeSlotDetail(); var currentTA = ticketAttributes; Contracts.Models.EventTicketAttribute checkoutCommandEventTicketAttribute = eventTicketAttributes.Where(w => w.Id == ticketAttributes.Id).FirstOrDefault(); EventTicketDetail eventTicketDetail = allETD.Where(s => s.Id == checkoutCommandEventTicketAttribute.EventTicketDetailId).FirstOrDefault(); var ticketCategoryId = allTC.Where(s => s.Id == eventTicketDetail.TicketCategoryId).FirstOrDefault(); bookingTimeSlotDetail.count = ticketAttributes.TotalTickets; var formattedTicketCat = ticketCategoryId.Name.Split("("); bookingTimeSlotDetail.ticket_type = formattedTicketCat[0].ToUpper(); bookingTimeSlotDetail.extra_options = null; bookingTimeSlotDetailList.Add(bookingTimeSlotDetail); } if (duration.Contains("day")) { string[] day = duration.Split("day"); endDate = fromDate.AddDays(Convert.ToDouble(day[0])); } if (duration.Contains("hour")) { string[] hour = duration.Split("hour"); endDate = fromDate.AddHours(Convert.ToDouble(hour[0])); } var fromDate_with_time_slot = Convert.ToDateTime(fromDate.ToString() + offset); var endDate_with_time_slot = Convert.ToDateTime(endDate.ToString() + offset); timeSlotData.from_date_time = fromDate_with_time_slot; timeSlotData.to_date_time = endDate_with_time_slot; timeSlotData.booking_details = bookingTimeSlotDetailList; reserveTimelotRequestModel.data = timeSlotData; reserveTimelotRequestModel.data.distributor_reference = RandomDigits(10); var response = Mapper <TimeSlotResponseModel> .MapFromJson(await ReserveBooking(reserveTimelotRequestModel)); if (response != null && response.data.booking_status == "Reserved") { results.Success = true; results.FromTime = fromDate.ToString() + offset; results.EndTime = endDate.ToString() + offset; results.Reservation_reference = response.data.reservation_reference; results.Reservation_valid_until = response.data.reservation_valid_until; results.Distributor_reference = response.data.distributor_reference; results.TicketId = citySightSeeingTicketDetails.TicketId; results.TimeSlot = command.EventTicketAttributeList[0].TimeSlot; } else { results.Success = false; } return(results); }