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 ExOzProduct UpdateProduct(ExOzProductResponse item, ExOzProduct exOzProduct, long FilEventDetailId, int FilVenueId, Guid ModifiedBy) { ExOzProduct exOzProductInserted = new ExOzProduct(); if (exOzProduct == null) { var newExOzProduct = new ExOzProduct { ProductId = item.Id, Name = item.Name, UrlSegment = item.UrlSegment, Summary = item.Summary, OperatorId = item.OperatorId, EventDetailId = FilEventDetailId, VenueId = FilVenueId, CanonicalRegionUrlSegment = item.CanonicalRegionUrlSegment, BookingRequired = item.BookingRequired, HandlerKey = item.HandlerKey, Title = item.Title, Timestamp = item.Timestamp, OperatorName = item.OperatorName, Description = item.Description, MoreInfo = item.MoreInfo, Tips = item.Tips, ModifiedBy = ModifiedBy, IsEnabled = true, HelpCode = item.HelpCode, Timezone = item.Timezone, }; exOzProductInserted = _exOzProductRepository.Save(newExOzProduct); } else { exOzProduct.IsEnabled = true; exOzProduct.ModifiedBy = ModifiedBy; exOzProductInserted = _exOzProductRepository.Save(exOzProduct); } return(exOzProductInserted); }
protected void UpdateAllSessions(SaveExOzSessionCommand command) { int i = 0; List <long> apiProductSessionIds = command.SessionList.Select(w => w.Id).ToList(); var exOzProductSessions = _exOzProductSessionRepository.GetBySessionIds(apiProductSessionIds); foreach (var item in command.SessionList) { try { ExOzProductSession exOzProductSession = exOzProductSessions.Where(w => w.ProductSessionId == item.Id).FirstOrDefault(); ExOzProduct exOzProduct = _exOzProductRepository.GetByProductId(item.ProductId); ExOzProductSession retProductSession = UpdateProductSession(item, exOzProductSession, exOzProduct.Id, command.ModifiedBy); updatedSessions.SessionList.Add(retProductSession); } catch (Exception e) { throw; } } }
protected void UpdateAllProducts(SaveExOzProductCommand command) { int i = 0; List <string> apiProductNames = command.ProductList.Select(w => w.Name).Distinct().ToList(); var FilEventDetails = _eventDetailRepository.GetByNames(apiProductNames); var exOzProducts = _exOzProductRepository.GetByNames(apiProductNames); foreach (var item in command.ProductList) { i++; ExOzProduct exOzProduct = exOzProducts.Where(w => w.ProductId == item.Id).FirstOrDefault(); EventDetail FilEventDetail = FilEventDetails.Where(w => w.Name == item.Name).FirstOrDefault(); ExOzOperator exOzOperator = _exOzOperatorRepository.GetByUrlSegment(item.OperatorUrlSegment); Event FilEvent = _eventRepository.GetAllByName(exOzOperator.Name).FirstOrDefault(); //Venue FilVenue = _venueRepository.GetByName(item.Geolocations[0].Address); //if (FilVenue == null) //{ // ExOzRegion exOzRegion = _exOzRegionRepository.GetByUrlSegment(exOzOperator.CanonicalRegionUrlSegment); // City FilCity = _cityRepository.GetByName(exOzRegion.Name); // FilVenue = UpdateVenue(item.Geolocations[0], FilVenue, FilCity.Id, command.ModifiedBy); //} try { EventDetail retEventDetail = UpdateEventDetail(item.Name, FilEventDetail, FilEvent.Id, (int)exOzOperator.VenueId, command.ModifiedBy); ExOzProduct retProduct = UpdateProduct(item, exOzProduct, retEventDetail.Id, (int)exOzOperator.VenueId, command.ModifiedBy); updatedProducts.ProductList.Add(retProduct); UpdateProductImages(item, retEventDetail.Id, retProduct.Id, command.ModifiedBy); UpdateProductHighlights(item, retEventDetail.Id, retProduct.Id, command.ModifiedBy); } catch (Exception e) { throw; } } }
public void Delete(ExOzProduct exOzProduct) { _exOzProductRepository.Delete(exOzProduct); }
public ExOzProduct Save(ExOzProduct exOzProduct) { return(_exOzProductRepository.Save(exOzProduct)); }