Esempio n. 1
0
        public void SaveTicketDetails(ValueRetailExpressData valueRetailExpressRoute, EventDetail eventDetail, SaveLocationReturnValues locationValues)
        {
            Dictionary <string, decimal> prices = new Dictionary <string, decimal>();

            prices.Add("Adult", (decimal)valueRetailExpressRoute.AdultPrice);
            prices.Add("Child", (decimal)valueRetailExpressRoute.ChildrenPrice);
            prices.Add("Family", (decimal)valueRetailExpressRoute.FamilyPrice);
            prices.Add("Infant", (decimal)valueRetailExpressRoute.InfantPrice);
            prices.Add("Unit Price", (decimal)valueRetailExpressRoute.UnitPrice);

            foreach (var item in prices)
            {
                var ticketCategory = _ticketCategoryRepository.GetByName(item.Key);
                if (ticketCategory == null)
                {
                    ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                    {
                        Name       = item.Key,
                        ModifiedBy = tempAltId,
                        IsEnabled  = true,
                        CreatedBy  = tempAltId,
                        CreatedUtc = DateTime.UtcNow,
                        UpdatedUtc = DateTime.UtcNow,
                        UpdatedBy  = tempAltId
                    });
                }

                var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndeventDetailId(ticketCategory.Id, eventDetail.Id).FirstOrDefault();
                if (eventTicketDetail == null)
                {
                    eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                    {
                        EventDetailId    = eventDetail.Id,
                        TicketCategoryId = ticketCategory.Id,
                        ModifiedBy       = tempAltId,
                        IsEnabled        = true,
                        CreatedBy        = tempAltId,
                        CreatedUtc       = DateTime.UtcNow,
                        UpdatedUtc       = DateTime.UtcNow,
                        UpdatedBy        = tempAltId
                    });
                }

                var eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);
                if (eventTicketAttribute == null)
                {
                    eventTicketAttribute = _eventTicketAttributeRepository.Save(new EventTicketAttribute
                    {
                        EventTicketDetailId       = eventTicketDetail.Id,
                        SalesStartDateTime        = DateTime.UtcNow,
                        SalesEndDatetime          = DateTime.UtcNow.AddYears(1),
                        TicketTypeId              = TicketType.Regular,
                        ChannelId                 = Channels.Feel,
                        CurrencyId                = locationValues.currencyId,
                        SharedInventoryGroupId    = null,
                        TicketCategoryDescription = "",
                        ViewFromStand             = "",
                        IsSeatSelection           = false,
                        AvailableTicketForSale    = 100,
                        RemainingTicketForSale    = 100,
                        Price = Convert.ToDecimal(item.Value < 0 ? 0 : item.Value),
                        IsInternationalCardAllowed = false,
                        IsEMIApplicable            = false,
                        ModifiedBy = tempAltId,
                        IsEnabled  = true,
                        CreatedBy  = tempAltId,
                        CreatedUtc = DateTime.UtcNow,
                        UpdatedUtc = DateTime.UtcNow,
                        UpdatedBy  = tempAltId
                    });
                }

                var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttribute.Id, (int)FeeType.ConvenienceCharge);
                if (ticketFeeDetail == null)
                {
                    ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                    {
                        EventTicketAttributeId = eventTicketAttribute.Id,
                        FeeId       = (int)FeeType.ConvenienceCharge,
                        DisplayName = "Convienence Charge",
                        ValueTypeId = (int)ValueTypes.Percentage,
                        Value       = 5,
                        ModifiedBy  = tempAltId,
                        IsEnabled   = true,
                        CreatedBy   = tempAltId,
                        CreatedUtc  = DateTime.UtcNow,
                        UpdatedUtc  = DateTime.UtcNow,
                        UpdatedBy   = tempAltId
                    });
                }
            }
            prices.Clear();
        }
Esempio n. 2
0
        public async Task <SaveLocationReturnValues> SaveCityStateCountry(ValueRetailExpressData route, ValueRetailVillage village)
        {
            var locationData = await _googleMapApi.GetLocationFromLatLong(route.Latitude.ToString(), route.Longitude.ToString());

            if (!locationData.Success)
            {
                throw new ArgumentNullException($"Failed to get Location Data in {this}");
            }

            var countryCodeAndCurrency = await _countryAlphaCode.GetCountryCodeByName(locationData.Result.CountryName);

            var country = _countryRepository.GetByName(locationData.Result.CountryName);

            if (country == null)
            {
                country = _countryRepository.Save(new Country
                {
                    Name              = locationData.Result.CountryName,
                    IsoAlphaTwoCode   = countryCodeAndCurrency.Result.IsoAlphaTwoCode.ToUpper(),
                    IsoAlphaThreeCode = countryCodeAndCurrency.Result.IsoAlphaThreeCode.ToUpper(),
                    IsEnabled         = true,
                });
            }

            var state = _stateRepository.GetByNameAndCountryId(locationData.Result.StateName, country.Id);

            if (state == null)
            {
                state = _stateRepository.Save(new State
                {
                    Name      = locationData.Result.StateName,
                    CountryId = country.Id,
                    IsEnabled = true,
                });
            }

            var city = _cityRepository.GetByNameAndStateId(locationData.Result.CityName, state.Id);

            if (city == null)
            {
                city = _cityRepository.Save(new City
                {
                    Name      = locationData.Result.CityName,
                    StateId   = state.Id,
                    IsEnabled = true,
                });
            }

            var currencyType = _currencyTypeRepository.GetByCurrencyCode(village.CurrencyCode.ToUpper());

            if (currencyType == null)
            {
                currencyType = _currencyTypeRepository.Save(new CurrencyType
                {
                    Code       = village.CurrencyCode.ToUpper(),
                    Name       = village.CurrencyCode.ToUpper(),
                    CountryId  = country.Id,
                    ModifiedBy = tempAltId,
                    IsEnabled  = true
                });
            }

            var values = new SaveLocationReturnValues
            {
                cityName    = city.Name,
                stateName   = state.Name,
                countryName = country.Name,
                cityId      = city.Id,
                currencyId  = currencyType.Id,
                lat         = locationData.Result.lat,
                lng         = locationData.Result.lng
            };

            return(values);
        }
Esempio n. 3
0
        public EventVenueMapping SaveToVenue(ValueRetailExpressData route, Event @event, SaveLocationReturnValues locationValues)
        {
            var venue = _venueRepository.GetByVenueNameAndCityId(route.DepartureName, locationValues.cityId);

            if (venue == null)
            {
                venue = _venueRepository.Save(new Venue
                {
                    AltId          = Guid.NewGuid(),
                    Name           = route.DepartureName,
                    AddressLineOne = route.DepartureAddress,
                    AddressLineTwo = "",
                    CityId         = locationValues.cityId,
                    Latitude       = locationValues.lat.ToString(),
                    Longitude      = locationValues.lng.ToString(),
                    ModifiedBy     = tempAltId,
                    IsEnabled      = true,
                    CreatedUtc     = DateTime.UtcNow,
                    CreatedBy      = tempAltId,
                    UpdatedUtc     = DateTime.UtcNow,
                    UpdatedBy      = tempAltId
                });
            }

            var eventVenueMapping = _eventVenueMappingRepository.GetByEventIdAndVenueId(@event.Id, venue.Id);

            if (eventVenueMapping == null)
            {
                eventVenueMapping = _eventVenueMappingRepository.Save(new EventVenueMapping
                {
                    EventId    = @event.Id,
                    VenueId    = venue.Id,
                    IsEnabled  = true,
                    CreatedUtc = DateTime.UtcNow,
                    UpdatedUtc = DateTime.UtcNow,
                    CreatedBy  = tempAltId,
                    UpdatedBy  = tempAltId,
                    ModifiedBy = tempAltId
                });
            }
            return(eventVenueMapping);
        }
Esempio n. 4
0
        public void SaveTicketDetail(ShoppingPackageRouteDetail shoppingPackageRouteDetail, EventDetail eventDetail, SaveLocationReturnValues cityAndCurrency)
        {
            foreach (var price in shoppingPackageRouteDetail.RouteDetails.Package.PricePerPersons)
            {
                if (price.PackagePriceType == 0)
                {
                    var category       = "Adult";
                    var ticketCategory = _ticketCategoryRepository.GetByName(category);
                    if (ticketCategory == null)
                    {
                        ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                        {
                            Name       = category,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }

                    var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndEventDetailId(ticketCategory.Id, eventDetail.Id);
                    if (eventTicketDetail == null)
                    {
                        eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                        {
                            EventDetailId    = eventDetail.Id,
                            TicketCategoryId = ticketCategory.Id,
                            ModifiedBy       = eventDetail.ModifiedBy,
                            IsEnabled        = true
                        });
                    }

                    var eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);
                    if (eventTicketAttribute == null)
                    {
                        eventTicketAttribute = _eventTicketAttributeRepository.Save(new EventTicketAttribute
                        {
                            EventTicketDetailId       = eventTicketDetail.Id,
                            SalesStartDateTime        = eventDetail.StartDateTime,
                            SalesEndDatetime          = eventDetail.EndDateTime,
                            TicketTypeId              = TicketType.Regular,
                            ChannelId                 = Channels.Feel,
                            CurrencyId                = cityAndCurrency.currencyId,
                            SharedInventoryGroupId    = null,
                            TicketCategoryDescription = "Adult Return Ticket Price",
                            ViewFromStand             = string.Empty,
                            IsSeatSelection           = false,
                            AvailableTicketForSale    = 100,
                            RemainingTicketForSale    = 100,
                            Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price),
                            IsInternationalCardAllowed = false,
                            IsEMIApplicable            = false,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }
                    else
                    {
                        eventTicketAttribute.Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price);
                        eventTicketAttribute       = _eventTicketAttributeRepository.Save(eventTicketAttribute);
                    }

                    var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttribute.Id, (int)FeeType.ConvenienceCharge);
                    if (ticketFeeDetail == null)
                    {
                        ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                        {
                            EventTicketAttributeId = eventTicketAttribute.Id,
                            FeeId       = (int)FeeType.ConvenienceCharge,
                            DisplayName = "Convienence Charge",
                            ValueTypeId = (int)ValueTypes.Percentage,
                            Value       = 5,
                            ModifiedBy  = eventDetail.ModifiedBy,
                            IsEnabled   = true
                        });
                    }
                }

                if (price.PackagePriceType == 1)
                {
                    var category       = "Child";
                    var ticketCategory = _ticketCategoryRepository.GetByName(category);
                    if (ticketCategory == null)
                    {
                        ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                        {
                            Name       = category,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }

                    var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndEventDetailId(ticketCategory.Id, eventDetail.Id);
                    if (eventTicketDetail == null)
                    {
                        eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                        {
                            EventDetailId    = eventDetail.Id,
                            TicketCategoryId = ticketCategory.Id,
                            ModifiedBy       = eventDetail.ModifiedBy,
                            IsEnabled        = true
                        });
                    }

                    var eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);
                    if (eventTicketAttribute == null)
                    {
                        eventTicketAttribute = _eventTicketAttributeRepository.Save(new EventTicketAttribute
                        {
                            EventTicketDetailId       = eventTicketDetail.Id,
                            SalesStartDateTime        = eventDetail.StartDateTime,
                            SalesEndDatetime          = eventDetail.EndDateTime,
                            TicketTypeId              = TicketType.Regular,
                            ChannelId                 = Channels.Feel,
                            CurrencyId                = cityAndCurrency.currencyId,
                            SharedInventoryGroupId    = null,
                            TicketCategoryDescription = "Child Return Ticket Price",
                            ViewFromStand             = "",
                            IsSeatSelection           = false,
                            AvailableTicketForSale    = 100,
                            RemainingTicketForSale    = 100,
                            Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price),
                            IsInternationalCardAllowed = false,
                            IsEMIApplicable            = false,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }
                    else
                    {
                        eventTicketAttribute.Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price);
                        eventTicketAttribute       = _eventTicketAttributeRepository.Save(eventTicketAttribute);
                    }

                    var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttribute.Id, (int)FeeType.ConvenienceCharge);
                    if (ticketFeeDetail == null)
                    {
                        ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                        {
                            EventTicketAttributeId = eventTicketAttribute.Id,
                            FeeId       = (int)FeeType.ConvenienceCharge,
                            DisplayName = "Convienence Charge",
                            ValueTypeId = (int)ValueTypes.Percentage,
                            Value       = 5,
                            ModifiedBy  = eventDetail.ModifiedBy,
                            IsEnabled   = true
                        });
                    }
                }

                if (price.PackagePriceType == 2)
                {
                    var category       = "Infant";
                    var ticketCategory = _ticketCategoryRepository.GetByName(category);
                    if (ticketCategory == null)
                    {
                        ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                        {
                            Name       = category,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }

                    var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndEventDetailId(ticketCategory.Id, eventDetail.Id);
                    if (eventTicketDetail == null)
                    {
                        eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                        {
                            EventDetailId    = eventDetail.Id,
                            TicketCategoryId = ticketCategory.Id,
                            ModifiedBy       = eventDetail.ModifiedBy,
                            IsEnabled        = true
                        });
                    }

                    var eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);
                    if (eventTicketAttribute == null)
                    {
                        eventTicketAttribute = _eventTicketAttributeRepository.Save(new EventTicketAttribute
                        {
                            EventTicketDetailId       = eventTicketDetail.Id,
                            SalesStartDateTime        = eventDetail.StartDateTime,
                            SalesEndDatetime          = eventDetail.EndDateTime,
                            TicketTypeId              = TicketType.Regular,
                            ChannelId                 = Channels.Feel,
                            CurrencyId                = cityAndCurrency.currencyId,
                            SharedInventoryGroupId    = null,
                            TicketCategoryDescription = "Infant Return Ticket Price",
                            ViewFromStand             = "",
                            IsSeatSelection           = false,
                            AvailableTicketForSale    = 100,
                            RemainingTicketForSale    = 100,
                            Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price),
                            IsInternationalCardAllowed = false,
                            IsEMIApplicable            = false,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }
                    else
                    {
                        eventTicketAttribute.Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price);
                        eventTicketAttribute       = _eventTicketAttributeRepository.Save(eventTicketAttribute);
                    }

                    var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttribute.Id, (int)FeeType.ConvenienceCharge);
                    if (ticketFeeDetail == null)
                    {
                        ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                        {
                            EventTicketAttributeId = eventTicketAttribute.Id,
                            FeeId       = (int)FeeType.ConvenienceCharge,
                            DisplayName = "Convienence Charge",
                            ValueTypeId = (int)ValueTypes.Percentage,
                            Value       = 5,
                            ModifiedBy  = eventDetail.ModifiedBy,
                            IsEnabled   = true
                        });
                    }
                }

                if (price.PackagePriceType == 3)
                {
                    var category       = "Family";
                    var ticketCategory = _ticketCategoryRepository.GetByName(category);
                    if (ticketCategory == null)
                    {
                        ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                        {
                            Name       = category,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }

                    var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndEventDetailId(ticketCategory.Id, eventDetail.Id);
                    if (eventTicketDetail == null)
                    {
                        eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                        {
                            EventDetailId    = eventDetail.Id,
                            TicketCategoryId = ticketCategory.Id,
                            ModifiedBy       = eventDetail.ModifiedBy,
                            IsEnabled        = true
                        });
                    }

                    var eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);
                    if (eventTicketAttribute == null)
                    {
                        eventTicketAttribute = _eventTicketAttributeRepository.Save(new EventTicketAttribute
                        {
                            EventTicketDetailId       = eventTicketDetail.Id,
                            SalesStartDateTime        = eventDetail.StartDateTime,
                            SalesEndDatetime          = eventDetail.EndDateTime,
                            TicketTypeId              = TicketType.Regular,
                            ChannelId                 = Channels.Feel,
                            CurrencyId                = cityAndCurrency.currencyId,
                            SharedInventoryGroupId    = null,
                            TicketCategoryDescription = "",
                            ViewFromStand             = "",
                            IsSeatSelection           = false,
                            AvailableTicketForSale    = 100,
                            RemainingTicketForSale    = 100,
                            Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price),
                            IsInternationalCardAllowed = false,
                            IsEMIApplicable            = false,
                            ModifiedBy = eventDetail.ModifiedBy,
                            IsEnabled  = true
                        });
                    }
                    else
                    {
                        eventTicketAttribute.Price = Convert.ToDecimal(price.Price < 0 ? 0 : price.Price);
                        eventTicketAttribute       = _eventTicketAttributeRepository.Save(eventTicketAttribute);
                    }

                    var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttribute.Id, (int)FeeType.ConvenienceCharge);
                    if (ticketFeeDetail == null)
                    {
                        ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                        {
                            EventTicketAttributeId = eventTicketAttribute.Id,
                            FeeId       = (int)FeeType.ConvenienceCharge,
                            DisplayName = "Convienence Charge",
                            ValueTypeId = (int)ValueTypes.Percentage,
                            Value       = 5,
                            ModifiedBy  = eventDetail.ModifiedBy,
                            IsEnabled   = true
                        });
                    }
                }
            }
        }
Esempio n. 5
0
        public EventVenueMapping SaveToVenue(ShoppingPackageRouteDetail routeDetail, Event @event, SaveLocationReturnValues locationValues, ValueRetailVillage village)
        {
            try
            {
                var venue = _venueRepository.GetByVenueNameAndCityId(village.VillageName, locationValues.cityId);
                if (venue == null)
                {
                    venue = _venueRepository.Save(new Venue
                    {
                        AltId          = Guid.NewGuid(),
                        Name           = village.VillageName,
                        AddressLineOne = "",
                        AddressLineTwo = "",
                        CityId         = locationValues.cityId,
                        Latitude       = locationValues.lat.ToString(),
                        Longitude      = locationValues.lng.ToString(),
                        ModifiedBy     = @event.ModifiedBy,
                        IsEnabled      = true
                    });
                }

                var eventVenueMapping = _eventVenueMappingRepository.GetByEventIdAndVenueId(@event.Id, venue.Id);
                if (eventVenueMapping == null)
                {
                    eventVenueMapping = _eventVenueMappingRepository.Save(new EventVenueMapping
                    {
                        EventId    = @event.Id,
                        VenueId    = venue.Id,
                        IsEnabled  = true,
                        CreatedUtc = DateTime.UtcNow,
                        UpdatedUtc = null,
                        CreatedBy  = @event.ModifiedBy,
                        UpdatedBy  = null,
                        ModifiedBy = @event.ModifiedBy
                    });
                }
                return(eventVenueMapping);
            }
            catch (Exception ex)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, ex);
                return(new EventVenueMapping());
            }
        }
Esempio n. 6
0
        public async Task <SaveLocationReturnValues> SaveCityStateCountry(ShoppingPackageRouteDetail routeDetail, ValueRetailVillage village)
        {
            var locationData = await _googleMapApi.GetLatLongFromAddress(village.VillageName);

            try
            {
                if (!locationData.Success)
                {
                    throw new ArgumentNullException($"Failed to get Location Data in {this}");
                }

                var countryCodeAndCurrency = await _countryAlphaCode.GetCountryCodeByName(locationData.Result.CountryName);

                var country = _countryRepository.GetByName(locationData.Result.CountryName);
                if (country == null)
                {
                    country = _countryRepository.Save(new Country
                    {
                        Name              = locationData.Result.CountryName,
                        IsoAlphaTwoCode   = countryCodeAndCurrency.Result.IsoAlphaTwoCode.ToUpper(),
                        IsoAlphaThreeCode = countryCodeAndCurrency.Result.IsoAlphaThreeCode.ToUpper(),
                        IsEnabled         = true,
                    });
                }

                var state = _stateRepository.GetByNameAndCountryId(locationData.Result.StateName, country.Id);
                if (state == null)
                {
                    state = _stateRepository.Save(new State
                    {
                        Name      = locationData.Result.StateName,
                        CountryId = country.Id,
                        IsEnabled = true,
                    });
                }

                var city = _cityRepository.GetByNameAndStateId(locationData.Result.CityName, state.Id);
                if (city == null)
                {
                    city = _cityRepository.Save(new City
                    {
                        Name      = locationData.Result.CityName,
                        StateId   = state.Id,
                        IsEnabled = true,
                    });
                }

                var currencyType = _currencyTypeRepository.GetByCurrencyCode(village.CurrencyCode.ToUpper());
                if (currencyType == null)
                {
                    currencyType = _currencyTypeRepository.Save(new CurrencyType
                    {
                        Code       = village.CurrencyCode.ToUpper(),
                        Name       = village.CurrencyCode.ToUpper(),
                        CountryId  = country.Id,
                        ModifiedBy = Guid.NewGuid(),
                        IsEnabled  = true
                    });
                }
                var values = new SaveLocationReturnValues
                {
                    cityId     = city.Id,
                    currencyId = currencyType.Id,
                    lat        = locationData.Result.lat,
                    lng        = locationData.Result.lng
                };
                return(values);
            }
            catch (Exception ex)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, ex);
                return(new SaveLocationReturnValues());
            }
        }
Esempio n. 7
0
        public void SaveTicketDetail(ChauffeurRoute route, EventDetail eventDetail, SaveLocationReturnValues cityAndCurrency)
        {
            var category = "Passengers";

            try
            {
                var ticketCategory = _ticketCategoryRepository.GetByName(category);
                if (ticketCategory == null)
                {
                    ticketCategory = _ticketCategoryRepository.Save(new TicketCategory
                    {
                        Name       = category,
                        ModifiedBy = eventDetail.ModifiedBy,
                        IsEnabled  = true
                    });
                }

                var eventTicketDetail = _eventTicketDetailRepository.GetByTicketCategoryIdAndEventDetailId(ticketCategory.Id, eventDetail.Id);
                if (eventTicketDetail == null)
                {
                    eventTicketDetail = _eventTicketDetailRepository.Save(new EventTicketDetail
                    {
                        EventDetailId    = eventDetail.Id,
                        TicketCategoryId = ticketCategory.Id,
                        ModifiedBy       = eventDetail.ModifiedBy,
                        IsEnabled        = true
                    });
                }

                var eventTicketAttributeIn = new EventTicketAttribute
                {
                    EventTicketDetailId       = eventTicketDetail.Id,
                    SalesStartDateTime        = eventDetail.StartDateTime,
                    SalesEndDatetime          = eventDetail.EndDateTime,
                    TicketTypeId              = TicketType.Regular,
                    ChannelId                 = Channels.Feel,
                    CurrencyId                = cityAndCurrency.currencyId,
                    SharedInventoryGroupId    = null,
                    TicketCategoryDescription = $"Chauffeur Service Price from {route.LocationHeader}",
                    ViewFromStand             = string.Empty,
                    IsSeatSelection           = false,
                    AvailableTicketForSale    = 50,
                    RemainingTicketForSale    = 50,
                    Price = Convert.ToDecimal(route.ReturnPrice) < 0 ? 0 : Convert.ToDecimal(route.ReturnPrice),
                    IsInternationalCardAllowed = false,
                    IsEMIApplicable            = false,
                    ModifiedBy = eventDetail.ModifiedBy,
                    IsEnabled  = true
                };

                var eventTicketAttributeOut = _eventTicketAttributeRepository.GetByEventTicketDetailId(eventTicketDetail.Id);

                if (eventTicketAttributeOut == null)
                {
                    eventTicketAttributeOut = _eventTicketAttributeRepository.Save(eventTicketAttributeIn);
                }
                else
                {
                    eventTicketAttributeOut.Price = Convert.ToDecimal(route.ReturnPrice) < 0 ? 0 : Convert.ToDecimal(route.ReturnPrice);
                    eventTicketAttributeOut       = _eventTicketAttributeRepository.Save(eventTicketAttributeIn);
                }

                var ticketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(eventTicketAttributeOut.Id, (int)FeeType.ConvenienceCharge);
                if (ticketFeeDetail == null)
                {
                    ticketFeeDetail = _ticketFeeDetailRepository.Save(new TicketFeeDetail
                    {
                        EventTicketAttributeId = eventTicketAttributeOut.Id,
                        FeeId       = (int)FeeType.ConvenienceCharge,
                        DisplayName = "Convienence Charge",
                        ValueTypeId = (int)ValueTypes.Percentage,
                        Value       = 5,
                        ModifiedBy  = eventDetail.ModifiedBy,
                        IsEnabled   = true
                    });
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogCategory.Error, ex);
            }
        }
Esempio n. 8
0
 public EventVenueMapping SaveToVenue(ChauffeurRoute routeDetail, Event @event, SaveLocationReturnValues locationValues)
 {
     try
     {
         var venue = _venueRepository.GetByVenueNameAndCityId(routeDetail.LocationHeader, locationValues.cityId);
         if (venue == null || venue.Name == null)
         {
             venue = _venueRepository.Save(new Venue
             {
                 AltId          = Guid.NewGuid(),
                 Name           = routeDetail.LocationHeader,
                 AddressLineOne = routeDetail.PickupLocation,
                 AddressLineTwo = routeDetail.PickupLocation,
                 CityId         = locationValues.cityId,
                 Latitude       = locationValues.lat.ToString(),
                 Longitude      = locationValues.lng.ToString(),
                 ModifiedBy     = @event.ModifiedBy,
                 IsEnabled      = true
             });
         }
         var eventVenueMapping = _eventVenueMappingRepository.GetByEventIdAndVenueId(@event.Id, venue.Id);
         if (eventVenueMapping == null)
         {
             eventVenueMapping = _eventVenueMappingRepository.Save(new EventVenueMapping
             {
                 EventId    = @event.Id,
                 VenueId    = venue.Id,
                 IsEnabled  = true,
                 CreatedUtc = DateTime.UtcNow,
                 UpdatedUtc = null,
                 CreatedBy  = @event.ModifiedBy,
                 UpdatedBy  = null,
                 ModifiedBy = @event.ModifiedBy
             });
         }
         return(eventVenueMapping);
     }
     catch (Exception ex)
     {
         _logger.Log(LogCategory.Error, ex);
         return(new EventVenueMapping());
     }
 }