• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Rock类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Rock的典型用法代码示例。如果您正苦于以下问题:C# Rock类的具体用法?C# Rock怎么用?C# Rock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Rock类属于命名空间,在下文中一共展示了Rock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddRole

        public void AddRole( Rock.Models.Cms.Role Role )
        {
            if ( Role.Guid == Guid.Empty )
                Role.Guid = Guid.NewGuid();

            _repository.Add( Role );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:RoleService.cs


示例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();
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:31,代码来源:LayoutList.ascx.cs


示例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;
        }
开发者ID:ChuckWare,项目名称:Rock-ChMS,代码行数:39,代码来源:ServiceObjects.cs


示例4: AddPage

        public void AddPage( Rock.Models.Cms.Page Page )
        {
            if ( Page.Guid == Guid.Empty )
                Page.Guid = Guid.NewGuid();

            _repository.Add( Page );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:PageService.cs


示例5: AddBlockInstance

        public void AddBlockInstance( Rock.Models.Cms.BlockInstance BlockInstance )
        {
            if ( BlockInstance.Guid == Guid.Empty )
                BlockInstance.Guid = Guid.NewGuid();

            _repository.Add( BlockInstance );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:BlockInstanceService.cs


示例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 );
            }
        }
开发者ID:rowlek,项目名称:Rock-ChMS,代码行数:32,代码来源:BlockInstanceService.Partial.cs


示例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;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:39,代码来源:ServiceObjects.cs


示例8: AddGroupType

        public void AddGroupType( Rock.Models.Groups.GroupType GroupType )
        {
            if ( GroupType.Guid == Guid.Empty )
                GroupType.Guid = Guid.NewGuid();

            _repository.Add( GroupType );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:GroupTypeService.cs


示例9: AddPerson

        public void AddPerson( Rock.Models.Crm.Person Person )
        {
            if ( Person.Guid == Guid.Empty )
                Person.Guid = Guid.NewGuid();

            _repository.Add( Person );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:PersonService.cs


示例10: AddBlogPostComment

        public void AddBlogPostComment( Rock.Models.Cms.BlogPostComment BlogPostComment )
        {
            if ( BlogPostComment.Guid == Guid.Empty )
                BlogPostComment.Guid = Guid.NewGuid();

            _repository.Add( BlogPostComment );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:BlogPostCommentService.cs


示例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 );
 }
开发者ID:NewPointe,项目名称:Rockit,代码行数:12,代码来源:BusinessList.ascx.cs


示例12: AddDefinedType

        public void AddDefinedType( Rock.Models.Core.DefinedType DefinedType )
        {
            if ( DefinedType.Guid == Guid.Empty )
                DefinedType.Guid = Guid.NewGuid();

            _repository.Add( DefinedType );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:DefinedTypeService.cs


示例13: AddBlock

        public void AddBlock( Rock.Models.Cms.Block Block )
        {
            if ( Block.Guid == Guid.Empty )
                Block.Guid = Guid.NewGuid();

            _repository.Add( Block );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:BlockService.cs


示例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;
    }
开发者ID:cesarrac,项目名称:TheyRise-game,代码行数:25,代码来源:Resource_Sprite_Handler.cs


示例15: AddEntityChange

        public void AddEntityChange( Rock.Models.Core.EntityChange EntityChange )
        {
            if ( EntityChange.Guid == Guid.Empty )
                EntityChange.Guid = Guid.NewGuid();

            _repository.Add( EntityChange );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:EntityChangeService.cs


示例16: AddAttribute

        public void AddAttribute( Rock.Models.Core.Attribute Attribute )
        {
            if ( Attribute.Guid == Guid.Empty )
                Attribute.Guid = Guid.NewGuid();

            _repository.Add( Attribute );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:AttributeService.cs


示例17: AddFieldType

        public void AddFieldType( Rock.Models.Core.FieldType FieldType )
        {
            if ( FieldType.Guid == Guid.Empty )
                FieldType.Guid = Guid.NewGuid();

            _repository.Add( FieldType );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:FieldTypeService.cs


示例18: AddSite

        public void AddSite( Rock.Models.Cms.Site Site )
        {
            if ( Site.Guid == Guid.Empty )
                Site.Guid = Guid.NewGuid();

            _repository.Add( Site );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:SiteService.cs


示例19: AddPersonToFamily

        public static void AddPersonToFamily( Rock.Client.Person person, int childAdultRoleMemberId, int toFamilyId, bool removeFromOtherFamilies, HttpRequest.RequestResult result )
        {
            // setup the oData. childAdultRoleMemberId describes whether this person should be an adult or child in the family.
            string oDataFilter = string.Format( "?personId={0}&familyId={1}&groupRoleId={2}&removeFromOtherFamilies={3}", person.Id, toFamilyId, childAdultRoleMemberId, removeFromOtherFamilies );

            RockApi.Post_People_AddExistingPersonToFamily( oDataFilter, result );
        }
开发者ID:SparkDevNetwork,项目名称:FamilyManager,代码行数:7,代码来源:FamilyManagerApi.cs


示例20: AddSiteDomain

        public void AddSiteDomain( Rock.Models.Cms.SiteDomain SiteDomain )
        {
            if ( SiteDomain.Guid == Guid.Empty )
                SiteDomain.Guid = Guid.NewGuid();

            _repository.Add( SiteDomain );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:7,代码来源:SiteDomainService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Data.UnitOfWorkScope类代码示例发布时间:2022-05-24
下一篇:
C# Robot类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap