protected void UpdateAllOperatorImages(ExOzOperatorResponse item, long OperatorId, Guid ModifiedBy) { List <ExOzOperatorImage> exOzOperatorImages = _exOzOperatorImageRepository.GetByOperatorId(OperatorId).ToList(); foreach (var img in item.Images) { ExOzOperatorImage existingExOzOperatorImage = exOzOperatorImages.Where(w => w.ImageURL == img).FirstOrDefault(); if (existingExOzOperatorImage == null) { ExOzOperatorImage newImage = new ExOzOperatorImage() { ImageURL = img, OperatorId = OperatorId, IsEnabled = true, ModifiedBy = ModifiedBy, }; _exOzOperatorImageRepository.Save(newImage); } else { existingExOzOperatorImage.IsEnabled = true; _exOzOperatorImageRepository.Save(existingExOzOperatorImage); } } }
protected Event UpdateEvent(ExOzOperatorResponse item, Event FilEvent, Guid ModifiedBy) { Event FilEventInserted = new Event(); if (FilEvent == null) { var newFilEvent = new Event { AltId = Guid.NewGuid(), Name = item.Name, EventCategoryId = 16, EventTypeId = Contracts.Enums.EventType.Perennial, Description = item.Description, ClientPointOfContactId = 1, FbEventId = null, MetaDetails = null, TermsAndConditions = item.Tips, IsPublishedOnSite = true, PublishedDateTime = DateTime.Now, PublishedBy = null, TestedBy = null, ModifiedBy = ModifiedBy, IsEnabled = true }; FilEventInserted = _eventRepository.Save(newFilEvent); } else { FilEventInserted = FilEvent; } return(FilEventInserted); }
protected ExOzOperator UpdateOperator(ExOzOperatorResponse item, ExOzOperator exOzOperator, long FilEventId, int FilVenueId, Guid ModifiedBy) { ExOzOperator exOzOperatorInserted = new ExOzOperator(); if (exOzOperator == null) { var newExOzOperator = new ExOzOperator { OperatorId = item.Id, Name = item.Name, PublicName = item.PublicName, UrlSegment = item.UrlSegment, CanonicalRegionUrlSegment = item.CanonicalRegionUrlSegment, RegionId = item.RegionId, EventId = FilEventId, VenueId = FilVenueId, Title = item.Title, Description = item.Description, Summary = item.Summary, Tips = item.Tips, Address = item.Address, Phone = item.Phone, Rating = item.Rating, Quantity = item.Quantity, Timestamp = item.Timestamp, GeoLocationName = item.Geolocations[0].Address, Latitude = item.Geolocations[0].Latitude, Longitude = item.Geolocations[0].Longitude, ModifiedBy = ModifiedBy, IsEnabled = true }; exOzOperatorInserted = _exOzOperatorRepository.Save(newExOzOperator); } else { exOzOperator.IsEnabled = true; exOzOperator.ModifiedBy = ModifiedBy; exOzOperatorInserted = _exOzOperatorRepository.Save(exOzOperator); } return(exOzOperatorInserted); }
protected Venue UpdateVenue(ExOzOperatorResponse item, Venue FilVenue, int FilCityId, Guid ModifiedBy) { string VenueName = ""; if (item.Geolocations[0].Label == null) { VenueName = item.Geolocations[0].Address; } else { VenueName = item.Geolocations[0].Label; } //Venue Venue FilVenueInserted = new Venue(); if (FilVenue == null) { Venue newFilVenue = new Venue { AltId = Guid.NewGuid(), Name = VenueName, AddressLineOne = item.Geolocations[0].Address, CityId = FilCityId, Latitude = item.Geolocations[0].Latitude, Longitude = item.Geolocations[0].Longitude, ModifiedBy = ModifiedBy, IsEnabled = true }; FilVenueInserted = _venueRepository.Save(newFilVenue); } else { FilVenueInserted = FilVenue; } return(FilVenueInserted); }
public async Task <ProductList> Synchronize(OperatorList operatorList) { string line = ""; _logger.StartMsg("Operators"); int i = 0; foreach (var op in operatorList.operators) { try { string input = op.CanonicalRegionUrlSegment + "/" + op.UrlSegment; ExOzOperatorResponse opDetails = new ExOzOperatorResponse(); string postResponse = HttpWebRequestHelper.ExOz_WebRequestGet(input); if (postResponse != "0") { opDetails = Mapper <ExOzOperatorResponse> .MapFromJson(postResponse); } if (opDetails.Id != -1 && opDetails.Geolocations != null && opDetails.Geolocations[0].Address != null) { opDetails.RegionId = op.RegionId; opDetails.RegionUrlSegment = op.RegionUrlSegment; CommonFunctions.replaceSingleQuotes(opDetails.Name); CommonFunctions.replaceSingleQuotes(opDetails.PublicName); CommonFunctions.replaceSingleQuotes(opDetails.Summary); CommonFunctions.replaceSingleQuotes(opDetails.Tips); CommonFunctions.replaceSingleQuotes(opDetails.Description); CommonFunctions.replaceSingleQuotes(opDetails.Address); //operatorList.operators = new List<ExOzOperatorResponse>(); OperatorList operatorDetails = new OperatorList() { operators = new List <ExOzOperatorResponse>() }; operatorDetails.operators.Add(opDetails); SaveExOzOperatorCommandResult retOperators = new SaveExOzOperatorCommandResult() { OperatorList = new List <ExOzOperator>() }; retOperators = await _commandSender.Send <SaveExOzOperatorCommand, SaveExOzOperatorCommandResult>(new SaveExOzOperatorCommand { OperatorList = operatorDetails.operators, ModifiedBy = new Guid("C043DDEE-D0B1-48D8-9C3F-309A77F44795") }); if (opDetails.Products != null) { ProductList productList = new ProductList { Products = new List <ExOzProductResponse>() }; foreach (var prod in opDetails.Products) { prod.CanonicalRegionUrlSegment = opDetails.CanonicalRegionUrlSegment; prod.OperatorUrlSegment = opDetails.UrlSegment; productList.Products.Add(prod); } _logger.StartMsg("Product"); SessionList sessionResponse = await _productSynchronizer.Synchronize(productList); } } i++; line = _logger.Update(i, operatorList.operators.Count, line); } catch (Exception e) { _logger.Log($"Exception: {e.Message}"); continue; } } ////Insert Operators here //try //{ // _logger.FinishMsg(retOperators.OperatorList.Count, "Operators"); // return productList; //} //catch (Exception e) //{ // _logger.Log($"Exception: {e.Message}"); // throw; //} return(null); }