Simple Client Model for Person
Ejemplo n.º 1
0
        public static Rock.Client.PhoneNumber TryGetPhoneNumber(Rock.Client.Person person, int phoneTypeId)
        {
            Rock.Client.PhoneNumber requestedNumber = null;

            // if the user has phone numbers
            if (person.PhoneNumbers != null)
            {
                // get an enumerator
                IEnumerator <Rock.Client.PhoneNumber> enumerator = person.PhoneNumbers.GetEnumerator( );
                enumerator.MoveNext( );

                // search for the phone number type requested
                while (enumerator.Current != null)
                {
                    Rock.Client.PhoneNumber phoneNumber = enumerator.Current as Rock.Client.PhoneNumber;

                    // is this the right type?
                    if (phoneNumber.NumberTypeValueId == phoneTypeId)
                    {
                        requestedNumber = phoneNumber;
                        break;
                    }
                    enumerator.MoveNext( );
                }
            }

            return(requestedNumber);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchPage" /> class.
        /// </summary>
        /// <param name="loggedInPerson">The logged in person.</param>
        public BatchPage( Person loggedInPerson )
        {
            LoggedInPerson = loggedInPerson;
            InitializeComponent();
            ScanningPage = new ScanningPage( this );
            ScanningPromptPage = new ScanningPromptPage( this );
            BatchItemDetailPage = new BatchItemDetailPage();
            FirstPageLoad = true;

            try
            {
                var micrImageHostPage = new MicrImageHostPage();
                this.micrImage = micrImageHostPage.micrImage;
                this.micrImage.MicrDataReceived += ScanningPage.micrImage_MicrDataReceived;
            }
            catch
            {
                // intentionally nothing.  means they don't have the MagTek driver
            }

            try
            {
                var rangerScannerHostPage = new RangerScannerHostPage();
                this.rangerScanner = rangerScannerHostPage.rangerScanner;

                this.rangerScanner.TransportFeedingState += ScanningPage.rangerScanner_TransportFeedingState;
                this.rangerScanner.TransportFeedingStopped += ScanningPage.rangerScanner_TransportFeedingStopped;
                this.rangerScanner.TransportNewItem += ScanningPage.rangerScanner_TransportNewItem;
                this.rangerScanner.TransportSetItemOutput += ScanningPage.rangerScanner_TransportSetItemOutput;
                this.rangerScanner.TransportIsDead += ScanningPage.rangerScanner_TransportIsDead;
                this.rangerScanner.TransportNewState += rangerScanner_TransportNewState;
                this.rangerScanner.TransportChangeOptionsState += rangerScanner_TransportChangeOptionsState;

                // debug output only
                this.rangerScanner.TransportEnablingOptionsState += rangerScannerHostPage.rangerScanner_TransportEnablingOptionsState;
                this.rangerScanner.TransportExceptionComplete += rangerScannerHostPage.rangerScanner_TransportExceptionComplete;
                this.rangerScanner.TransportInExceptionState += rangerScannerHostPage.rangerScanner_TransportInExceptionState;

                this.rangerScanner.TransportItemInPocket += rangerScannerHostPage.rangerScanner_TransportItemInPocket;
                this.rangerScanner.TransportItemSuspended += rangerScannerHostPage.rangerScanner_TransportItemSuspended;
                this.rangerScanner.TransportOverrideOptions += rangerScannerHostPage.rangerScanner_TransportOverrideOptions;
                this.rangerScanner.TransportPassthroughEvent += rangerScannerHostPage.rangerScanner_TransportPassthroughEvent;
                this.rangerScanner.TransportReadyToFeedState += rangerScannerHostPage.rangerScanner_TransportReadyToFeedState;
                this.rangerScanner.TransportReadyToSetEndorsement += rangerScannerHostPage.rangerScanner_TransportReadyToSetEndorsement;
                this.rangerScanner.TransportShuttingDownState += rangerScannerHostPage.rangerScanner_TransportShuttingDownState;
                this.rangerScanner.TransportShutDownState += rangerScannerHostPage.rangerScanner_TransportShutDownState;
                this.rangerScanner.TransportStartingUpState += rangerScannerHostPage.rangerScanner_TransportStartingUpState;
                this.rangerScanner.TransportTrackIsClear += rangerScannerHostPage.rangerScanner_TransportTrackIsClear;
            }
            catch
            {
                // intentionally nothing.  means they don't have the Ranger driver
            }
        }
Ejemplo n.º 3
0
 public static void UpdateOrAddPhoneNumber(Rock.Client.Person person, Rock.Client.PhoneNumber phoneNumber, bool isNew, HttpRequest.RequestResult <Rock.Client.PhoneNumber> resultHandler)
 {
     // is it blank?
     if (string.IsNullOrEmpty(phoneNumber.Number) == true)
     {
         // if it's not new, we should delete an existing
         if (isNew == false)
         {
             ApplicationApi.DeleteCellPhoneNumber(phoneNumber,
                                                  delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
             {
                 if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                 {
                     // return the blank number back to them
                     resultHandler(statusCode, statusDescription, phoneNumber);
                 }
             });
         }
         // otherwise, simply ignore it and say we're done.
         else
         {
             resultHandler(System.Net.HttpStatusCode.OK, "", phoneNumber);
         }
     }
     // not blank, so we're adding or updating
     else
     {
         // send it to the server
         ApplicationApi.AddOrUpdateCellPhoneNumber(person, phoneNumber, isNew, 0,
                                                   delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
         {
             if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
             {
                 // if it was new, get it so we have its ID
                 if (isNew == true)
                 {
                     ApplicationApi.GetPhoneNumberByGuid(phoneNumber.Guid, resultHandler);
                 }
                 else
                 {
                     // it's updated, so now just return what we updated.
                     resultHandler(statusCode, statusDescription, phoneNumber);
                 }
             }
             // something went wrong, so return.
             else
             {
                 resultHandler(statusCode, statusDescription, null);
             }
         });
     }
 }
Ejemplo n.º 4
0
        public static void SetBirthday(Rock.Client.Person person, DateTime?birthday)
        {
            // update the birthdate field
            person.BirthDate = birthday;

            // and the day/month/year fields.
            if (person.BirthDate.HasValue)
            {
                person.BirthDay   = person.BirthDate.Value.Day;
                person.BirthMonth = person.BirthDate.Value.Month;
                person.BirthYear  = person.BirthDate.Value.Year;
            }
            else
            {
                person.BirthDay   = null;
                person.BirthMonth = null;
                person.BirthYear  = null;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Copies the base properties from a source Person object
 /// </summary>
 /// <param name="source">The source.</param>
 public void CopyPropertiesFrom( Person source )
 {
     this.Id = source.Id;
     this.AnniversaryDate = source.AnniversaryDate;
     this.BirthDay = source.BirthDay;
     this.BirthMonth = source.BirthMonth;
     this.BirthYear = source.BirthYear;
     this.ConnectionStatusValueId = source.ConnectionStatusValueId;
     this.Email = source.Email;
     this.EmailNote = source.EmailNote;
     this.EmailPreference = source.EmailPreference;
     this.FirstName = source.FirstName;
     this.Gender = source.Gender;
     this.GivingGroupId = source.GivingGroupId;
     this.GradeOffset = source.GradeOffset;
     this.GraduationYear = source.GraduationYear;
     this.InactiveReasonNote = source.InactiveReasonNote;
     this.IsDeceased = source.IsDeceased;
     this.IsEmailActive = source.IsEmailActive;
     this.IsSystem = source.IsSystem;
     this.LastName = source.LastName;
     this.MaritalStatusValueId = source.MaritalStatusValueId;
     this.MiddleName = source.MiddleName;
     this.NickName = source.NickName;
     this.PhotoId = source.PhotoId;
     this.RecordStatusReasonValueId = source.RecordStatusReasonValueId;
     this.RecordStatusValueId = source.RecordStatusValueId;
     this.RecordTypeValueId = source.RecordTypeValueId;
     this.ReviewReasonNote = source.ReviewReasonNote;
     this.ReviewReasonValueId = source.ReviewReasonValueId;
     this.SuffixValueId = source.SuffixValueId;
     this.SystemNote = source.SystemNote;
     this.TitleValueId = source.TitleValueId;
     this.ViewedCount = source.ViewedCount;
     this.Guid = source.Guid;
     this.ForeignId = source.ForeignId;
 }