public bool GetObjectNeedsUpate(ServiceInstance checkUpdateFrom) { if (!StartDate.Equals(checkUpdateFrom.StartDate)) { return(true); } if (!EndDate.Equals(checkUpdateFrom.EndDate)) { return(true); } if (!Hours.Equals(checkUpdateFrom.Hours)) { return(true); } if (!Notes.Equals(checkUpdateFrom.Notes)) { return(true); } if (!Service.Equals(checkUpdateFrom.Service)) { return(true); } if (!ExternalParentId.Equals(checkUpdateFrom.ExternalParentId)) { return(true); } return(false); }
public string GenerateUpdateJsonFromObject(ServiceInstance updateFrom) { // form the json (determine the fields that need to be updated) var sb = new StringBuilder(); var sw = new StringWriter(sb); var writer = new JsonTextWriter(sw) { Formatting = Formatting.None }; writer.WriteStartObject(); writer.WritePropertyName(@"person"); writer.WriteStartObject(); if (!StartDate.Equals(updateFrom.StartDate)) { writer.WritePropertyName("start_date"); writer.WriteValue(updateFrom.StartDate); } if (!EndDate.Equals(updateFrom.EndDate)) { writer.WritePropertyName("end_date"); writer.WriteValue(updateFrom.EndDate); } if (!Hours.Equals(updateFrom.Hours)) { writer.WritePropertyName("hours"); writer.WriteValue(updateFrom.Hours); } if (!Notes.Equals(updateFrom.Notes)) { writer.WritePropertyName("notes"); writer.WriteValue(updateFrom.Notes); } if (!Service.Equals(updateFrom.Service)) { writer.WritePropertyName("service_id"); writer.WriteValue(updateFrom.Service.ExternalId); } if (!ExternalParentId.Equals(updateFrom.ExternalParentId)) { writer.WritePropertyName("person_id"); writer.WriteValue(updateFrom.ExternalParentId); } writer.WriteEndObject(); writer.WriteEndObject(); return(sw.ToString()); }
public bool GetObjectNeedsUpate(CustomHouseholdValue checkUpdateFrom) { if (!Value.Equals(checkUpdateFrom.Value)) { return(true); } if (!ExternalCustomFieldId.Equals(checkUpdateFrom.ExternalParentId)) { return(true); } if (!ExternalParentId.Equals(checkUpdateFrom.ExternalCustomFieldId)) { return(true); } return(false); }
public bool GetObjectNeedsUpate(ServiceType checkUpdateFrom) { if (!Name.Equals(checkUpdateFrom.Name)) { return(true); } if (!Definition.Equals(checkUpdateFrom.Definition)) { return(true); } if (!ExternalParentId.Equals(checkUpdateFrom.ExternalParentId)) { return(true); } return(false); }
public string GenerateUpdateJsonFromObject(CustomHouseholdValue updateFrom) { // form the json (determine the fields that need to be updated) var sb = new StringBuilder(); var sw = new StringWriter(sb); var writer = new JsonTextWriter(sw) { Formatting = Formatting.None }; writer.WriteStartObject(); writer.WritePropertyName(@"custom_value"); writer.WriteStartObject(); if (!Value.Equals(updateFrom.Value)) { writer.WritePropertyName("name"); writer.WriteValue(updateFrom.Value ?? @""); } if (!ExternalCustomFieldId.Equals(updateFrom.ExternalCustomFieldId)) { writer.WritePropertyName("custom_field_id"); writer.WriteValue(updateFrom.ExternalCustomFieldId ?? null); } if (!ExternalParentId.Equals(updateFrom.ExternalParentId)) { writer.WritePropertyName("model_id"); writer.WriteValue(updateFrom.ExternalParentId ?? null); } writer.WriteEndObject(); writer.WriteEndObject(); return(sw.ToString()); }
public string GenerateUpdateJsonFromObject(PersonFollowUp updateFrom) { // form the json (determine the fields that need to be updated) var sb = new StringBuilder(); var sw = new StringWriter(sb); var writer = new JsonTextWriter(sw) { Formatting = Formatting.None }; writer.WriteStartObject(); writer.WritePropertyName(@"follow_up"); writer.WriteStartObject(); if (!FollowUpDate.Equals(updateFrom.FollowUpDate)) { writer.WritePropertyName("follow_date"); writer.WriteValue(updateFrom.FollowUpDate); } if (!HaveJobReturningTo.Equals(updateFrom.HaveJobReturningTo)) { writer.WritePropertyName("have_job_returning_to"); writer.WriteValue(updateFrom.HaveJobReturningTo); } if (!HoursWorked.Equals(updateFrom.HoursWorked)) { writer.WritePropertyName("hours_worked"); writer.WriteValue(updateFrom.HoursWorked); } if (!HouseWorkedOnHousework.Equals(updateFrom.HouseWorkedOnHousework)) { writer.WritePropertyName("hours_worked_on_housework"); writer.WriteValue(updateFrom.HouseWorkedOnHousework); } if (!EnrolledInSchool.Equals(updateFrom.EnrolledInSchool)) { writer.WritePropertyName("enrolled_in_school"); writer.WriteValue(updateFrom.EnrolledInSchool); } if (!GpsLatitude.Equals(updateFrom.GpsLatitude)) { writer.WritePropertyName("latitude"); writer.WriteValue(updateFrom.GpsLatitude); } if (!GpsLongitude.Equals(updateFrom.GpsLongitude)) { writer.WritePropertyName("longitude"); writer.WriteValue(updateFrom.GpsLongitude); } if (!GpsPositionAccuracy.Equals(updateFrom.GpsPositionAccuracy)) { writer.WritePropertyName("position_accuracy"); writer.WriteValue(updateFrom.GpsPositionAccuracy); } if (!GpsAltitude.Equals(updateFrom.GpsAltitude)) { writer.WritePropertyName("altitude"); writer.WriteValue(updateFrom.GpsAltitude); } if (!GpsAltitudeAccuracy.Equals(updateFrom.GpsAltitudeAccuracy)) { writer.WritePropertyName("altitude_accuracy"); writer.WriteValue(updateFrom.GpsAltitudeAccuracy); } if (!GpsHeading.Equals(updateFrom.GpsHeading)) { writer.WritePropertyName("heading"); writer.WriteValue(updateFrom.GpsHeading); } if (!GpsSpeed.Equals(updateFrom.GpsSpeed)) { writer.WritePropertyName("speed"); writer.WriteValue(updateFrom.GpsSpeed); } if (!GpsPositionTime.Equals(updateFrom.GpsPositionTime)) { writer.WritePropertyName("gps_recorded_at"); writer.WriteValue(updateFrom.GpsPositionTime); } if (!PeopleFollowUpHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(updateFrom.PeopleFollowUpHazardousConditions.Select(a => a.HazardousCondition))) { writer.WritePropertyName("hazardous_condition_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleFollowUpHazardousConditions.Select(a => a.HazardousCondition))); } if (!PeopleFollowUpWorkActivities.Select(a => a.WorkActivity).SequenceEqual(updateFrom.PeopleFollowUpWorkActivities.Select(a => a.WorkActivity))) { writer.WritePropertyName("work_activity_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleFollowUpWorkActivities.Select(a => a.WorkActivity))); } if (!PeopleFollowUpHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(updateFrom.PeopleFollowUpHouseholdTasks.Select(a => a.HouseholdTask))) { writer.WritePropertyName("household_task_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleFollowUpHouseholdTasks.Select(a => a.HouseholdTask))); } if (!ExternalParentId.Equals(updateFrom.ExternalParentId)) { writer.WritePropertyName("person_id"); writer.WriteValue(updateFrom.ExternalParentId); } writer.WriteEndObject(); writer.WriteEndObject(); return(sw.ToString()); }
public bool GetObjectNeedsUpate(PersonFollowUp checkUpdateFrom) { if (!FollowUpDate.Equals(checkUpdateFrom.FollowUpDate)) { return(true); } if (!HaveJobReturningTo.Equals(checkUpdateFrom.HaveJobReturningTo)) { return(true); } if (!HoursWorked.Equals(checkUpdateFrom.HoursWorked)) { return(true); } if (!HouseWorkedOnHousework.Equals(checkUpdateFrom.HouseWorkedOnHousework)) { return(true); } if (!EnrolledInSchool.Equals(checkUpdateFrom.EnrolledInSchool)) { return(true); } if (!GpsLatitude.Equals(checkUpdateFrom.GpsLatitude)) { return(true); } if (!GpsLongitude.Equals(checkUpdateFrom.GpsLongitude)) { return(true); } if (!GpsPositionAccuracy.Equals(checkUpdateFrom.GpsPositionAccuracy)) { return(true); } if (!GpsAltitude.Equals(checkUpdateFrom.GpsAltitude)) { return(true); } if (!GpsAltitudeAccuracy.Equals(checkUpdateFrom.GpsAltitudeAccuracy)) { return(true); } if (!GpsHeading.Equals(checkUpdateFrom.GpsHeading)) { return(true); } if (!GpsSpeed.Equals(checkUpdateFrom.GpsSpeed)) { return(true); } if (!GpsPositionTime.Equals(checkUpdateFrom.GpsPositionTime)) { return(true); } if (!PeopleFollowUpHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(checkUpdateFrom.PeopleFollowUpHazardousConditions.Select(a => a.HazardousCondition))) { return(true); } if (!PeopleFollowUpWorkActivities.Select(a => a.WorkActivity).SequenceEqual(checkUpdateFrom.PeopleFollowUpWorkActivities.Select(a => a.WorkActivity))) { return(true); } if (!PeopleFollowUpHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(checkUpdateFrom.PeopleFollowUpHouseholdTasks.Select(a => a.HouseholdTask))) { return(true); } if (!ExternalParentId.Equals(checkUpdateFrom.ExternalParentId)) { return(true); } return(false); }
public string GenerateUpdateJsonFromObject(Person updateFrom) { // form the json (determine the fields that need to be updated) var sb = new StringBuilder(); var sw = new StringWriter(sb); var writer = new JsonTextWriter(sw) { Formatting = Formatting.None }; writer.WriteStartObject(); writer.WritePropertyName(@"person"); writer.WriteStartObject(); if (!LastName.Equals(updateFrom.LastName)) { writer.WritePropertyName("last_name"); writer.WriteValue(updateFrom.LastName); } if (!FirstName.Equals(updateFrom.FirstName)) { writer.WritePropertyName("first_name"); writer.WriteValue(updateFrom.FirstName); } if (!MiddleName.Equals(updateFrom.MiddleName)) { writer.WritePropertyName("middle_name"); writer.WriteValue(updateFrom.MiddleName); } if (!Gender.Equals(updateFrom.Gender)) { writer.WritePropertyName("sex"); writer.WriteValue(updateFrom.Gender); } if (!DateOfBirth.Equals(updateFrom.DateOfBirth)) { writer.WritePropertyName("dob"); writer.WriteValue(updateFrom.DateOfBirth); } if (!DateOfBirthIsApproximate.Equals(updateFrom.DateOfBirthIsApproximate)) { writer.WritePropertyName("is_birthdate_approximate"); writer.WriteValue(updateFrom.DateOfBirthIsApproximate); } if (!RelationshipToHeadOfHousehold.Equals(updateFrom.RelationshipToHeadOfHousehold)) { writer.WritePropertyName("relationship_id"); writer.WriteValue(updateFrom.RelationshipToHeadOfHousehold.ExternalId); } if (!RelationshipIfOther.Equals(updateFrom.RelationshipIfOther)) { writer.WritePropertyName("relationship_other"); writer.WriteValue(updateFrom.RelationshipIfOther); } if (!IntakeDate.Equals(updateFrom.IntakeDate)) { writer.WritePropertyName("intake_date"); writer.WriteValue(updateFrom.IntakeDate); } if (!HaveJobReturningTo.Equals(updateFrom.HaveJobReturningTo)) { writer.WritePropertyName("have_job_returning_to"); writer.WriteValue(updateFrom.HaveJobReturningTo); } if (!HoursWorked.Equals(updateFrom.HoursWorked)) { writer.WritePropertyName("hours_worked"); writer.WriteValue(updateFrom.HoursWorked); } if (!HouseWorkedOnHousework.Equals(updateFrom.HouseWorkedOnHousework)) { writer.WritePropertyName("hours_worked_on_housework"); writer.WriteValue(updateFrom.HouseWorkedOnHousework); } if (!EnrolledInSchool.Equals(updateFrom.EnrolledInSchool)) { writer.WritePropertyName("enrolled_in_school"); writer.WriteValue(updateFrom.EnrolledInSchool); } if (!GpsLatitude.Equals(updateFrom.GpsLatitude)) { writer.WritePropertyName("latitude"); writer.WriteValue(updateFrom.GpsLatitude); } if (!GpsLongitude.Equals(updateFrom.GpsLongitude)) { writer.WritePropertyName("longitude"); writer.WriteValue(updateFrom.GpsLongitude); } if (!GpsPositionAccuracy.Equals(updateFrom.GpsPositionAccuracy)) { writer.WritePropertyName("position_accuracy"); writer.WriteValue(updateFrom.GpsPositionAccuracy); } if (!GpsAltitude.Equals(updateFrom.GpsAltitude)) { writer.WritePropertyName("altitude"); writer.WriteValue(updateFrom.GpsAltitude); } if (!GpsAltitudeAccuracy.Equals(updateFrom.GpsAltitudeAccuracy)) { writer.WritePropertyName("altitude_accuracy"); writer.WriteValue(updateFrom.GpsAltitudeAccuracy); } if (!GpsHeading.Equals(updateFrom.GpsHeading)) { writer.WritePropertyName("heading"); writer.WriteValue(updateFrom.GpsHeading); } if (!GpsSpeed.Equals(updateFrom.GpsSpeed)) { writer.WritePropertyName("speed"); writer.WriteValue(updateFrom.GpsSpeed); } if (!GpsPositionTime.Equals(updateFrom.GpsPositionTime)) { writer.WritePropertyName("gps_recorded_at"); writer.WriteValue(updateFrom.GpsPositionTime); } if (!PeopleHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(updateFrom.PeopleHazardousConditions.Select(a => a.HazardousCondition))) { writer.WritePropertyName("hazardous_condition_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleHazardousConditions.Select(a => a.HazardousCondition))); } if (!PeopleWorkActivities.Select(a => a.WorkActivity).SequenceEqual(updateFrom.PeopleWorkActivities.Select(a => a.WorkActivity))) { writer.WritePropertyName("work_activity_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleWorkActivities.Select(a => a.WorkActivity))); } if (!PeopleHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(updateFrom.PeopleHouseholdTasks.Select(a => a.HouseholdTask))) { writer.WritePropertyName("household_task_ids"); writer.WriteRawValue(GetStatusArrayAsJsonString(PeopleHouseholdTasks.Select(a => a.HouseholdTask))); } if (!ExternalParentId.Equals(updateFrom.ExternalParentId)) { writer.WritePropertyName("household_id"); writer.WriteValue(updateFrom.ExternalParentId); } writer.WriteEndObject(); writer.WriteEndObject(); return(sw.ToString()); }
public bool GetObjectNeedsUpate(Person checkUpdateFrom) { if (!LastName.Equals(checkUpdateFrom.LastName)) { return(true); } if (!FirstName.Equals(checkUpdateFrom.FirstName)) { return(true); } if (!MiddleName.Equals(checkUpdateFrom.MiddleName)) { return(true); } if (!Gender.Equals(checkUpdateFrom.Gender)) { return(true); } if (!DateOfBirth.Equals(checkUpdateFrom.DateOfBirth)) { return(true); } if (!DateOfBirthIsApproximate.Equals(checkUpdateFrom.DateOfBirthIsApproximate)) { return(true); } if (!RelationshipToHeadOfHousehold.Equals(checkUpdateFrom.RelationshipToHeadOfHousehold)) { return(true); } if (!RelationshipIfOther.Equals(checkUpdateFrom.RelationshipIfOther)) { return(true); } if (!IntakeDate.Equals(checkUpdateFrom.IntakeDate)) { return(true); } if (!HaveJobReturningTo.Equals(checkUpdateFrom.HaveJobReturningTo)) { return(true); } if (!HoursWorked.Equals(checkUpdateFrom.HoursWorked)) { return(true); } if (!HouseWorkedOnHousework.Equals(checkUpdateFrom.HouseWorkedOnHousework)) { return(true); } if (!EnrolledInSchool.Equals(checkUpdateFrom.EnrolledInSchool)) { return(true); } if (!GpsLatitude.Equals(checkUpdateFrom.GpsLatitude)) { return(true); } if (!GpsLongitude.Equals(checkUpdateFrom.GpsLongitude)) { return(true); } if (!GpsPositionAccuracy.Equals(checkUpdateFrom.GpsPositionAccuracy)) { return(true); } if (!GpsAltitude.Equals(checkUpdateFrom.GpsAltitude)) { return(true); } if (!GpsAltitudeAccuracy.Equals(checkUpdateFrom.GpsAltitudeAccuracy)) { return(true); } if (!GpsHeading.Equals(checkUpdateFrom.GpsHeading)) { return(true); } if (!GpsSpeed.Equals(checkUpdateFrom.GpsSpeed)) { return(true); } if (!GpsPositionTime.Equals(checkUpdateFrom.GpsPositionTime)) { return(true); } if (!PeopleHazardousConditions.Select(a => a.HazardousCondition).SequenceEqual(checkUpdateFrom.PeopleHazardousConditions.Select(a => a.HazardousCondition))) { return(true); } if (!PeopleWorkActivities.Select(a => a.WorkActivity).SequenceEqual(checkUpdateFrom.PeopleWorkActivities.Select(a => a.WorkActivity))) { return(true); } if (!PeopleHouseholdTasks.Select(a => a.HouseholdTask).SequenceEqual(checkUpdateFrom.PeopleHouseholdTasks.Select(a => a.HouseholdTask))) { return(true); } if (!ExternalParentId.Equals(checkUpdateFrom.ExternalParentId)) { return(true); } return(false); }