本文整理汇总了C#中Rock.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Rock.ToString方法的具体用法?C# Rock.ToString怎么用?C# Rock.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock
的用法示例。
在下文中一共展示了Rock.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
/// <summary>
/// Sets the value.
/// </summary>
/// <param name="location">The location.</param>
public void SetValue( Rock.Model.Location location )
{
if ( location != null )
{
ItemId = location.Id.ToString();
List<int> parentLocationIds = new List<int>();
var parentLocation = location.ParentLocation;
while ( parentLocation != null )
{
if ( parentLocationIds.Contains( parentLocation.Id ) )
{
// infinite recursion
break;
}
parentLocationIds.Insert( 0, parentLocation.Id ); ;
parentLocation = parentLocation.ParentLocation;
}
InitialItemParentIds = parentLocationIds.AsDelimited( "," );
ItemName = location.ToString();
}
else
{
ItemId = Constants.None.IdValue;
ItemName = Constants.None.TextHtml;
}
}
示例2: SetValue
/// <summary>
/// Sets the value.
/// </summary>
/// <param name="location">The location.</param>
public void SetValue( Rock.Model.Location location )
{
if ( location != null )
{
ItemId = location.Id.ToString();
string parentLocationIds = string.Empty;
var parentLocation = location.ParentLocation;
while ( parentLocation != null )
{
parentLocationIds = parentLocation.Id + "," + parentLocationIds;
parentLocation = parentLocation.ParentLocation;
}
InitialItemParentIds = parentLocationIds.TrimEnd( new char[] { ',' } );
ItemName = location.ToString();
}
else
{
ItemId = Constants.None.IdValue;
ItemName = Constants.None.TextHtml;
}
}
示例3: Geocode
/// <summary>
/// Geocodes the specified <see cref="Rock.CRM.Address"/>
/// </summary>
/// <param name="address">The address.</param>
/// <param name="personId">The person id.</param>
public void Geocode( Rock.CRM.Address address, int? personId )
{
Core.ServiceLogService logService = new Core.ServiceLogService();
string inputAddress = address.ToString();
// Try each of the geocoding services that were found through MEF
foreach ( KeyValuePair<int, Lazy<Rock.Address.GeocodeComponent, Rock.Extension.IComponentData>> service in Rock.Address.GeocodeContainer.Instance.Components )
if ( !service.Value.Value.AttributeValues.ContainsKey( "Active" ) || bool.Parse( service.Value.Value.AttributeValues["Active"].Value ) )
{
string result;
bool success = service.Value.Value.Geocode( address, out result );
// Log the results of the service
Core.ServiceLog log = new Core.ServiceLog();
log.Time = DateTime.Now;
log.Type = "Address Geocode";
log.Name = service.Value.Metadata.ComponentName;
log.Input = inputAddress;
log.Result = result;
log.Success = success;
logService.Add( log, personId );
logService.Save( log, personId );
// If succesful, set the results and stop processing
if ( success )
{
address.GeocodeService = service.Value.Metadata.ComponentName;
address.GeocodeResult = result;
address.GeocodeDate = DateTime.Now;
break;
}
}
address.GeocodeAttempt = DateTime.Now;
}