Ejemplo n.º 1
0
    public static PlaceDetail create(Place p, string url, string phone, string site)
    {
        PlaceDetail pd = new PlaceDetail(p);

        pd.Url = url;
        pd.InternationalPhoneNumber = phone;
        pd.Website = site;
        return(pd);
    }
Ejemplo n.º 2
0
 private Task <bool> UpdateAlgoliaExports(PlaceDetail currentPlace, AlgoliaExport currentAlgoliaObject)
 {
     currentAlgoliaObject.Name          = currentPlace.Name;
     currentAlgoliaObject.Description   = currentPlace.EventDescription;
     currentAlgoliaObject.State         = currentPlace.StateName;
     currentAlgoliaObject.Country       = currentPlace.CountryName;
     currentAlgoliaObject.City          = currentPlace.CityName;
     currentAlgoliaObject.Category      = currentPlace.ParentCategory;
     currentAlgoliaObject.SubCategory   = currentPlace.Category;
     currentAlgoliaObject.Url           = currentPlace.Url;
     currentAlgoliaObject.PlaceImageUrl = "https://static1.feelaplace.com/images/places/tiles/" + currentPlace.AltId.ToString().ToUpper() + "-ht-c1.jpg";
     currentAlgoliaObject.IsEnabled     = true;
     currentAlgoliaObject.IsIndexed     = true;
     currentAlgoliaObject.CityId        = currentPlace.CityId;
     currentAlgoliaObject.CountryId     = currentPlace.CountryId;
     currentAlgoliaObject.StateId       = currentPlace.StateId;
     _algoliaExportRepositoryRepository.Save(currentAlgoliaObject);
     return(Task.FromResult(true));
 }
Ejemplo n.º 3
0
 private Task <bool> InsertObjects(PlaceDetail currentPlace)
 {
     _algoliaExportRepositoryRepository.Save(new AlgoliaExport
     {
         ObjectId      = currentPlace.Id.ToString(),
         Name          = currentPlace.Name,
         Description   = currentPlace.EventDescription,
         State         = currentPlace.StateName,
         Country       = currentPlace.CountryName,
         City          = currentPlace.CityName,
         Category      = currentPlace.ParentCategory,
         SubCategory   = currentPlace.Category,
         Url           = currentPlace.Url,
         PlaceImageUrl = "https://static1.feelaplace.com/images/places/tiles/" + currentPlace.AltId.ToString().ToUpper() + "-ht-c1.jpg",
         CityId        = currentPlace.CityId,
         CountryId     = currentPlace.CountryId,
         StateId       = currentPlace.StateId,
         IsEnabled     = true,
         IsIndexed     = true
     });
     return(Task.FromResult(true));
 }
Ejemplo n.º 4
0
        private bool ShouldInsert(AlgoliaExport algoliaExportModel, PlaceDetail eventDetailModel)
        {
            if (algoliaExportModel != null && (algoliaExportModel.Name != eventDetailModel.Name ||
                                               algoliaExportModel.Description != eventDetailModel.EventDescription ||
                                               algoliaExportModel.Category != eventDetailModel.ParentCategory ||
                                               algoliaExportModel.SubCategory != eventDetailModel.Category ||
                                               algoliaExportModel.City != eventDetailModel.CityName ||
                                               algoliaExportModel.State != eventDetailModel.StateName ||
                                               algoliaExportModel.Country != eventDetailModel.CountryName ||
                                               algoliaExportModel.CityId != eventDetailModel.CityId ||
                                               algoliaExportModel.StateId != eventDetailModel.StateId ||
                                               algoliaExportModel.CountryId != eventDetailModel.CountryId ||
                                               algoliaExportModel.Url != eventDetailModel.Url
                                               ))

            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        private bool CheckForUpdate(AlgoliaExport currentAlgoliaObject, PlaceDetail currentPlace)
        {
            if (currentAlgoliaObject.Name != currentPlace.Name ||
                currentAlgoliaObject.Description != currentPlace.EventDescription ||
                currentAlgoliaObject.Category != currentPlace.ParentCategory ||
                currentAlgoliaObject.SubCategory != currentPlace.Category ||
                currentAlgoliaObject.City != currentPlace.CityName ||
                currentAlgoliaObject.State != currentPlace.StateName ||
                currentAlgoliaObject.Country != currentPlace.CountryName ||
                currentAlgoliaObject.CityId != currentPlace.CityId ||
                currentAlgoliaObject.StateId != currentPlace.StateId ||
                currentAlgoliaObject.CountryId != currentPlace.CountryId ||
                currentAlgoliaObject.Url != currentPlace.Url
                )

            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        public ActionResult Detail(Place place)
        {
            var detail = new PlaceDetail(place);
            //get eworky details
            using (var client = new WebClient())
            {
                client.Encoding = Encoding.UTF8;
                try
                {
                    var path = eworkyDetail + "&id=" + place.EworkyId;
                    string textString = client.DownloadString(path);
                    JObject eworkyJson = JObject.Parse(textString);
                    var eworkyPlace = eworkyJson["response"];
                    detail.Name = (string)eworkyPlace["name"];
                    detail.Description= (string)eworkyPlace["description"];
                    detail.EworkyImage = (string)eworkyPlace["image"];
                    var comments = eworkyPlace["comments"];
                    foreach(var com in comments)
                    {
                        detail.Comments.Add(new Comment
                        {
                            Author= (string)com["author"]["firstName"],
                            Post=(string)com["post"]
                        });
                    }
                }
                catch (WebException)
                {
                }
            }

            //get 4SQ details
            using (var client = new WebClient())
            {
                client.Encoding = Encoding.UTF8;
                try
                {
                    var path = string.Format(FoursquareDetail, place.FoursquareId, GetTokenKey());
                    string textString = client.DownloadString(path);
                    JObject foursquareJson = JObject.Parse(textString);
                    var venue = foursquareJson["response"]["venue"];

                    var mayor = venue["mayor"]["user"];
                    if (mayor != null)
                    {
                        detail.Mayor = new Mayor
                        {
                            FirstName = (string)mayor["firstName"],
                            LastName = (string)mayor["lastName"],
                            Photo = (string)mayor["photo"],
                            Gender = (string)mayor["gender"],
                        };
                    }

                    //comments
                    var groups = venue["tips"]["groups"];
                    if (groups != null)
                    {
                        foreach (var g in groups)
                        {
                            var tips = g["items"];
                            foreach (var t in tips)
                            {
                                detail.Comments.Add(new Comment
                                {
                                    Author = (string)t["user"]["firstName"],
                                    Post = (string)t["text"]
                                });
                            }
                        }
                    }

                    //categories
                    var categories = venue["categories"];
                    foreach (var c in categories)
                    {
                        detail.Categories.Add((string)c["shortName"]);
                    }

                }
                catch (WebException)
                {
                }
            }

            return View(detail);
        }
Ejemplo n.º 7
0
 public string GetQuery(FeelUserJourneyQuery query, FIL.Contracts.DataModels.EventCategory eventCategory, PlaceDetail placeDetail,
                        int ParentEventCategoryId, PageDetail pageDetail)
 {
     if (eventCategory.MasterEventTypeId == Contracts.Enums.MasterEventType.Online || eventCategory.MasterEventTypeId == Contracts.Enums.MasterEventType.InRealLife)
     {
         return("?category=" + ParentEventCategoryId +
                (pageDetail.IsCountryLevel ? "&country=" + placeDetail.CountryId : pageDetail.IsStateLevel ? "&state=" + placeDetail.StateId :
                 pageDetail.IsCityLevel ? "&city=" + placeDetail.CityId : ""));
     }
     else if (query.PageType == Contracts.Enums.PageType.Category)
     {
         return("?category=" + ParentEventCategoryId + "&subcategory=" + eventCategory.Id +
                (pageDetail.IsCountryLevel ? "&country=" + placeDetail.CountryId : pageDetail.IsStateLevel ? "&state=" + placeDetail.StateId :
                 pageDetail.IsCityLevel ? "&city=" + placeDetail.CityId : ""));
     }
     else
     {
         return("?country=" + placeDetail.CountryId + (eventCategory.EventCategoryId == 0 ? "&category=" + eventCategory.Id : "&category=" + ParentEventCategoryId + "&subcategory=" + eventCategory.Id) +
                (pageDetail.IsStateLevel ? "&state=" + placeDetail.StateId :
                 pageDetail.IsCityLevel ? "&city=" + placeDetail.CityId : ""));
     }
 }