Simple Client Model for Group
Ejemplo n.º 1
0
                /// <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;
                }
Ejemplo n.º 2
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, "");
                        }
                    });
                }
Ejemplo n.º 3
0
        public static Rock.Client.GroupLocation GetFamilyHomeAddress(Rock.Client.Group family)
        {
            // look at each location within the family
            foreach (Rock.Client.GroupLocation groupLocation in family.GroupLocations)
            {
                // find their "Home Location" within the family group type.
                if (groupLocation.GroupLocationTypeValue.Guid.ToString( ).ToLower( ) == Rock.Client.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME.ToLower( ))
                {
                    return(groupLocation);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Copies the base properties from a source Group object
 /// </summary>
 /// <param name="source">The source.</param>
 public void CopyPropertiesFrom( Group source )
 {
     this.Id = source.Id;
     this.AddUserAccountsDuringSync = source.AddUserAccountsDuringSync;
     this.AllowGuests = source.AllowGuests;
     this.CampusId = source.CampusId;
     this.Description = source.Description;
     this.ExitSystemEmailId = source.ExitSystemEmailId;
     this.ForeignGuid = source.ForeignGuid;
     this.ForeignKey = source.ForeignKey;
     this.GroupCapacity = source.GroupCapacity;
     this.GroupTypeId = source.GroupTypeId;
     this.IsActive = source.IsActive;
     this.IsPublic = source.IsPublic;
     this.IsSecurityRole = source.IsSecurityRole;
     this.IsSystem = source.IsSystem;
     this.ModifiedAuditValuesAlreadyUpdated = source.ModifiedAuditValuesAlreadyUpdated;
     this.MustMeetRequirementsToAddMember = source.MustMeetRequirementsToAddMember;
     this.Name = source.Name;
     this.Order = source.Order;
     this.ParentGroupId = source.ParentGroupId;
     this.RequiredSignatureDocumentTemplateId = source.RequiredSignatureDocumentTemplateId;
     this.ScheduleId = source.ScheduleId;
     this.SyncDataViewId = source.SyncDataViewId;
     this.WelcomeSystemEmailId = source.WelcomeSystemEmailId;
     this.CreatedDateTime = source.CreatedDateTime;
     this.ModifiedDateTime = source.ModifiedDateTime;
     this.CreatedByPersonAliasId = source.CreatedByPersonAliasId;
     this.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId;
     this.Guid = source.Guid;
     this.ForeignId = source.ForeignId;
 }
Ejemplo n.º 5
0
                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 );
                            }
                        } );
                }
Ejemplo n.º 6
0
                /// <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 );
                }