public void AttractionsUpdate(AttractionsDTO attractionsDTO) { try { SqlHelper.QuerySP("AttractionsUpdate", new { AttractionsId = attractionsDTO.AttractionsId, AttractionName = attractionsDTO.AttractionName, AddressOne = (string.IsNullOrEmpty(attractionsDTO.AddressOne) ? "" :attractionsDTO.AddressOne), AddressTwo = (string.IsNullOrEmpty(attractionsDTO.AddressTwo) ? "" : attractionsDTO.AddressTwo), CityId = (string.IsNullOrEmpty(attractionsDTO.CityId.ToString()) ? 0 : attractionsDTO.CityId), CategoryId = (string.IsNullOrEmpty(attractionsDTO.CategoryId.ToString()) ? 0 : attractionsDTO.CategoryId), Longitude = (string.IsNullOrEmpty(attractionsDTO.Longitude) ? "" : attractionsDTO.Longitude), Latitude = (string.IsNullOrEmpty(attractionsDTO.Longitude) ? "" : attractionsDTO.Longitude), PlaceId = (string.IsNullOrEmpty(attractionsDTO.PlaceId) ? "" : attractionsDTO.PlaceId), RankId = (string.IsNullOrEmpty(attractionsDTO.RankId.ToString()) ? 0 : attractionsDTO.RankId), CreatedBy = (string.IsNullOrEmpty(attractionsDTO.CreatedBy) ? "" : attractionsDTO.CreatedBy), GoogleSearchText = (string.IsNullOrEmpty(attractionsDTO.GoogleSearchText) ? "" : attractionsDTO.GoogleSearchText), GoogleWebSite = (string.IsNullOrEmpty(attractionsDTO.GoogleWebSite) ? "" : attractionsDTO.GoogleWebSite), GoogleICon = (string.IsNullOrEmpty(attractionsDTO.GoogleICon) ? "" : attractionsDTO.GoogleICon), GoogleInternational_phone_number = (string.IsNullOrEmpty(attractionsDTO.GoogleInternational_phone_number) ? "" : attractionsDTO.GoogleInternational_phone_number), Googleadr_address = (string.IsNullOrEmpty(attractionsDTO.Googleadr_address) ? "" : attractionsDTO.Googleadr_address), GoogleName = (string.IsNullOrEmpty(attractionsDTO.GoogleName) ? "" : attractionsDTO.GoogleName), GoogleRating = (string.IsNullOrEmpty(attractionsDTO.GoogleRating) ? "" : attractionsDTO.GoogleRating), GoogleUser_ratings_total = (string.IsNullOrEmpty(attractionsDTO.GoogleUser_ratings_total.ToString()) ? 0 : attractionsDTO.GoogleUser_ratings_total) }); } catch (Exception ex) { throw ex; } }
public ActionResult UpdateAttractions(int attractionsId) { ModelAttractions model = new ModelAttractions(); if (attractionsId > 0) { AttractionsDTO _data = _IAttractions.AttractionsOnAttractionsId(new AttractionsDTO { AttractionsId = attractionsId }); model.AddressOne = _data.AddressOne; model.AddressTwo = _data.AddressTwo; model.AttractionName = _data.AttractionName; model.AttractionsId = _data.AttractionsId; model.CategoryId = _data.CategoryId; model.CityId = _data.CityId; model.CreatedBy = CurrentUser.UserName; model.Googleadr_address = _data.Googleadr_address; model.GoogleICon = _data.GoogleICon; model.GoogleInternational_phone_number = _data.GoogleInternational_phone_number; model.GoogleName = _data.GoogleName; model.GoogleRating = _data.GoogleRating; model.GoogleSearchText = _data.GoogleSearchText; model.GoogleUser_ratings_total = _data.GoogleUser_ratings_total; model.GoogleWebSite = _data.GoogleWebSite; model.Latitude = _data.Latitude; model.Longitude = _data.Longitude; model.PlaceId = _data.PlaceId; model.RankId = _data.RankId; } return(View(model)); }
public void Scheduler_InsertAttractionAuto(AttractionsDTO attractionsDTO, int countryId, int userTripId) { try { SqlHelper.countryId = countryId; SqlHelper.QuerySP("Scheduler_InsertAttractionAuto", new { Latitude = attractionsDTO.Latitude, AddressOne = attractionsDTO.AddressOne, AddressTwo = attractionsDTO.AddressTwo, CityName = attractionsDTO.CityName, CreatedBy = attractionsDTO.CreatedBy, Longitude = attractionsDTO.Longitude, PlaceId = attractionsDTO.PlaceId, StateName = attractionsDTO.StateName, CountryId = attractionsDTO.CountryId, AttractionsId = attractionsDTO.AttractionsId, StateShortName = attractionsDTO.StateShortName, CityShortName = attractionsDTO.CityShortName, UserTripId = userTripId }); } catch (Exception ex) { throw ex; } }
public IEnumerable <AttractionsDTO> GetAttractions() { //Mapper.Initialize(cfg => cfg.CreateMap<Attractions, AttractionsDTO>()); //return Mapper.Map<IEnumerable<Attractions>, List<AttractionsDTO>>(Database.Attractions.GetAll()); var attractions = Database.Attractions.GetAll(); return(attractions.Select(x => AttractionsDTO.AttractionsFromCoreToDTO(x))); }
public void AddAttraction(AttractionsDTO attraction) { //Mapper.Initialize(cfg => cfg.CreateMap<CityDTO, City>()); //var cityCore = Mapper.Map<CityDTO, City>(Database.Cities.Create(city)); var attractionCore = AttractionsDTO.AttractionsFromDTOToCore(attraction); Database.Attractions.Create(attractionCore); }
public void AttractionsUpdate(AttractionsDTO attractionsDTO) { try { _client.AttractionsUpdate(attractionsDTO); } catch (Exception ex) { throw ex; } }
public AttractionsDTO AttractionsOnAttractionsId(AttractionsDTO attractionsDTO) { try { return(_client.AttractionsOnAttractionsId(attractionsDTO)); } catch (Exception ex) { throw ex; } }
public int Services_AddAttraction(AttractionsDTO attractionDTO, List <userTable_Category> Category, List <user_AttractionsActiveStatus> attractionsActiveStatus) { try { return(_businessSchedulers.Services_AddAttraction(attractionDTO, Category, attractionsActiveStatus)); } catch (Exception ex) { throw ex; } }
public AttractionsDTO AttractionsOnAttractionsId(AttractionsDTO attractionsDTO) { try { return(_businessAttractions.AttractionsOnAttractionsId(attractionsDTO)); } catch (Exception ex) { throw ex; } }
public List <AttractionsDTO> AttractionsOnCityId(AttractionsDTO attractionsDTO) { try { return(_businessAttractions.AttractionsOnCityId(attractionsDTO)); } catch (Exception ex) { throw ex; } }
public void AttractionsUpdate(AttractionsDTO attractionsDTO) { try { _businessAttractions.AttractionsUpdate(attractionsDTO); } catch (Exception ex) { throw ex; } }
public List <AttractionsDTO> AttractionsCheckExists(AttractionsDTO attractionsDTO) { try { return(_businessAttractions.AttractionsCheckExists(attractionsDTO)); } catch (Exception ex) { throw ex; } }
public static AttractionsViewModel AttractionsFromDTOToViewModel(AttractionsDTO attraction) { return(new AttractionsViewModel { AttractionId = attraction.AttractionId, AttractionName = attraction.AttractionName, CountryId = attraction.CountryId, CityId = attraction.CityId, Type = attraction.Type, Description = attraction.Description, ImageName = attraction.ImageName }); }
public List <AttractionsDTO> AttractionsOnCityId(AttractionsDTO attractionsDTO) { try { List <AttractionsDTO> _returnResult = SqlHelper.QuerySP <AttractionsDTO>("AttractionsOnCityId", new { CityId = attractionsDTO.CityId }).ToList(); return(_returnResult); } catch (Exception ex) { throw ex; } }
public AttractionsDTO AttractionsOnAttractionsId(AttractionsDTO attractionsDTO) { try { List <AttractionsDTO> _returnResult = SqlHelper.QuerySP <AttractionsDTO>("AttractionsOnAttractionsId", new { AttractionsId = attractionsDTO.AttractionsId }).ToList(); return(_returnResult.FirstOrDefault()); } catch (Exception ex) { throw ex; } }
public ActionResult UpdateSearchInformation() { string googleSearchText = "BAPS Shri Swaminarayan Mandir, Claireville Drive, Toronto, ON, Canada"; string attractionId = "169,15,109,95"; bool userRequest = true; List <AttractionsDTO> _listAttractionsDTO = new List <AttractionsDTO>(); //string googleSearchText = "10220 Douglas Oaks Circle, Tampa, FL"; AttractionsDTO _attractionsDTO = _ISchedulers.Services_CheckAttractionExist(googleSearchText); if (_attractionsDTO != null && !string.IsNullOrEmpty(_attractionsDTO.GoogleSearchText)) { ViewBag.SearchData = false; _listAttractionsDTO = _ISchedulers.Services_GetPlaceDetails(attractionId.Split(',').ToList().Select(x => new userTable_OnlyId { ID = int.Parse(x) }).ToList(), _attractionsDTO.AttractionsId); var sourceInformation = _attractionsDTO.AttractionsId + "~" + _attractionsDTO.GoogleSearchText; string destinationPlaceId = string.Empty; int counter = 1; foreach (AttractionsDTO _localAttractionsDTO in _listAttractionsDTO) { if (counter == 0) { destinationPlaceId = _localAttractionsDTO.AttractionsId + "~" + _localAttractionsDTO.GoogleSearchText; } else { destinationPlaceId += _localAttractionsDTO.AttractionsId + "~" + _localAttractionsDTO.GoogleSearchText; } if (counter != _listAttractionsDTO.Count) { destinationPlaceId += "^"; } counter++; } return(RedirectToAction("TravelDistance", new { sourceInformation = sourceInformation, destinationInformation = destinationPlaceId })); } else { ViewBag.SearchData = true; ViewBag.googleSearchText = googleSearchText; ViewBag.attractionId = attractionId; ViewBag.userRequest = userRequest; } return(View()); }
public List <AttractionsDTO> AttractionsCheckExists(AttractionsDTO attractionsDTO) { try { List <AttractionsDTO> _returnResult = SqlHelper.QuerySP <AttractionsDTO>("AttractionsCheckExists", new { AttractionsId = attractionsDTO.AttractionsId, AttractionName = attractionsDTO.AttractionName, CityId = attractionsDTO.CityId }).ToList(); return(_returnResult); } catch (Exception ex) { throw ex; } }
public int Services_AddAttraction(AttractionsDTO attractionDTO, List <userTable_Category> Category, List <user_AttractionsActiveStatus> attractionsActiveStatus) { try { var _returnResult = SqlHelper.QuerySP <int>("Services_AddAttraction", new { AttractionName = attractionDTO.AttractionName , AddressOne = attractionDTO.AddressOne , AddressTwo = attractionDTO.AddressTwo , CityId = attractionDTO.CityId , CategoryId = attractionDTO.CategoryId , Longitude = attractionDTO.Longitude , Latitude = attractionDTO.Longitude , PlaceId = attractionDTO.PlaceId , RankId = attractionDTO.RankId , CreatedBy = attractionDTO.CreatedBy , GoogleSearchText = attractionDTO.GoogleSearchText , GoogleWebSite = attractionDTO.GoogleWebSite , GoogleICon = attractionDTO.GoogleICon , GoogleInternational_phone_number = attractionDTO.GoogleInternational_phone_number , Googleadr_address = attractionDTO.Googleadr_address , GoogleName = attractionDTO.GoogleName , GoogleRating = attractionDTO.GoogleRating , GoogleUser_ratings_total = attractionDTO.GoogleUser_ratings_total , IsUserPersonalRequest = attractionDTO.IsUserPersonalRequest , AttractionTimeExisted = attractionDTO.AttractionTimeExisted , AttractionsActiveStatusInfo = DataTableFun.ToDataTable <user_AttractionsActiveStatus>(attractionsActiveStatus) , CategoryList = DataTableFun.ToDataTable <userTable_Category>(Category) }).ToList(); return(_returnResult.FirstOrDefault()); } catch (Exception ex) { throw ex; } }
public void GetAutoCompleteInformation(int countryId, GetPlaceDetails details, MasterCountryScheduler masterCountryScheduler, int attractionsId, int userTripId = 0) { try { //var googleCounter = dALSchedulers.Scheduler_GetGoogleMapsMethodCount("geocode"); //if (googleCounter == null || googleCounter.Counter < Convert.ToInt32(ConfigurationManager.AppSettings["recordCount"])) { AttractionsDTO attractionDto; string retsult = string.Empty; string googleUrl = "https://maps.googleapis.com/maps/api/geocode/json?address=" + details.AttractionName + " " + details.GoogleSearchText + "&components=country:" + masterCountryScheduler.CountryShortName + "&key=" + ConfigurationManager.AppSettings["apiKey"]; retsult = webRequest.WebServiceInformation(googleUrl); var placeDetailsInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <EntityPlaceSearch>(retsult); if (placeDetailsInfo.results != null && placeDetailsInfo.results.Count > 0) { //dALSchedulers.Scheduler_GoogleLogging("geocode", "GetAutoCompleteInformation", // details.AttractionName, "", "", // false); } else { //dALSchedulers.Scheduler_GoogleLogging("geocode", "GetAutoCompleteInformation", // details.AttractionName, "", "", // true); } if (placeDetailsInfo != null) { if (masterCountryScheduler.CountryName != GetLongNameAddressElement(placeDetailsInfo.results .FirstOrDefault() .address_components, "country")) { dALSchedulers.SchedulerDeleteAttraction(attractionsId, countryId); } else { attractionDto = new AttractionsDTO(); attractionDto.Latitude = placeDetailsInfo.results.FirstOrDefault().geometry.location.lat; attractionDto.AddressOne = GetLongNameAddressElement(placeDetailsInfo.results .FirstOrDefault() .address_components, "street_number") + " " + GetLongNameAddressElement(placeDetailsInfo.results .FirstOrDefault() .address_components, "route"); attractionDto.AddressTwo = GetLongNameAddressElement(placeDetailsInfo.results .FirstOrDefault() .address_components, "administrative_area_level_2"); attractionDto.CityName = GetLongNameAddressElement(placeDetailsInfo.results.FirstOrDefault() .address_components, "locality"); if (string.IsNullOrEmpty(attractionDto.CityName)) { attractionDto.CityName = GetLongNameAddressElement(placeDetailsInfo.results.FirstOrDefault() .address_components, "administrative_area_level_2"); } attractionDto.CreatedBy = "schedule"; attractionDto.Longitude = placeDetailsInfo.results.FirstOrDefault().geometry.location.lng; attractionDto.PlaceId = placeDetailsInfo.results.FirstOrDefault().place_id; attractionDto.StateName = GetLongNameAddressElement(placeDetailsInfo.results .FirstOrDefault() .address_components, "administrative_area_level_1"); attractionDto.CountryId = countryId; attractionDto.AttractionsId = attractionsId; attractionDto.StateShortName = GetShortNameAddressElement(placeDetailsInfo.results.FirstOrDefault() .address_components, "administrative_area_level_1"); attractionDto.CityShortName = GetShortNameAddressElement(placeDetailsInfo.results.FirstOrDefault() .address_components, "locality"); if (string.IsNullOrEmpty(attractionDto.CityShortName)) { attractionDto.CityShortName = GetLongNameAddressElement(placeDetailsInfo.results.FirstOrDefault() .address_components, "administrative_area_level_2"); } dALSchedulers.Scheduler_InsertAttractionAuto(attractionDto, countryId, userTripId); GetPlaceDetails(attractionDto.PlaceId, attractionsId, countryId); } } else { dALSchedulers.SchedulerDeleteAttraction(attractionsId, countryId); } } } catch (Exception e) { throw e; } }
public int Services_AddAttraction(AttractionsDTO attractionDTO, List <userTable_Category> Category, List <user_AttractionsActiveStatus> attractionsActiveStatus) { return(_client.Services_AddAttraction(attractionDTO, Category, attractionsActiveStatus)); }
private void GetPlaceDetails(string placeId, int attractionsId, int countryId) { if (!string.IsNullOrEmpty(placeId)) { //var googleCounter = dALSchedulers.Scheduler_GetGoogleMapsMethodCount("place"); //if (googleCounter == null || googleCounter.Counter < // Convert.ToInt32(ConfigurationManager.AppSettings["recordCount"])) { string retsult = string.Empty; string googleUrl = "https://maps.googleapis.com/maps/api/place/details/json?placeid=" + placeId + "&key=" + ConfigurationManager.AppSettings["apiKey"]; retsult = webRequest.WebServiceInformation(googleUrl); var placeDetailsInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <EntityPlaceDetails>(retsult); if (placeDetailsInfo.result != null) { //dALSchedulers.Scheduler_GoogleLogging("place", "GetPlaceDetails", placeId, "", "", // false); } else { //dALSchedulers.Scheduler_GoogleLogging("place", "GetPlaceDetails", placeId, "", "", // true); } if (placeDetailsInfo != null && placeDetailsInfo.result != null) { SchedulerInsertPlaceDetails schedulerInsertPlaceDetails = new SchedulerInsertPlaceDetails(); schedulerInsertPlaceDetails.AttractionsId = attractionsId; schedulerInsertPlaceDetails.Category = placeDetailsInfo.result.types; schedulerInsertPlaceDetails.GoogleWebSite = placeDetailsInfo.result.url; schedulerInsertPlaceDetails.GoogleICon = placeDetailsInfo.result.icon; schedulerInsertPlaceDetails.GoogleInternational_phone_number = placeDetailsInfo.result.international_phone_number; schedulerInsertPlaceDetails.Googleadr_address = placeDetailsInfo.result.formatted_address; schedulerInsertPlaceDetails.GoogleName = placeDetailsInfo.result.name; schedulerInsertPlaceDetails.GoogleRating = Convert.ToDecimal(placeDetailsInfo.result.rating); schedulerInsertPlaceDetails.WeekDaysOpenClose = SerilizeOpenCloseTime(placeDetailsInfo.result.opening_hours); schedulerInsertPlaceDetails.GoogleUser_ratings_total = placeDetailsInfo.result.rating; schedulerInsertPlaceDetails.Pricelevel = Convert.ToInt32(placeDetailsInfo.result.price_level); schedulerInsertPlaceDetails.GooglePhotos = (placeDetailsInfo.result.photos == null || placeDetailsInfo.result.photos.Count == 0 ? null : placeDetailsInfo.result.photos.Select(x => new GooglePhotos { Height = Convert.ToInt32(x.height), Html_attributions = x.html_attributions.FirstOrDefault(), Photo_reference = x.photo_reference, Width = Convert.ToInt32(x.width) }).ToList()); schedulerInsertPlaceDetails.GoogleReview = placeDetailsInfo.result.reviews == null || placeDetailsInfo.result.reviews.Count == 0 ? null : placeDetailsInfo.result.reviews.Select(x => new GoogleReview { Rating = Convert.ToInt32(x.rating), Author_name = x.author_name, Author_url = x.author_url, //CreatedDate = new DateTime(Convert.ToInt64(x.time)*1000,DateTimeKind.Utc), Language = x.language, Profile_photo_url = x.author_url, Text = x.text }).ToList(); schedulerInsertPlaceDetails.Utc_offset = string.IsNullOrEmpty(placeDetailsInfo.result.utc_offset) ? 0 : Convert.ToInt32(placeDetailsInfo.result.utc_offset); AttractionsDTO attractionDto = new AttractionsDTO(); attractionDto.Latitude = placeDetailsInfo.result.geometry.location.lat; attractionDto.AddressOne = GetLongNameAddressElement(placeDetailsInfo.result.address_components, "street_number") + " " + GetLongNameAddressElement(placeDetailsInfo.result .address_components, "route"); attractionDto.AddressTwo = GetLongNameAddressElement(placeDetailsInfo.result .address_components, "administrative_area_level_2"); attractionDto.CityName = GetLongNameAddressElement(placeDetailsInfo.result .address_components, "locality"); attractionDto.CreatedBy = "schedule"; attractionDto.Longitude = placeDetailsInfo.result.geometry.location.lng; attractionDto.PlaceId = placeDetailsInfo.result.place_id; attractionDto.StateName = GetLongNameAddressElement(placeDetailsInfo.result .address_components, "administrative_area_level_1"); attractionDto.CountryId = countryId; attractionDto.AttractionsId = attractionsId; attractionDto.StateShortName = GetShortNameAddressElement(placeDetailsInfo.result .address_components, "administrative_area_level_1"); attractionDto.CityShortName = GetShortNameAddressElement(placeDetailsInfo.result .address_components, "locality"); attractionDto.AttractionName = placeDetailsInfo.result.name; dALSchedulers.Scheduler_InsertAttractionInfo(schedulerInsertPlaceDetails, countryId, attractionDto); } } } }
public void Scheduler_InsertAttractionInfo(SchedulerInsertPlaceDetails schedulerInsertPlaceDetails, int countryId, AttractionsDTO attractionsDTO) { try { if (schedulerInsertPlaceDetails.WeekDaysOpenClose == null) { schedulerInsertPlaceDetails.WeekDaysOpenClose = new List <WeekDaysOpenClose>(); } if (schedulerInsertPlaceDetails.GooglePhotos == null) { schedulerInsertPlaceDetails.GooglePhotos = new List <GooglePhotos>(); } if (schedulerInsertPlaceDetails.GoogleReview == null) { schedulerInsertPlaceDetails.GoogleReview = new List <GoogleReview>(); } SqlHelper.countryId = countryId; SqlHelper.QuerySP("Scheduler_InsertAttractionInfo", new { AttractionsId = schedulerInsertPlaceDetails.AttractionsId, CategoryDt = ConvertArrayToDataTable.GetDataTableCateogry(schedulerInsertPlaceDetails.Category), GoogleWebSite = schedulerInsertPlaceDetails.GoogleWebSite, GoogleICon = schedulerInsertPlaceDetails.GoogleICon, GoogleInternational_phone_number = schedulerInsertPlaceDetails.GoogleInternational_phone_number, Googleadr_address = schedulerInsertPlaceDetails.Googleadr_address, GoogleName = schedulerInsertPlaceDetails.GoogleName, GoogleRating = schedulerInsertPlaceDetails.GoogleRating, WeekDaysOpenClose = DataTableFun.ToDataTable <WeekDaysOpenClose>(schedulerInsertPlaceDetails.WeekDaysOpenClose), GooglePhotos = DataTableFun.ToDataTable <GooglePhotos>(schedulerInsertPlaceDetails.GooglePhotos), GoogleReview = DataTableFun.ToDataTable <GoogleReview>(schedulerInsertPlaceDetails.GoogleReview), Pricelevel = schedulerInsertPlaceDetails.Pricelevel, Latitude = attractionsDTO.Latitude, AddressOne = attractionsDTO.AddressOne, AddressTwo = attractionsDTO.AddressTwo, CityName = attractionsDTO.CityName, CreatedBy = attractionsDTO.CreatedBy, Longitude = attractionsDTO.Longitude, PlaceId = attractionsDTO.PlaceId, StateName = attractionsDTO.StateName, CountryId = attractionsDTO.CountryId, StateShortName = attractionsDTO.StateShortName, CityShortName = attractionsDTO.CityShortName, Utc_offset = schedulerInsertPlaceDetails.Utc_offset, AttractionName = attractionsDTO.AttractionName }); } catch (Exception ex) { throw ex; } }