Esempio n. 1
0
        private void RequestItemsForDay(DateTime date)
        {
            ITTFilterRequest dayFilter = new ITTFilterRequest();

            dayFilter.AddFilterValue(new DistanceValue());
            dayFilter.AddFilterValue(new MinDateValue(date));
            dayFilter.AddFilterValue(new MaxDateValue(date.Date));
            ITTDataCache.Instance.RequestCombinedActivities(this.ReceivedSingleDaysActivities, this.OnResponseFailure, dayFilter);
        }
		public void OnApplyPressed()
		{
			// Item type
			TypeValue typeFilter = new TypeValue(Type_Value.Activities);

			// Category
			Category_Value cv = Category_Value.All;
			int numSet = 0;
			if (model.physicalActivityToggle.value)
			{
				numSet++;
				cv |= Category_Value.Physical_Activities;
			}
			if (model.healthWellnessToggle.value)
			{
				numSet++;
				cv |= Category_Value.Health_Wellness;
			}
			if (model.foodNutritionToggle.value)
			{
				numSet++;
				cv |= Category_Value.Food_Nutrition;
			}
			
			if (numSet >= global::System.Enum.GetNames(typeof(Category_Value)).Length-1)
			{
				cv = Category_Value.All;
			}

			CategoryValue categoryFilter = new CategoryValue(cv);


			// Audience
			Audience_Value av = Audience_Value.All;
			numSet = 0;
			if (model.audienceKidsToggle.value)
			{
				numSet++;
				av |= Audience_Value.Children;
			}
			if (model.audienceTeensToggle.value)
			{
				numSet++;
				av |= Audience_Value.Teenagers;
			}
			if (model.audienceAdultsToggle.value)
			{
				numSet++;
				av |= Audience_Value.Adults;
			}
			if (model.audienceSeniorsToggle.value)
			{
				numSet++;
				av |= Audience_Value.Senior_Citizen;
			}

			if (numSet >= global::System.Enum.GetNames(typeof(Audience_Value)).Length-1)
			{
				av = Audience_Value.All;
			}

			AudienceValue audienceFilter = new AudienceValue(av);


			// Skill
			SkillLevel_Value sv = SkillLevel_Value.All;
			numSet = 0;
			if (model.skillBeginnerToggle.value)
			{
				numSet++;
				sv |= SkillLevel_Value.Beginner_Friendly;
			}
			if (model.skillIntermediateToggle.value)
			{
				numSet++;
				sv |= SkillLevel_Value.Intermediate;
			}
			if (model.skillAdvancedToggle.value)
			{
				numSet++;
				sv |= SkillLevel_Value.Advanced;
			}
			if (model.skillExpertToggle.value)
			{
				numSet++;
				sv |= SkillLevel_Value.Expert;
			}

			if (numSet >= global::System.Enum.GetNames(typeof(SkillLevel_Value)).Length-1)
			{
				sv = SkillLevel_Value.All;
			}

			SkillLevelValue skillFilter = new SkillLevelValue(sv);

			//Distance
			int distance = CalculateDistance();
			DistanceValue distanceFilter = new DistanceValue(distance);

			//Admission
			Admission_Value admissionType = Admission_Value.All;
			if (model.priceFreeToggle.value)
				admissionType = Admission_Value.Free;
			if (model.pricePaidToggle.value)
				admissionType = Admission_Value.Fee;

			if (model.priceFreeToggle.value == model.pricePaidToggle.value)
				admissionType = Admission_Value.All;

			AdmissionValue admissionFilter = new AdmissionValue(admissionType);

			ITTFilterRequest filterRequest = new ITTFilterRequest();
			filterRequest.AddFilterValue(typeFilter);
			filterRequest.AddFilterValue(categoryFilter);
			filterRequest.AddFilterValue(audienceFilter);
			filterRequest.AddFilterValue(skillFilter);
			filterRequest.AddFilterValue(distanceFilter);
			filterRequest.AddFilterValue(admissionFilter);
			filterRequest.AddFilterValue(new MinDateValue(DateTime.Today));

			ITTGoogleAnalytics.Instance.googleAnalytics.LogEvent(new EventHitBuilder()
			                                                     .SetEventCategory("Filter - Filter Screen")
			                                                     .SetEventAction("Click - Filter Apply Button")
			                                                     .SetEventLabel("User has clicked on the apply button with the following url values: " + filterRequest.RetrieveFilterURLString()));
			filterResultsController._filterRequest = filterRequest;
			ITTMainSceneManager.Instance.currentState = ITTMainSceneManager.ITTStates.FilterResults;

		}
Esempio n. 3
0
        public void RequestCombinedActivities(Action <string> callback, Action <string> errorCallback, ITTFilterRequest filter = null)
        {
            LocationDataModel requestLocationData = RetrieveLocationData();

            if (requestLocationData == null)
            {
                requestLocationData = DefaultLocationData();
            }

            //	TODO: Add conversion to lat long call and store it here if lat long is missing
            StartCoroutine(_networkManager.RequestCombinedActivitiesDeals(requestLocationData.lastLatitude, requestLocationData.lastLongitude, filter ?? new ITTFilterRequest(), callback, errorCallback));
        }
Esempio n. 4
0
		public void Populate(List<BaseCardData> cardList)
		{
			bool hasAnyItems = false;
			bool hasItemsForToday = true;
			DateTime selectedDay = GetSelectedDay();

			hasAnyItems = cardList.Count > 0;

			if (!hasAnyItems)
			{
				if (null != OnNoCardsForSelectedDay && !_verticalMode)
					OnNoCardsForSelectedDay();
				return;
			}
			else if (DayIndex >= 0)
			{
				hasItemsForToday = cardList.Any(x => x.dateTime.Date == selectedDay.Date);
			}

			if (!hasItemsForToday)
			{
				ITTFilterRequest filter = new ITTFilterRequest();
				filter.AddFilterValue(new DistanceValue());
				filter.AddFilterValue(new MinDateValue(selectedDay));
				filter.AddFilterValue(new MaxDateValue(selectedDay));
				ITTDataCache.Instance.RequestCombinedActivities(OnRetrieveActivitiesForSelectedDaySuccess, OnRetrieveActivitiesForSelectedDayFailure, filter);
			}
			else
			{
				// Check for dupes and remove older cards for current day
				cardList.RemoveAll(x => _cardCache.Any(y => y.id == x.id));
				if (DayIndex == 0)
				{
					cardList.RemoveAll(x => x.dateTime < selectedDay);
				}
				_PopulateInternal(cardList);
			}
		}
Esempio n. 5
0
        public IEnumerator RequestCombinedActivitiesDeals(double geoLat, double geoLong, ITTFilterRequest filterRequest, Action <string> callback, Action <string> errorCallback, int limit = REQUEST_LIMIT)
        {
            string url = _GenerateURL("Activity/", geoLat, geoLong, filterRequest, limit);

            yield return(StartCoroutine(_PerformRequest <string>(url, null, callback, errorCallback)));
        }
Esempio n. 6
0
 private string _GenerateURL(string displayID, double geoLat, double geoLong, ITTFilterRequest filterRequest, int limit = REQUEST_LIMIT)
 {
     return(CHOOSE_HEALTHIER_URI + "db/" + displayID + "?sorting=event_date&query=" + filterRequest.RetrieveFilterURLString() + "&limit=" + limit);
 }