Пример #1
0
        protected EventTicketAttribute UpdateEventTicketAttribute(ExOzProductOptionResponse item, EventTicketAttribute FilEventTicketAttribute, long FilEventTicketDetailId, Guid ModifiedBy)
        {
            EventTicketAttribute FilEventTicketAttributeInserted = new EventTicketAttribute();

            if (FilEventTicketAttribute == null)
            {
                var newFilEventTicketAttribute = new EventTicketAttribute
                {
                    EventTicketDetailId       = FilEventTicketDetailId,
                    SalesStartDateTime        = DateTime.UtcNow,
                    SalesEndDatetime          = DateTime.UtcNow,
                    TicketTypeId              = Contracts.Enums.TicketType.Regular,
                    ChannelId                 = Contracts.Enums.Channels.Website,
                    CurrencyId                = 1,
                    SharedInventoryGroupId    = null,
                    AvailableTicketForSale    = 10,
                    RemainingTicketForSale    = 10,
                    TicketCategoryDescription = "Entry Only",
                    ViewFromStand             = "",
                    IsSeatSelection           = false,
                    Price = Convert.ToDecimal(item.Price),
                    IsInternationalCardAllowed = false,
                    IsEMIApplicable            = false,
                    ModifiedBy = ModifiedBy,
                    IsEnabled  = true,
                };
                FilEventTicketAttributeInserted = _eventTicketAttributeRepository.Save(newFilEventTicketAttribute);
            }
            else
            {
                FilEventTicketAttributeInserted = FilEventTicketAttribute;
            }
            return(FilEventTicketAttributeInserted);
        }
Пример #2
0
        public EventTicketAttribute SaveEventTicketAttribute(
            CreateTicketCommand command,
            FIL.Contracts.Models.CreateEventV1.TicketModel ticketModel,
            List <FIL.Contracts.DataModels.EventTicketAttribute> eventTicketAttributes)
        {
            EventTicketAttribute eventTicketAttribute = new EventTicketAttribute();
            var currentETA = eventTicketAttributes.Where(s => s.EventTicketDetailId == ticketModel.ETDId).FirstOrDefault();

            eventTicketAttribute.Id = currentETA != null ? currentETA.Id : 0;
            eventTicketAttribute.EventTicketDetailId       = ticketModel.ETDId;
            eventTicketAttribute.TicketCategoryNotes       = ticketModel.TicketCategoryNotes != null ? ticketModel.TicketCategoryNotes : "";
            eventTicketAttribute.SalesStartDateTime        = DateTime.UtcNow;
            eventTicketAttribute.SalesEndDatetime          = DateTime.UtcNow;
            eventTicketAttribute.TicketTypeId              = TicketType.Regular;
            eventTicketAttribute.ChannelId                 = Channels.Feel;
            eventTicketAttribute.CurrencyId                = ticketModel.CurrencyId;
            eventTicketAttribute.AvailableTicketForSale    = ticketModel.Quantity;
            eventTicketAttribute.RemainingTicketForSale    = ticketModel.Quantity;
            eventTicketAttribute.TicketCategoryDescription = ticketModel.Description == null ? "" : ticketModel.Description;
            eventTicketAttribute.ViewFromStand             = "";
            eventTicketAttribute.IsSeatSelection           = false;
            eventTicketAttribute.Price = (decimal)ticketModel.Price;
            eventTicketAttribute.IsInternationalCardAllowed = true;
            eventTicketAttribute.IsEMIApplicable            = false;
            eventTicketAttribute.IsEnabled          = true;
            eventTicketAttribute.TicketValidityType = TicketValidityTypes.Fixed;
            eventTicketAttribute.CreatedUtc         = (currentETA != null && currentETA.CreatedUtc != null) ? currentETA.CreatedUtc : DateTime.UtcNow;
            eventTicketAttribute.UpdatedUtc         = DateTime.UtcNow;
            eventTicketAttribute.CreatedBy          = (currentETA != null && currentETA.CreatedUtc != null) ? currentETA.CreatedBy : command.ModifiedBy;
            eventTicketAttribute.UpdatedBy          = command.ModifiedBy;
            eventTicketAttribute.ModifiedBy         = command.ModifiedBy;
            return(_eventTicketAttributeRepository.Save(eventTicketAttribute));
        }
Пример #3
0
        public EventTicketAttribute eventTicketAttributeUpdate(EventTicketAttribute eventTicketAttribute,
                                                               HttpContext _context, string CurrencyCode = "")
        {
            try
            {
                if (_IsGeoCurrencySelectionEnabled && eventTicketAttribute != null)
                {
                    string TargetCurrencyCode = CurrencyCode != "" ? CurrencyCode : GetSessionCurrency(_context);
                    int    TargetCurrencyID   = GetCurrencyID(TargetCurrencyCode).Id;

                    eventTicketAttribute.Price = _currencyConverter.Exchange(eventTicketAttribute.Price, GetCurrencyCode(eventTicketAttribute.CurrencyId).Code, TargetCurrencyCode);
                    eventTicketAttribute.SeasonPackagePrice = _currencyConverter.Exchange(eventTicketAttribute.SeasonPackagePrice, GetCurrencyCode(eventTicketAttribute.CurrencyId).Code, TargetCurrencyCode);
                    eventTicketAttribute.Specialprice       = _currencyConverter.Exchange(eventTicketAttribute.Specialprice, GetCurrencyCode(eventTicketAttribute.CurrencyId).Code, TargetCurrencyCode);
                    eventTicketAttribute.SpecialSeasonPrice = _currencyConverter.Exchange(eventTicketAttribute.SpecialSeasonPrice, GetCurrencyCode(eventTicketAttribute.CurrencyId).Code, TargetCurrencyCode);
                    eventTicketAttribute.CurrencyId         = TargetCurrencyID;
                }

                return(eventTicketAttribute);
            }
            catch (Exception e)
            {
                _logger.Log(LogCategory.Error, new Exception("", e));
                return(eventTicketAttribute);
            }
        }
Пример #4
0
        public EventTicketAttribute CreateEventTicketAttributes
            (long currentEventTicketDetail,
            string ticketCategoryNote,
            int CurrencyId,
            int Quantity,
            string TicketCategoryDescription,
            float PricePerTicket,
            bool IsRollingTicketValidityType,
            string Days,
            string Month,
            string Year,
            DateTime TicketValidityFixDate
            )
        {
            EventTicketAttribute eventTicketAttribute = new EventTicketAttribute();

            eventTicketAttribute.EventTicketDetailId       = currentEventTicketDetail;
            eventTicketAttribute.TicketCategoryNotes       = ticketCategoryNote;
            eventTicketAttribute.SalesStartDateTime        = DateTime.UtcNow;
            eventTicketAttribute.SalesEndDatetime          = DateTime.UtcNow;
            eventTicketAttribute.TicketTypeId              = TicketType.Regular;
            eventTicketAttribute.ChannelId                 = Channels.Feel;
            eventTicketAttribute.CurrencyId                = CurrencyId;
            eventTicketAttribute.AvailableTicketForSale    = Quantity;
            eventTicketAttribute.RemainingTicketForSale    = Quantity;
            eventTicketAttribute.TicketCategoryDescription = (TicketCategoryDescription == null ? "" : TicketCategoryDescription);
            eventTicketAttribute.ViewFromStand             = "";
            eventTicketAttribute.IsSeatSelection           = false;
            eventTicketAttribute.Price = (decimal)PricePerTicket;
            eventTicketAttribute.IsInternationalCardAllowed = true;
            eventTicketAttribute.IsEMIApplicable            = false;
            eventTicketAttribute.IsEnabled          = true;
            eventTicketAttribute.TicketValidityType = IsRollingTicketValidityType ? TicketValidityTypes.Rolling : TicketValidityTypes.Fixed;
            eventTicketAttribute.CreatedUtc         = DateTime.UtcNow;
            eventTicketAttribute.CreatedBy          = Guid.NewGuid();
            if (IsRollingTicketValidityType)
            {
                eventTicketAttribute.TicketValidity = Days + "-" + Month + "-" + Year;
            }
            else
            {
                eventTicketAttribute.TicketValidity = TicketValidityFixDate.ToString();
            }
            var currentEventTicketAttribute = _eventTicketAttribute.Save(eventTicketAttribute);

            return(currentEventTicketAttribute);
        }
Пример #5
0
        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;
                }
            }
        }
Пример #6
0
        protected override Task <ICommandResult> Handle(SaveEventTicketAttributeCommand command)
        {
            var EventTickeAttribute = new EventTicketAttribute();
            SaveEventTicketAttributeResult saveEventTicketAttributelResult = new SaveEventTicketAttributeResult();
            var checkForEventTicketAttribute = _eventTicketAttributeRepository.Get(command.Id);

            if (checkForEventTicketAttribute != null)
            {
                EventTickeAttribute = new EventTicketAttribute
                {
                    Id = checkForEventTicketAttribute.Id,
                    EventTicketDetailId       = command.EventTicketDetailId,
                    SalesStartDateTime        = command.SalesStartDateTime,
                    SalesEndDatetime          = command.SalesEndDatetime,
                    TicketTypeId              = (TicketType)command.TicketTypeId,
                    ChannelId                 = (Channels)command.ChannelId,
                    CurrencyId                = command.CurrencyId,
                    AvailableTicketForSale    = command.AvailableTicketForSale,
                    RemainingTicketForSale    = command.AvailableTicketForSale,
                    TicketCategoryDescription = command.TicketCategoryDescription,
                    ViewFromStand             = command.ViewFromStand,
                    IsSeatSelection           = false,
                    Price = command.price,
                    IsInternationalCardAllowed = false,
                    IsEMIApplicable            = false,
                    LocalPrice         = command.price,
                    SeasonPackage      = false,
                    SeasonPackagePrice = 0,
                    LocalCurrencyId    = command.CurrencyId,
                    IsEnabled          = command.IsEnabled,
                    CreatedUtc         = DateTime.UtcNow,
                    CreatedBy          = command.ModifiedBy
                };
            }
            else
            {
                EventTickeAttribute = new EventTicketAttribute
                {
                    Id = command.Id,
                    EventTicketDetailId       = command.EventTicketDetailId,
                    SalesStartDateTime        = command.SalesStartDateTime,
                    SalesEndDatetime          = command.SalesEndDatetime,
                    TicketTypeId              = (TicketType)command.TicketTypeId,
                    ChannelId                 = (Channels)command.ChannelId,
                    CurrencyId                = command.CurrencyId,
                    AvailableTicketForSale    = command.AvailableTicketForSale,
                    RemainingTicketForSale    = command.AvailableTicketForSale,
                    TicketCategoryDescription = command.TicketCategoryDescription,
                    ViewFromStand             = command.ViewFromStand,
                    IsSeatSelection           = false,
                    Price = command.price,
                    IsInternationalCardAllowed = false,
                    IsEMIApplicable            = false,
                    LocalPrice         = command.price,
                    SeasonPackage      = false,
                    SeasonPackagePrice = 0,
                    LocalCurrencyId    = command.CurrencyId,
                    IsEnabled          = command.IsEnabled,
                    CreatedUtc         = DateTime.UtcNow,
                    CreatedBy          = command.ModifiedBy
                };
            }

            FIL.Contracts.DataModels.EventTicketAttribute result = _eventTicketAttributeRepository.Save(EventTickeAttribute);
            saveEventTicketAttributelResult.Id = result.Id;
            return(Task.FromResult <ICommandResult>(saveEventTicketAttributelResult));
        }
Пример #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);
            }
        }