Example #1
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;
                }
            }
        }
Example #2
0
 public ExOzProduct Get(int id)
 {
     return(_exOzProductRepository.Get(id));
 }