当前位置: 首页>>代码示例>>C#>>正文


C# PersonService.GetPhoneNumber方法代码示例

本文整理汇总了C#中Rock.Model.PersonService.GetPhoneNumber方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.GetPhoneNumber方法的具体用法?C# PersonService.GetPhoneNumber怎么用?C# PersonService.GetPhoneNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rock.Model.PersonService的用法示例。


在下文中一共展示了PersonService.GetPhoneNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowPersonal

        private void ShowPersonal( Person person )
        {
            if ( person != null )
            {
                txtCurrentName.Text = person.FullName;
                txtEmail.Text = person.Email;

                var rockContext = new RockContext();
                var personService = new PersonService( rockContext );

                if ( GetAttributeValue( "DisplayPhone" ).AsBoolean() )
                {
                    var phoneNumber = personService.GetPhoneNumber( person, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );

                    // If person did not have a home phone number, read the cell phone number (which would then
                    // get saved as a home number also if they don't change it, which is ok ).
                    if ( phoneNumber == null || string.IsNullOrWhiteSpace( phoneNumber.Number ) )
                    {
                        phoneNumber = personService.GetPhoneNumber( person, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE ) ) );
                    }

                    if ( phoneNumber != null )
                    {
                        pnbPhone.CountryCode = phoneNumber.CountryCode;
                        pnbPhone.Number = phoneNumber.ToString();
                    }
                    else
                    {
                        pnbPhone.CountryCode = PhoneNumber.DefaultCountryCode();
                        pnbPhone.Number = string.Empty;
                    }
                }
                Guid addressTypeGuid = Guid.Empty;
                if ( !Guid.TryParse( GetAttributeValue( "AddressType" ), out addressTypeGuid ) )
                {
                    addressTypeGuid = new Guid( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME );
                }

                var groupLocation = personService.GetFirstLocation( person.Id, DefinedValueCache.Read( addressTypeGuid ).Id );
                if ( groupLocation != null )
                {
                    GroupLocationId = groupLocation.Id;
                    acAddress.SetValues( groupLocation.Location );
                }
                else
                {
                    acAddress.SetValues( null );
                }
            }
            else
            {
                txtLastName.Text = string.Empty;
                txtFirstName.Text = string.Empty;
                txtEmail.Text = string.Empty;
                pnbPhone.CountryCode = PhoneNumber.DefaultCountryCode();
                pnbPhone.Number = string.Empty;
                acAddress.SetValues( null );
            }
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:59,代码来源:TransactionEntry.ascx.cs

示例2: SetControlOptions

        private void SetControlOptions()
        {
            FluidLayout = GetAttributeValue( "LayoutStyle" ) == "Fluid";

            // Set page/panel titles
            lPanelTitle1.Text = GetAttributeValue( "PanelTitle" );
            lPanelTitle2.Text = GetAttributeValue( "PanelTitle" );
            lContributionInfoTitle.Text = GetAttributeValue( "ContributionInfoTitle" );
            lPersonalInfoTitle.Text = GetAttributeValue( "PersonalInfoTitle" );
            lPaymentInfoTitle.Text = GetAttributeValue( "PaymentInfoTitle" );
            lConfirmationTitle.Text = GetAttributeValue( "ConfirmationTitle" );
            lSuccessTitle.Text = GetAttributeValue( "SuccessTitle" );
            lSaveAcccountTitle.Text = GetAttributeValue( "SaveAccountTitle" );

            btnAddAccount.Title = GetAttributeValue( "AddAccountText" );

            divRepeatingPayments.Visible = btnFrequency.Items.Count > 0;

            bool displayEmail = GetAttributeValue( "DisplayEmail" ).AsBoolean();
            txtEmail.Visible = displayEmail;
            tdEmailConfirm.Visible = displayEmail;
            tdEmailReceipt.Visible = displayEmail;

            bool displayPhone = GetAttributeValue( "DisplayPhone" ).AsBoolean();
            pnbPhone.Visible = displayPhone;
            tdPhoneConfirm.Visible = displayPhone;
            tdPhoneReceipt.Visible = displayPhone;

            var person = GetPerson( false );
            if ( person != null )
            {
                txtCurrentName.Text = person.FullName;
                txtEmail.Text = person.Email;

                var rockContext = new RockContext();
                var personService = new PersonService( rockContext );

                if ( displayPhone )
                {
                    var phoneNumber = personService.GetPhoneNumber( person, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );

                    // If person did not have a home phone number, read the cell phone number (which would then
                    // get saved as a home number also if they don't change it, which is ok ).
                    if ( phoneNumber == null || string.IsNullOrWhiteSpace( phoneNumber.Number ) )
                    {
                        phoneNumber = personService.GetPhoneNumber( person, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE ) ) );
                    }

                    if ( phoneNumber != null )
                    {
                        pnbPhone.CountryCode = phoneNumber.CountryCode;
                        pnbPhone.Number = phoneNumber.ToString();
                    }
                    else
                    {
                        pnbPhone.CountryCode = PhoneNumber.DefaultCountryCode();
                        pnbPhone.Number = string.Empty;
                    }
                }
                Guid addressTypeGuid = Guid.Empty;
                if ( !Guid.TryParse( GetAttributeValue( "AddressType" ), out addressTypeGuid ) )
                {
                    addressTypeGuid = new Guid( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME );
                }

                var groupLocation = personService.GetFirstLocation( person.Id, DefinedValueCache.Read( addressTypeGuid ).Id );
                if ( groupLocation != null )
                {
                    GroupLocationId = groupLocation.Id;
                    acAddress.SetValues( groupLocation.Location );
                }
                else
                {
                    acAddress.SetValues( null );
                }
            }

            txtCurrentName.Visible = person != null;
            txtFirstName.Visible = person == null;
            txtLastName.Visible = person == null;

            // Evaluate if comment entry box should be displayed
            txtCommentEntry.Label = GetAttributeValue( "CommentEntryLabel" );
            txtCommentEntry.Visible = GetAttributeValue( "EnableCommentEntry" ).AsBoolean();

            // Se the payment method tabs
            bool ccEnabled = _ccGatewayComponent != null;
            bool achEnabled = _achGatewayComponent != null;
            divCCPaymentInfo.Visible = ccEnabled;
            divACHPaymentInfo.Visible = achEnabled;
            if ( ccEnabled || achEnabled )
            {
                hfPaymentTab.Value = ccEnabled ? "CreditCard" : "ACH";
                if ( ccEnabled && achEnabled )
                {
                    phPills.Visible = true;
                }
            }

            // Determine if and how Name on Card should be displayed
//.........这里部分代码省略.........
开发者ID:NewPointe,项目名称:Rockit,代码行数:101,代码来源:TransactionEntry.ascx.cs

示例3: OnLoad

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad( EventArgs e )
        {
            base.OnLoad( e );

            // Hide the error box on every postback
            nbMessage.Visible = false;
            pnlDupWarning.Visible = false;
            nbSaveAccount.Visible = false;

            if ( _ccGateway != null || _achGateway != null )
            {
                // Save amounts from controls to the viewstate list
                foreach ( RepeaterItem item in rptAccountList.Items )
                {
                    var accountAmount = item.FindControl( "txtAccountAmount" ) as RockTextBox;
                    if ( accountAmount != null )
                    {
                        if ( SelectedAccounts.Count > item.ItemIndex )
                        {
                            decimal amount = decimal.MinValue;
                            if ( decimal.TryParse( accountAmount.Text, out amount ) )
                            {
                                SelectedAccounts[item.ItemIndex].Amount = amount;
                            }
                        }
                    }
                }

                // Update the total amount
                lblTotalAmount.Text = SelectedAccounts.Sum( f => f.Amount ).ToString( "F2" );

                // Set the frequency date label based on if 'One Time' is selected or not
                if ( btnFrequency.Items.Count > 0 )
                {
                    dtpStartDate.Label = btnFrequency.Items[0].Selected ? "When" : "First Gift";
                }

                // If there are both CC and ACH options, set the active tab based on the hidden field value that tracks the active tag
                if ( phPills.Visible )
                {
                    if ( hfPaymentTab.Value == "ACH" )
                    {
                        liCreditCard.RemoveCssClass( "active" );
                        liACH.AddCssClass( "active" );
                        divCCPaymentInfo.RemoveCssClass( "active" );
                        divACHPaymentInfo.AddCssClass( "active" );
                    }
                    else
                    {
                        liCreditCard.AddCssClass( "active" );
                        liACH.RemoveCssClass( "active" );
                        divCCPaymentInfo.AddCssClass( "active" );
                        divACHPaymentInfo.RemoveCssClass( "active" );
                    }
                }

                // Show or Hide the Credit card entry panel based on if a saved account exists and it's selected or not.
                divNewCard.Style[HtmlTextWriterStyle.Display] = ( rblSavedCC.Items.Count == 0 || rblSavedCC.Items[rblSavedCC.Items.Count - 1].Selected ) ? "block" : "none";

                // Show billing address based on if billing address checkbox is checked
                divBillingAddress.Style[HtmlTextWriterStyle.Display] = cbBillingAddress.Checked ? "block" : "none";

                // Show save account info based on if checkbox is checked
                divSaveAccount.Style[HtmlTextWriterStyle.Display] = cbSaveAccount.Checked ? "block" : "none";

                if ( !Page.IsPostBack )
                {
                    var rockContext = new RockContext();

                    SetPage( 1 );

                    // Get the list of accounts that can be used
                    GetAccounts();
                    BindAccounts();

                    // Set personal information if there is a currently logged in person
                    var person = GetPerson( false );
                    if ( person != null )
                    {
                        // If there is a currently logged in user, do not allow them to change their name.
                        txtCurrentName.Visible = true;
                        txtCurrentName.Text = person.FullName;
                        txtFirstName.Visible = false;
                        txtLastName.Visible = false;
                        txtEmail.Text = person.Email;

                        var personService = new PersonService( rockContext );

                        bool displayPhone = false;
                        if ( bool.TryParse( GetAttributeValue( "DisplayPhone" ), out displayPhone ) && displayPhone )
                        {
                            var phoneNumber = personService.GetPhoneNumber( person, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );

                            // If person did not have a home phone number, read the cell phone number (which would then
                            // get saved as a home number also if they don't change it, which is ok ).
                            if ( phoneNumber == null || string.IsNullOrWhiteSpace( phoneNumber.Number ) )
//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:101,代码来源:TransactionEntry.ascx.cs

示例4: GetPaymentInfo

        /// <summary>
        /// Gets the payment information.
        /// </summary>
        /// <returns></returns>
        private PaymentInfo GetPaymentInfo(PersonService personService, FinancialScheduledTransaction scheduledTransaction)
        {
            PaymentInfo paymentInfo = null;
            if ( hfPaymentTab.Value == "ACH" )
            {
                if ( rblSavedAch.Items.Count > 0 && ( rblSavedAch.SelectedValueAsId() ?? 0 ) > 0 )
                {
                    paymentInfo = GetReferenceInfo( rblSavedAch.SelectedValueAsId().Value );
                }
                else
                {
                    paymentInfo = GetACHInfo();
                }
            }
            else if ( hfPaymentTab.Value == "CreditCard" )
            {
                if ( rblSavedCC.Items.Count > 0 && ( rblSavedCC.SelectedValueAsId() ?? 0 ) > 0 )
                {
                    paymentInfo = GetReferenceInfo( rblSavedCC.SelectedValueAsId().Value );
                }
                else
                {
                    paymentInfo = GetCCInfo();
                }
            }
            else
            {
                paymentInfo = new PaymentInfo();
            }

            if ( paymentInfo != null )
            {
                paymentInfo.Amount = SelectedAccounts.Sum( a => a.Amount );
                paymentInfo.FirstName = scheduledTransaction.AuthorizedPerson.FirstName;
                paymentInfo.LastName = scheduledTransaction.AuthorizedPerson.LastName;
                paymentInfo.Email = scheduledTransaction.AuthorizedPerson.Email;

                bool displayPhone = false;
                if ( bool.TryParse( GetAttributeValue( "DisplayPhone" ), out displayPhone ) && displayPhone )
                {
                    var phoneNumber = personService.GetPhoneNumber( scheduledTransaction.AuthorizedPerson, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );
                    paymentInfo.Phone = phoneNumber != null ? phoneNumber.NumberFormatted : string.Empty;
                }

                Guid addressTypeGuid = Guid.Empty;
                if ( !Guid.TryParse( GetAttributeValue( "AddressType" ), out addressTypeGuid ) )
                {
                    addressTypeGuid = new Guid( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME );
                }

                var address = personService.GetFirstLocation( scheduledTransaction.AuthorizedPerson, DefinedValueCache.Read( addressTypeGuid ).Id );
                if ( address != null )
                {
                    paymentInfo.Street = address.Street1;
                    paymentInfo.City = address.City;
                    paymentInfo.State = address.State;
                    paymentInfo.Zip = address.Zip;
                }
            }

            return paymentInfo;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:66,代码来源:GivingProfileDetail.ascx.cs

示例5: GetPaymentInfo

        /// <summary>
        /// Gets the payment information.
        /// </summary>
        /// <returns></returns>
        private PaymentInfo GetPaymentInfo( PersonService personService, FinancialScheduledTransaction scheduledTransaction )
        {
            PaymentInfo paymentInfo = null;
            if ( hfPaymentTab.Value == "ACH" )
            {
                if ( rblSavedAch.Items.Count > 0 && ( rblSavedAch.SelectedValueAsId() ?? 0 ) > 0 )
                {
                    paymentInfo = GetReferenceInfo( rblSavedAch.SelectedValueAsId().Value );
                }
                else
                {
                    paymentInfo = GetACHInfo();
                }
            }
            else if ( hfPaymentTab.Value == "CreditCard" )
            {
                if ( rblSavedCC.Items.Count > 0 && ( rblSavedCC.SelectedValueAsId() ?? 0 ) > 0 )
                {
                    paymentInfo = GetReferenceInfo( rblSavedCC.SelectedValueAsId().Value );
                }
                else
                {
                    paymentInfo = GetCCInfo();
                }
            }
            else
            {
                paymentInfo = new PaymentInfo();
            }

            if ( paymentInfo != null )
            {
                paymentInfo.Amount = SelectedAccounts.Sum( a => a.Amount );
                var authorizedPerson = scheduledTransaction.AuthorizedPersonAlias.Person;
                paymentInfo.FirstName = authorizedPerson.FirstName;
                paymentInfo.LastName = authorizedPerson.LastName;
                paymentInfo.Email = authorizedPerson.Email;

                bool displayPhone = GetAttributeValue( "DisplayPhone" ).AsBoolean();
                if ( displayPhone )
                {
                    var phoneNumber = personService.GetPhoneNumber( authorizedPerson, DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME ) ) );
                    paymentInfo.Phone = phoneNumber != null ? phoneNumber.ToString() : string.Empty;
                }

                Guid addressTypeGuid = Guid.Empty;
                if ( !Guid.TryParse( GetAttributeValue( "AddressType" ), out addressTypeGuid ) )
                {
                    addressTypeGuid = new Guid( Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME );
                }

                var groupLocation = personService.GetFirstLocation( authorizedPerson.Id, DefinedValueCache.Read( addressTypeGuid ).Id );
                if ( groupLocation != null && groupLocation.Location != null )
                {
                    paymentInfo.Street1 = groupLocation.Location.Street1;
                    paymentInfo.Street2 = groupLocation.Location.Street2;
                    paymentInfo.City = groupLocation.Location.City;
                    paymentInfo.State = groupLocation.Location.State;
                    paymentInfo.PostalCode = groupLocation.Location.PostalCode;
                    paymentInfo.Country = groupLocation.Location.Country;
                }
            }

            return paymentInfo;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:69,代码来源:ScheduledTransactionEdit.ascx.cs


注:本文中的Rock.Model.PersonService.GetPhoneNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。