本文整理汇总了C#中Rock类的典型用法代码示例。如果您正苦于以下问题:C# Rock类的具体用法?C# Rock怎么用?C# Rock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rock类属于命名空间,在下文中一共展示了Rock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRole
public void AddRole( Rock.Models.Cms.Role Role )
{
if ( Role.Guid == Guid.Empty )
Role.Guid = Guid.NewGuid();
_repository.Add( Role );
}
示例2: DeleteLayout_Click
/// <summary>
/// Handles the Click event of the DeleteLayout control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs" /> instance containing the event data.</param>
protected void DeleteLayout_Click( object sender, Rock.Web.UI.Controls.RowEventArgs e )
{
RockTransactionScope.WrapTransaction( () =>
{
LayoutService layoutService = new LayoutService();
Layout layout = layoutService.Get( e.RowKeyId );
if ( layout != null )
{
string errorMessage;
if ( !layoutService.CanDelete( layout, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
int siteId = layout.SiteId;
layoutService.Delete( layout, CurrentPersonId );
layoutService.Save( layout, CurrentPersonId );
LayoutCache.Flush( e.RowKeyId );
}
} );
BindLayoutsGrid();
}
示例3: Geocode
/// <summary>
/// Geocodes the specified address.
/// </summary>
/// <param name="address">The address.</param>
/// <param name="result">The ServiceObjects result.</param>
/// <returns>
/// True/False value of whether the address was standardized succesfully
/// </returns>
public override bool Geocode( Rock.CRM.Address address, out string result )
{
if ( address != null )
{
string licenseKey = AttributeValue("LicenseKey");
var client = new DOTSGeoCoderSoapClient();
Location_V3 location = client.GetBestMatch_V3(
string.Format("{0} {1}",
address.Street1,
address.Street2),
address.City,
address.State,
address.Zip,
licenseKey );
result = location.Level;
if ( location.Level == "S" || location.Level == "P" )
{
address.Latitude = double.Parse( location.Latitude );
address.Longitude = double.Parse( location.Longitude );
return true;
}
}
else
result = "Null Address";
return false;
}
示例4: AddPage
public void AddPage( Rock.Models.Cms.Page Page )
{
if ( Page.Guid == Guid.Empty )
Page.Guid = Guid.NewGuid();
_repository.Add( Page );
}
示例5: AddBlockInstance
public void AddBlockInstance( Rock.Models.Cms.BlockInstance BlockInstance )
{
if ( BlockInstance.Guid == Guid.Empty )
BlockInstance.Guid = Guid.NewGuid();
_repository.Add( BlockInstance );
}
示例6: Move
public void Move( string id, Rock.CMS.DTO.BlockInstance BlockInstance )
{
var currentUser = Rock.CMS.UserService.GetCurrentUser();
if ( currentUser == null )
throw new WebFaultException<string>( "Must be logged in", System.Net.HttpStatusCode.Forbidden );
using ( Rock.Data.UnitOfWorkScope uow = new Rock.Data.UnitOfWorkScope() )
{
uow.objectContext.Configuration.ProxyCreationEnabled = false;
Rock.CMS.BlockInstanceService BlockInstanceService = new Rock.CMS.BlockInstanceService();
Rock.CMS.BlockInstance existingBlockInstance = BlockInstanceService.Get( int.Parse( id ) );
if ( existingBlockInstance.Authorized( "Edit", currentUser ) )
{
// If the block was moved from or to the layout section, then all the pages
// that use that layout need to be flushed from cache
if ( existingBlockInstance.Layout != BlockInstance.Layout )
{
if ( existingBlockInstance.Layout != null )
Rock.Web.Cache.Page.FlushLayout( existingBlockInstance.Layout );
if ( BlockInstance.Layout != null )
Rock.Web.Cache.Page.FlushLayout( BlockInstance.Layout );
}
uow.objectContext.Entry( existingBlockInstance ).CurrentValues.SetValues( BlockInstance );
BlockInstanceService.Move( existingBlockInstance );
BlockInstanceService.Save( existingBlockInstance, currentUser.PersonId );
}
else
throw new WebFaultException<string>( "Not Authorized to Edit this BlockInstance", System.Net.HttpStatusCode.Forbidden );
}
}
示例7: Verify
/// <summary>
/// Geocodes the specified address.
/// </summary>
/// <param name="location">The location.</param>
/// <param name="resultMsg">The result MSG.</param>
/// <returns>
/// True/False value of whether the address was geocoded successfully
/// </returns>
public override VerificationResult Verify( Rock.Model.Location location, out string resultMsg )
{
VerificationResult result = VerificationResult.None;
resultMsg = string.Empty;
string licenseKey = GetAttributeValue("LicenseKey");
var client = new DOTSGeoCoderSoapClient();
Location_V3 location_match = client.GetBestMatch_V3(
string.Format("{0} {1}",
location.Street1,
location.Street2),
location.City,
location.State,
location.PostalCode,
licenseKey );
resultMsg = location_match.Level;
if ( location_match.Level == "S" || location_match.Level == "P" )
{
double latitude = double.Parse( location_match.Latitude );
double longitude = double.Parse( location_match.Longitude );
if ( location.SetLocationPointFromLatLong( latitude, longitude ) )
{
result = VerificationResult.Geocoded;
}
}
return result;
}
示例8: AddGroupType
public void AddGroupType( Rock.Models.Groups.GroupType GroupType )
{
if ( GroupType.Guid == Guid.Empty )
GroupType.Guid = Guid.NewGuid();
_repository.Add( GroupType );
}
示例9: AddPerson
public void AddPerson( Rock.Models.Crm.Person Person )
{
if ( Person.Guid == Guid.Empty )
Person.Guid = Guid.NewGuid();
_repository.Add( Person );
}
示例10: AddBlogPostComment
public void AddBlogPostComment( Rock.Models.Cms.BlogPostComment BlogPostComment )
{
if ( BlogPostComment.Guid == Guid.Empty )
BlogPostComment.Guid = Guid.NewGuid();
_repository.Add( BlogPostComment );
}
示例11: gBusinessList_RowSelected
/// <summary>
/// Handles the RowSelected event of the gBusinessList control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param>
protected void gBusinessList_RowSelected( object sender, Rock.Web.UI.Controls.RowEventArgs e )
{
var parms = new Dictionary<string, string>();
var businessId = e.RowKeyId;
parms.Add( "businessId", businessId.ToString() );
NavigateToLinkedPage( "DetailPage", parms );
}
示例12: AddDefinedType
public void AddDefinedType( Rock.Models.Core.DefinedType DefinedType )
{
if ( DefinedType.Guid == Guid.Empty )
DefinedType.Guid = Guid.NewGuid();
_repository.Add( DefinedType );
}
示例13: AddBlock
public void AddBlock( Rock.Models.Cms.Block Block )
{
if ( Block.Guid == Guid.Empty )
Block.Guid = Guid.NewGuid();
_repository.Add( Block );
}
示例14: GetChunkSprite
public Sprite GetChunkSprite(Rock.RockType rockType)
{
Sprite chunkSprite = new Sprite();
int randomSharpSelection = Random.Range(0, sharpChunks.Length);
int randomHexSelection = Random.Range(0, hexChunks.Length);
int randomTubeSelection = Random.Range(0, tubeChunks.Length);
switch (rockType)
{
case Rock.RockType.sharp:
chunkSprite = sharpChunks[randomSharpSelection];
break;
case Rock.RockType.hex:
chunkSprite = hexSprites[randomHexSelection];
break;
case Rock.RockType.tube:
chunkSprite = tubeChunks[randomTubeSelection];
break;
default:
chunkSprite = sharpChunks[randomSharpSelection];
break;
}
return chunkSprite;
}
示例15: AddEntityChange
public void AddEntityChange( Rock.Models.Core.EntityChange EntityChange )
{
if ( EntityChange.Guid == Guid.Empty )
EntityChange.Guid = Guid.NewGuid();
_repository.Add( EntityChange );
}