public async Task<WebServiceRequestStatus> PostRequest()
		{
			WebServiceRequestStatus status = WebServiceRequestStatus.SUCCESS;

			if (this.isRequestDataValid())
			{
				WebService ws = new WebService();
				string jsonString = JsonConvert.SerializeObject(request);
				System.Diagnostics.Debug.WriteLine(jsonString);
				this.request.requestJSON = jsonString;
				string responseStr = await ws.PostData(Utils.GetDeviceServicesURL() + METHOD_NAME, jsonString);
				System.Diagnostics.Debug.WriteLine(responseStr);
				this.response.responseJSON = responseStr;
				this.response = JsonConvert.DeserializeObject<ActivateDeviceWithMemberResponse>(responseStr, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

				if(string.Equals("Member & Device is already active.",this.response.ResponseMessage))
				   status = WebServiceRequestStatus.ERROR_REQUEST_DATA_INVALID;
			}
			else
			{
				status = WebServiceRequestStatus.ERROR_REQUEST_DATA_INVALID;
			}
			return status;
		}
Exemplo n.º 2
0
		private void SetSettingsFromActivateDeviceWithMemberResponseWS(ActivateDeviceWithMemberResponse WSActivateDeviceWithMemberResponseInstance)
		{
			//UserInfo
			UserInformationInstance.MemberDeviceId = WSActivateDeviceWithMemberResponseInstance.MemberDeviceID;


			// Device Data Settings
			DeviceDataInstance = new DeviceData();
			DeviceDataInstance.AdvertiseMode = WSActivateDeviceWithMemberResponseInstance.AdvertiseMode;
			DeviceDataInstance.TrackerSensitivity = WSActivateDeviceWithMemberResponseInstance.TrackerSensitivity;
			this.ScreenFlowList = WSActivateDeviceWithMemberResponseInstance.ScreenFlow;

			//User Settings
			UserSettingsInstance.Stride = WSActivateDeviceWithMemberResponseInstance.userSettings.Stride;
			UserSettingsInstance.Weight = WSActivateDeviceWithMemberResponseInstance.userSettings.Weight;
			UserSettingsInstance.RestMetabolicRate = WSActivateDeviceWithMemberResponseInstance.userSettings.RestMetabolicRate;
			UserSettingsInstance.UnitOfMeasure = WSActivateDeviceWithMemberResponseInstance.userSettings.UnitOfMeasure;
			UserSettingsInstance.DOBYear = WSActivateDeviceWithMemberResponseInstance.userSettings.DOBYear;
			UserSettingsInstance.DOBMonth = WSActivateDeviceWithMemberResponseInstance.userSettings.DOBMonth;
			UserSettingsInstance.DOBDay = WSActivateDeviceWithMemberResponseInstance.userSettings.DOBDay;
			UserSettingsInstance.Age = WSActivateDeviceWithMemberResponseInstance.userSettings.Age;

			// Device Settings
			string serverTime = WSActivateDeviceWithMemberResponseInstance.ServerDateTime;
			bool timeFormat = WSActivateDeviceWithMemberResponseInstance.DeviceTimeFormat;

			DateTime st = Motion.Mobile.Utilities.Utils.GetServerDateTimeFromString(serverTime);

			// 
			this.timeDiff = WSActivateDeviceWithMemberResponseInstance.AllowableTimeDifference;


			Debug.WriteLine("Date Time" + st);
			DeviceSettingsInstance.Year = st.Year - 2000;
			DeviceSettingsInstance.Month = st.Month;
			DeviceSettingsInstance.Day = st.Day;
			DeviceSettingsInstance.Hour = st.Hour;
			DeviceSettingsInstance.Minute = st.Minute;
			DeviceSettingsInstance.Second = st.Second;
			DeviceSettingsInstance.HourType = timeFormat;

			this.clearTracker = WSActivateDeviceWithMemberResponseInstance.ClearTrackerDataFlag;


			MemberServerProfileInstance = new MemberServerProfile();
			MemberServerProfileInstance.MemberDeviceID = WSActivateDeviceWithMemberResponseInstance.MemberDeviceID;
			MemberServerProfileInstance.UpdateFlag = (int)WSActivateDeviceWithMemberResponseInstance.UpdateFlag;
			MemberServerProfileInstance.UpdateFlagChanges = (int)WSActivateDeviceWithMemberResponseInstance.UpdateFlag;
			MemberServerProfileInstance.SynchronizationID = WSActivateDeviceWithMemberResponseInstance.SynchronizationID;
			MemberServerProfileInstance.ServerDateTime = WSActivateDeviceWithMemberResponseInstance.ServerDateTime;

			//Company Settings
			CompanySettingsInstance.TenacitySteps = WSActivateDeviceWithMemberResponseInstance.companySettings.TenacitySteps;
			CompanySettingsInstance.IntensitySteps = WSActivateDeviceWithMemberResponseInstance.companySettings.IntensitySteps;
			CompanySettingsInstance.IntensityTime = WSActivateDeviceWithMemberResponseInstance.companySettings.IntensityTime;
			CompanySettingsInstance.IntensityMinuteThreshold = WSActivateDeviceWithMemberResponseInstance.companySettings.IntensityMinuteThreshold;
			CompanySettingsInstance.IntensityRestMinuteAllowed = WSActivateDeviceWithMemberResponseInstance.companySettings.IntensityRestMinuteAllowed;
			CompanySettingsInstance.IntensityCycle = WSActivateDeviceWithMemberResponseInstance.companySettings.IntensityCycle;
			CompanySettingsInstance.FrequencySteps = WSActivateDeviceWithMemberResponseInstance.companySettings.FrequencySteps;
			CompanySettingsInstance.FrequencyCycleTime = WSActivateDeviceWithMemberResponseInstance.companySettings.FrequencyCycleTime;
			CompanySettingsInstance.FrequencyCycle = WSActivateDeviceWithMemberResponseInstance.companySettings.FrequencyCycle;
			CompanySettingsInstance.FrequencyCycleInterval = WSActivateDeviceWithMemberResponseInstance.companySettings.FrequencyCycleInterval;


			//Exercise Settings
			ExerciseSettingsInstance.SyncTimeInterval = WSActivateDeviceWithMemberResponseInstance.exerciseSettings.SyncTimeInterval;
			ExerciseSettingsInstance.DataSyncEnable = WSActivateDeviceWithMemberResponseInstance.exerciseSettings.DataSyncEnable;
			ExerciseSettingsInstance.FrequencyAlarmEnable = WSActivateDeviceWithMemberResponseInstance.exerciseSettings.FrequencyAlarmEnable;

			//Signature Settings
			SignatureSettingsInstance.SamplingFrequency = WSActivateDeviceWithMemberResponseInstance.signatureSettings.SamplingFrequency;
			SignatureSettingsInstance.SamplingTime = WSActivateDeviceWithMemberResponseInstance.signatureSettings.SamplingTime;
			SignatureSettingsInstance.SamplingCycle = WSActivateDeviceWithMemberResponseInstance.signatureSettings.SamplingCycle;
			SignatureSettingsInstance.SamplingThreshold = WSActivateDeviceWithMemberResponseInstance.signatureSettings.SamplingThreshold;
			SignatureSettingsInstance.SamplingTotalBlocks = WSActivateDeviceWithMemberResponseInstance.signatureSettings.SamplingTotalBlocks;

			//Seizure Settings
			SeizureSettingsInstance.SeizureSettingsEnable = WSActivateDeviceWithMemberResponseInstance.seizureSettings.SeizureSettingsEnable;
			SeizureSettingsInstance.SeizureSamplingFrequency = WSActivateDeviceWithMemberResponseInstance.seizureSettings.SeizureSamplingFrequency;
			SeizureSettingsInstance.SeizureNumberOfRecords = WSActivateDeviceWithMemberResponseInstance.seizureSettings.SeizureNumberOfRecords;
			SeizureSettingsInstance.SeizureSamplingTime = WSActivateDeviceWithMemberResponseInstance.seizureSettings.SeizureSamplingTime;

		}