예제 #1
0
        public static void UpdateFullPerson(bool isNewPerson,
                                            Rock.Client.Person person,
                                            bool isNewPhoneNumber,
                                            Rock.Client.PhoneNumber phoneNumber,
                                            List <KeyValuePair <string, string> > attributes,
                                            MemoryStream personImage,
                                            HttpRequest.RequestResult resultHandler)
        {
            // first, we need to resolve their graduation year (if they have a valid grade offset set)
            if (person.GradeOffset.HasValue && person.GradeOffset.Value >= 0)
            {
                RockApi.Get_People_GraduationYear(person.GradeOffset.Value,
                                                  delegate(HttpStatusCode statusCode, string statusDescription, int graduationYear)
                {
                    // now set that and update the person
                    if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                    {
                        person.GraduationYear = graduationYear;

                        TryUpdatePerson(isNewPerson, person, isNewPhoneNumber, phoneNumber, attributes, personImage, resultHandler);
                    }
                    else
                    {
                        // error
                        resultHandler(statusCode, statusDescription);
                    }
                });
            }
            else
            {
                TryUpdatePerson(isNewPerson, person, isNewPhoneNumber, phoneNumber, attributes, personImage, resultHandler);
            }
        }