Ejemplo n.º 1
0
        protected TicketFeeDetail UpdateTicketFeeDetails(TicketFeeDetail FilTicketFeeDetail, long FilEventTicketAttributeId, Guid ModifiedBy)
        {
            TicketFeeDetail FilTicketFeeDetailInserted = new TicketFeeDetail();

            if (FilTicketFeeDetail == null)
            {
                var newFilTicketFeeDetail = new TicketFeeDetail
                {
                    EventTicketAttributeId = FilEventTicketAttributeId,
                    FeeId       = 4,
                    DisplayName = "Bank",
                    ValueTypeId = 1,
                    Value       = 0.8m,
                    FeeGroupId  = null,
                    ModifiedBy  = ModifiedBy,
                    IsEnabled   = true,
                };
                FilTicketFeeDetailInserted = _ticketFeeDetailRepository.Save(newFilTicketFeeDetail);
            }
            else
            {
                FilTicketFeeDetailInserted = FilTicketFeeDetail;
            }
            return(FilTicketFeeDetailInserted);
        }
Ejemplo n.º 2
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;
                }
            }
        }
        protected override Task <ICommandResult> Handle(SaveTicketFeeDetailCommand command)
        {
            var eventFeeDetailData = new TicketFeeDetail();
            SaveEventTicketFeeDataResult saveEventTicketFeeDataResult = new SaveEventTicketFeeDataResult();
            var checkForEventTicketFeeDetail = _ticketFeeDetailRepository.GetByEventTicketAttributeIdAndFeedId(command.EventTicketAttributeId, command.FeedId);

            if (checkForEventTicketFeeDetail != null)
            {
                eventFeeDetailData = new TicketFeeDetail
                {
                    Id = checkForEventTicketFeeDetail.Id,
                    EventTicketAttributeId = command.EventTicketAttributeId,
                    FeeId       = command.FeedId,
                    DisplayName = "",
                    ValueTypeId = command.ValueTypeId,
                    Value       = command.Value,
                    IsEnabled   = command.IsEnabled,
                    CreatedUtc  = DateTime.UtcNow
                };
            }
            else
            {
                eventFeeDetailData = new TicketFeeDetail
                {
                    EventTicketAttributeId = command.EventTicketAttributeId,
                    FeeId       = command.FeedId,
                    DisplayName = "",
                    ValueTypeId = command.ValueTypeId,
                    Value       = command.Value,
                    IsEnabled   = command.IsEnabled
                };
            }

            FIL.Contracts.DataModels.TicketFeeDetail result = _ticketFeeDetailRepository.Save(eventFeeDetailData);
            saveEventTicketFeeDataResult.Id = result.Id;
            return(Task.FromResult <ICommandResult>(saveEventTicketFeeDataResult));
        }