Example #1
0
        public async Task <ASIBookingResponse> saveASIData(ASIBooking aSIBooking)
        {
            var            transactionData    = _transactionRepository.Get(aSIBooking.TransactionId);
            var            transactionDetails = _transactionDetailRepository.GetByTransactionId(aSIBooking.TransactionId);
            List <Visitor> visitors           = new List <Visitor>();
            List <ASIHash> aSIHashes          = new List <ASIHash>();
            RootObject     rootObject         = new RootObject();

            foreach (FIL.Contracts.DataModels.TransactionDetail currentTransactionDetail in transactionDetails)
            {
                var clientETAData = aSIBooking.EventTicketAttributeList.Where(s => s.Id == currentTransactionDetail.EventTicketAttributeId && (TicketType)currentTransactionDetail.TicketTypeId == s.TicketType).FirstOrDefault();
                if (clientETAData != null)
                {
                    foreach (FIL.Contracts.Commands.Transaction.GuestUserDetail currentGuestDetail in clientETAData.GuestDetails)
                    {
                        _saveGuestUserProvider.SaveGuestUsers(currentGuestDetail, currentTransactionDetail);
                    }

                    _aSITransactionDetailTimeSlotIdMappingRepository.Save(new FIL.Contracts.DataModels.ASI.ASITransactionDetailTimeSlotIdMapping
                    {
                        EventTimeSlotMappingId = (long)clientETAData.VisitTimeId,
                        TransactionDetailId    = currentTransactionDetail.Id,
                        IsEnabled  = true,
                        CreatedUtc = DateTime.UtcNow,
                        UpdatedUtc = DateTime.UtcNow
                    });

                    _transactionDeliveryDetailRepository.Save(new TransactionDeliveryDetail
                    {
                        TransactionDetailId = currentTransactionDetail.Id,
                        DeliveryTypeId      = DeliveryTypes.PrintAtHome,
                        PickupBy            = 1,
                        SecondaryName       = "Zoonga",
                        SecondaryContact    = "Zoonga",
                        SecondaryEmail      = transactionData.EmailId,
                        PickUpAddress       = "Zoonga"
                    });
                }
            }
            // This is separate loop for API request payload..... I don't think we need to manage data from above loop... Better to keep it separate
            foreach (FIL.Contracts.DataModels.TransactionDetail currentTransactionDetail in transactionDetails)
            {
                var guestData          = _guestDetailRepository.GetByTransactionDetailId(currentTransactionDetail.Id);
                var asiTicketAttribute = aSIBooking.EventTicketAttributeList.Where(s => s.Id == currentTransactionDetail.EventTicketAttributeId).FirstOrDefault();
                if (guestData.Any())
                {
                    var currentETA        = _eventTicketAttributeRepository.Get(currentTransactionDetail.EventTicketAttributeId);
                    var currentETD        = _eventTicketDetailRepository.Get(currentETA.EventTicketDetailId);
                    var currentTc         = _ticketCategoryRepository.Get((int)currentETD.TicketCategoryId);
                    var currentED         = _eventDetailRepository.Get(currentETD.EventDetailId);
                    var currentE          = _eventRepository.Get(currentED.EventId);
                    var asiETableMapping  = _aSIMonumentEventTableMappingRepository.GetByEventId(currentE.Id);
                    var asiMonument       = _aSIMonumentRepository.Get(asiETableMapping.ASIMonumentId);
                    var asiMonumentDetail = _aSIMonumentDetailRepository.GetByNameAndMonumentId(currentED.Name, asiMonument.Id);
                    var asiTimeSlot       = _aSITransactionDetailTimeSlotIdMappingRepository.GetByTransactionDetailId(currentTransactionDetail.Id);
                    var eventTimeSlot     = _eventTimeSlotMappingRepository.Get(asiTimeSlot.EventTimeSlotMappingId);
                    //api.key |[monument.code | optional | date | age | country | amount] |[monument.code | optional | date | age | country | amount] | api.salt
                    foreach (FIL.Contracts.DataModels.GuestDetail currentGuestDetail in guestData)
                    {
                        Visitor     visitor     = new Visitor();
                        ASIHash     aSIHash     = new ASIHash();
                        Identity    indentity   = new Identity();
                        Monument    monument    = new Monument();
                        Nationality nationality = new Nationality();
                        Timeslot    timeslot    = new Timeslot();
                        visitor.Identity          = indentity;
                        visitor.Monument          = monument;
                        visitor.Monument.Timeslot = timeslot;
                        visitor.Nationality       = nationality;
                        var custerDocType = _customerDocumentTypeRepository.Get(currentGuestDetail.CustomerDocumentTypeId);
                        visitor.Age                  = Convert.ToInt32(currentGuestDetail.Age);
                        visitor.VisitorId            = currentGuestDetail.Id.ToString();
                        visitor.Amount               = currentTransactionDetail.PricePerTicket;
                        visitor.Gender               = currentGuestDetail.GenderId.ToString();
                        visitor.Name                 = currentGuestDetail.FirstName + " " + currentGuestDetail.LastName;
                        visitor.Date                 = ((System.DateTime)currentTransactionDetail.VisitDate).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'");
                        visitor.Identity.Type        = custerDocType.DocumentType;
                        visitor.Identity.No          = currentGuestDetail.DocumentNumber;
                        visitor.Monument.Code        = "TAJ";
                        visitor.Monument.Optional    = asiMonumentDetail.IsOptional;
                        visitor.Monument.Main        = true;
                        visitor.Monument.Timeslot.Id = eventTimeSlot.TimeSlotId;
                        visitor.Nationality.Group    = currentTc.Name;
                        visitor.Nationality.Country  = asiTicketAttribute == null ? "India" : asiTicketAttribute.ASIUserSelectedCountry;
                        visitors.Add(visitor);

                        aSIHash.Code           = asiMonument.Code;
                        aSIHash.IsOptional     = asiMonumentDetail.IsOptional;
                        aSIHash.Date           = (System.DateTime)currentTransactionDetail.VisitDate;
                        aSIHash.Nationality    = currentTc.Name;
                        aSIHash.Age            = Convert.ToInt32(currentGuestDetail.Age);
                        aSIHash.Amount         = currentTransactionDetail.PricePerTicket;
                        aSIHash.IdentityType   = "Passport";
                        aSIHash.IdentityNumber = "SADFG";
                        aSIHash.VisitorId      = currentGuestDetail.Id.ToString();
                        aSIHashes.Add(aSIHash);
                    }
                }
            }

            var ticketHash = "";

            foreach (FIL.Contracts.Models.ASI.ASIHash currentHash in aSIHashes)
            {
                TimeZoneInfo INDIAN_ZONE;
                try
                {
                    INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                }
                catch (Exception e)
                {
                    INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("Asia/Kolkata");
                }
                DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(currentHash.Date, INDIAN_ZONE);
                var      time       = indianTime.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'");
                ticketHash = ticketHash + "[" + currentHash.Code + "|" + (!currentHash.IsOptional).ToString().ToLower() + "|" + currentHash.IsOptional.ToString().ToLower() + "|" + indianTime.ToString("yyyy-MM-dd") + "|" + currentHash.Age + "|" + currentHash.Nationality + "|" + currentHash.Amount.ToString("0.00") + "]" + "|";
                //ticketHash = ticketHash + "[" + "TAJ" + "|" + time + "|" + currentHash.IdentityType + "|" + currentHash.IdentityNumber + "|" + currentHash.Age + "|" + currentHash.Nationality + "|" + currentHash.Amount.ToString("0.00") + "|" + currentHash.VisitorId + "]" + "|";
            }
            var bookingHashRequestData = _settings.GetConfigSetting <string>(SettingKeys.Integration.ASI.APIKey) + "|" + ticketHash + _settings.GetConfigSetting <string>(SettingKeys.Integration.ASI.APISalt);
            var bookingHash            = GenerateSHA512Hash(bookingHashRequestData);

            rootObject.TransactionId = aSIBooking.TransactionId.ToString();
            rootObject.Hash          = bookingHash.ToLower();
            rootObject.Visitors      = visitors;
            rootObject.Email         = transactionData.EmailId == "*****@*****.**" ? transactionData.PhoneNumber : transactionData.EmailId;
            UserCardDetail userCardDetail = _userCardDetailRepository.GetByUserCardNumber(string.Empty, aSIBooking.UserId);

            if (userCardDetail == null)
            {
                UserCardDetail obj = new UserCardDetail
                {
                    UserId      = aSIBooking.UserId,
                    AltId       = new Guid(),
                    NameOnCard  = string.Empty,
                    CardNumber  = string.Empty,
                    ExpiryMonth = 12,
                    ExpiryYear  = 2020,
                    CardTypeId  = CardType.None
                };
                userCardDetail = _userCardDetailRepository.Save(obj);
            }

            _transactionPaymentDetailRepository.Save(new TransactionPaymentDetail // Create transaction payment request before calling booking POST API request...
            {
                TransactionId    = aSIBooking.TransactionId,
                PaymentOptionId  = PaymentOptions.None,
                PaymentGatewayId = PaymentGateway.Payu,
                UserCardDetailId = userCardDetail.Id,
                RequestType      = "Charge Posting",
                Amount           = transactionData.NetTicketAmount.ToString(),
                PayConfNumber    = "",
                PaymentDetail    = "{\"Request\":" + Newtonsoft.Json.JsonConvert.SerializeObject(rootObject) + "{\"hashparameter\":" + bookingHashRequestData + "}}",
            });
            var baseAddress = _settings.GetConfigSetting <string>(SettingKeys.Integration.ASI.IntegrationRoot).ToString() + "" + _settings.GetConfigSetting <string>(SettingKeys.Integration.ASI.APIKey).ToString();

            return(new ASIBookingResponse
            {
                RootObject = rootObject,
                ReturnUrl = baseAddress
            });
        }
        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 {
                });
            }
        }