本文整理汇总了C#中Rock.Model.PersonService.GetFirstLocation方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.GetFirstLocation方法的具体用法?C# PersonService.GetFirstLocation怎么用?C# PersonService.GetFirstLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonService
的用法示例。
在下文中一共展示了PersonService.GetFirstLocation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
}
示例2: ShowBusiness
private void ShowBusiness( PersonService personService, Person business )
{
if ( personService != null && business != null )
{
txtBusinessName.Text = business.LastName;
txtEmail.Text = business.Email;
Guid addressTypeGuid = Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_WORK.AsGuid();
var groupLocation = personService.GetFirstLocation( business.Id, DefinedValueCache.Read( addressTypeGuid ).Id );
if ( groupLocation != null )
{
GroupLocationId = groupLocation.Id;
acAddress.SetValues( groupLocation.Location );
}
else
{
GroupLocationId = null;
acAddress.SetValues( null );
}
}
else
{
txtBusinessName.Text = string.Empty;
txtEmail.Text = string.Empty;
GroupLocationId = null;
acAddress.SetValues( null );
}
}
示例3: 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
//.........这里部分代码省略.........
示例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;
}
示例5: OnLoad
//.........这里部分代码省略.........
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 ) )
{
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
{
txtCurrentName.Visible = false;
txtFirstName.Visible = true;
txtLastName.Visible = true;
}
SetPage( 1 );
}
}
else
{
SetPage( 0 );
ShowMessage( NotificationBoxType.Danger, "Configuration Error", "Please check the configuration of this block and make sure a valid Credit Card and/or ACH Financial Gateway has been selected." );
}
}
示例6: 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;
}