/// <summary> /// Resets all the values related to the Person, but won't reset things like /// IsFirstRun /// </summary> void SetDefaultPersonValues( ) { Person = new Person(); PrimaryFamily = new Group(); PrimaryAddress = new GroupLocation(); PrimaryAddress.GroupLocationTypeValueId = PrivateGeneralConfig.GroupLocationTypeHomeValueId; PrimaryAddress.IsMappedLocation = true; // for the address location, default the country to the built in country code. PrimaryAddress.Location = new Rock.Client.Location(); PrimaryAddress.Location.Country = MobileApp.Shared.Config.GeneralConfig.CountryCode; _CellPhoneNumber = new PhoneNumber( ); SetPhoneNumberDigits(""); IsBaptised = false; IsERA = false; IsGiving = false; TakenStartingPoint = false; IsMember = false; IsServing = false; IsPeerLearning = false; IsMentored = false; IsTeaching = false; // Don't reset the viewing campus, because we force them to pick one at // first run, and don't want to lose their choice. //ViewingCampus = 0; }
public void GetPersonData(HttpRequest.RequestResult onResult) { MobileAppApi.GetPersonData(UserID, delegate(MobileAppApi.PersonData personData, HttpStatusCode statusCode) { if (personData != null) { // take the person (clear out the cell numbers since we manage those seperately) Person = personData.Person; Person.PhoneNumbers = null; // search for a phone number (which should match whatever we already have, unless this is a new login) if (personData.CellPhoneNumber != null) { _CellPhoneNumber = personData.CellPhoneNumber; HasCellNumber = true; } else { // no longer has a phone number, so clear it _CellPhoneNumber = new PhoneNumber( ); SetPhoneNumberDigits(""); HasCellNumber = false; } // we're always safe to take family--it cannot be null PrimaryFamily = personData.Family; // only take the address if it's valid. otherwise, we want // to use the default, empty one. if (personData.FamilyAddress != null) { PrimaryAddress = personData.FamilyAddress; } // set the person's current actions IsBaptised = personData.IsBaptised; IsERA = personData.IsERA; IsGiving = personData.IsGiving; TakenStartingPoint = personData.TakenStartingPoint; IsMember = personData.IsMember; IsServing = personData.IsServing; IsPeerLearning = personData.IsPeerLearning; IsMentored = personData.IsMentored; IsTeaching = personData.IsTeaching; // save! SaveToDevice( ); } if (onResult != null) { onResult(statusCode, ""); } }); }
public static bool IsFullAddress(Rock.Client.GroupLocation address) { // by full address, we mean street, city, state, zip if (string.IsNullOrWhiteSpace(address.Location.Street1) == false && string.IsNullOrWhiteSpace(address.Location.City) == false && string.IsNullOrWhiteSpace(address.Location.State) == false && string.IsNullOrWhiteSpace(address.Location.PostalCode) == false) { return(true); } return(false); }
public static Rock.Client.GroupLocation CreateHomeAddress( string street, string city, string state, string zip ) { // try to find the group, and if it doesn't exist, make it Rock.Client.GroupLocation homeLocation = new Rock.Client.GroupLocation(); homeLocation.GroupLocationTypeValueId = GroupLocationTypeHomeValueId; // for the address location, default the country to the built in country code. homeLocation.Location = new Rock.Client.Location(); homeLocation.Location.Country = CountryCode; // populate it homeLocation.Location.Street1 = street; homeLocation.Location.City = city; homeLocation.Location.State = state; homeLocation.Location.PostalCode = zip; // return it. return homeLocation; }
public static Rock.Client.GroupLocation CreateHomeAddress(string street, string city, string state, string zip) { // try to find the group, and if it doesn't exist, make it Rock.Client.GroupLocation homeLocation = new Rock.Client.GroupLocation(); homeLocation.GroupLocationTypeValueId = GroupLocationTypeHomeValueId; // for the address location, default the country to the built in country code. homeLocation.Location = new Rock.Client.Location(); homeLocation.Location.Country = CountryCode; // populate it homeLocation.Location.Street1 = street; homeLocation.Location.City = city; homeLocation.Location.State = state; homeLocation.Location.PostalCode = zip; // return it. return(homeLocation); }
/// <summary> /// Copies the base properties from a source GroupLocation object /// </summary> /// <param name="source">The source.</param> public void CopyPropertiesFrom(GroupLocation source) { this.Id = source.Id; this.ForeignGuid = source.ForeignGuid; this.ForeignKey = source.ForeignKey; this.GroupId = source.GroupId; this.GroupLocationTypeValueId = source.GroupLocationTypeValueId; this.GroupMemberPersonAliasId = source.GroupMemberPersonAliasId; this.IsMailingLocation = source.IsMailingLocation; this.IsMappedLocation = source.IsMappedLocation; this.LocationId = source.LocationId; this.ModifiedAuditValuesAlreadyUpdated = source.ModifiedAuditValuesAlreadyUpdated; this.CreatedDateTime = source.CreatedDateTime; this.ModifiedDateTime = source.ModifiedDateTime; this.CreatedByPersonAliasId = source.CreatedByPersonAliasId; this.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; this.Guid = source.Guid; this.ForeignId = source.ForeignId; }
/// <summary> /// Copies the base properties from a source GroupLocation object /// </summary> /// <param name="source">The source.</param> public void CopyPropertiesFrom( GroupLocation source ) { this.Id = source.Id; this.ForeignGuid = source.ForeignGuid; this.ForeignKey = source.ForeignKey; this.GroupId = source.GroupId; this.GroupLocationTypeValueId = source.GroupLocationTypeValueId; this.GroupMemberPersonAliasId = source.GroupMemberPersonAliasId; this.IsMailingLocation = source.IsMailingLocation; this.IsMappedLocation = source.IsMappedLocation; this.LocationId = source.LocationId; this.ModifiedAuditValuesAlreadyUpdated = source.ModifiedAuditValuesAlreadyUpdated; this.Order = source.Order; this.CreatedDateTime = source.CreatedDateTime; this.ModifiedDateTime = source.ModifiedDateTime; this.CreatedByPersonAliasId = source.CreatedByPersonAliasId; this.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; this.Guid = source.Guid; this.ForeignId = source.ForeignId; }
public void GetFamilyAndAddress( HttpRequest.RequestResult addressResult ) { MobileAppApi.GetFamilyAndAddress( Person, delegate(System.Net.HttpStatusCode statusCode, string statusDescription, Group family, GroupLocation familyAddress ) { if( Rock.Mobile.Network.Util.StatusInSuccessRange( statusCode ) == true ) { // only take valid values if( family != null ) { PrimaryFamily = family; } if( familyAddress != null ) { PrimaryAddress = familyAddress; } LastSyncdAddressJson = JsonConvert.SerializeObject( PrimaryAddress ); LastSyncdFamilyJson = JsonConvert.SerializeObject( PrimaryFamily ); // save! SaveToDevice( ); } if( addressResult != null ) { addressResult( statusCode, statusDescription ); } } ); }
/// <summary> /// Resets all the values related to the Person, but won't reset things like /// IsFirstRun /// </summary> void SetDefaultPersonValues( ) { Person = new Person(); PrimaryFamily = new Group(); PrimaryAddress = new GroupLocation(); PrimaryAddress.GroupLocationTypeValueId = PrivateGeneralConfig.GroupLocationTypeHomeValueId; //_CellPhoneNumber = null; _CellPhoneNumber = new PhoneNumber( ); SetPhoneNumberDigits( "" ); ViewingCampus = RockGeneralData.Instance.Data.Campuses[ 0 ].Id; // for the address location, default the country to the built in country code. PrimaryAddress.Location = new Location(); PrimaryAddress.Location.Country = App.Shared.Config.GeneralConfig.CountryCode; LastSyncdPersonJson = JsonConvert.SerializeObject( Person ); LastSyncdFamilyJson = JsonConvert.SerializeObject( PrimaryFamily ); LastSyncdAddressJson = JsonConvert.SerializeObject( PrimaryAddress ); LastSyncdCellPhoneNumberJson = JsonConvert.SerializeObject( _CellPhoneNumber ); }