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


C# GroupService.SaveAttributeValues方法代码示例

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


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

示例1: btnSave_Click


//.........这里部分代码省略.........
                                    }

                                    if ( orphanedPhotoId.HasValue )
                                    {
                                        BinaryFileService binaryFileService = new BinaryFileService( rockContext );
                                        var binaryFile = binaryFileService.Get( orphanedPhotoId.Value );
                                        if ( binaryFile != null )
                                        {
                                            // marked the old images as IsTemporary so they will get cleaned up later
                                            binaryFile.IsTemporary = true;
                                            rockContext.SaveChanges();
                                        }
                                    }

                                    // if they used the ImageEditor, and cropped it, the uncropped file is still in BinaryFile. So clean it up
                                    if ( imgPhoto.CropBinaryFileId.HasValue )
                                    {
                                        if ( imgPhoto.CropBinaryFileId != person.PhotoId )
                                        {
                                            BinaryFileService binaryFileService = new BinaryFileService( rockContext );
                                            var binaryFile = binaryFileService.Get( imgPhoto.CropBinaryFileId.Value );
                                            if ( binaryFile != null && binaryFile.IsTemporary )
                                            {
                                                string errorMessage;
                                                if ( binaryFileService.CanDelete( binaryFile, out errorMessage ) )
                                                {
                                                    binaryFileService.Delete( binaryFile );
                                                    rockContext.SaveChanges();
                                                }
                                            }
                                        }
                                    }
                                }
                                person.SaveAttributeValues();

                                // save family information
                                if ( pnlAddress.Visible )
                                {
                                    Guid? familyGroupTypeGuid = Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuidOrNull();
                                    if ( familyGroupTypeGuid.HasValue )
                                    {
                                        var familyGroup = new GroupService( rockContext ).Queryable()
                                                        .Where( f => f.GroupType.Guid == familyGroupTypeGuid.Value
                                                            && f.Members.Any( m => m.PersonId == person.Id ) )
                                                        .FirstOrDefault();
                                        if ( familyGroup != null )
                                        {
                                            Guid? addressTypeGuid = GetAttributeValue( "LocationType" ).AsGuidOrNull();
                                            if ( addressTypeGuid.HasValue )
                                            {
                                                var groupLocationService = new GroupLocationService( rockContext );

                                                var dvHomeAddressType = DefinedValueCache.Read( addressTypeGuid.Value );
                                                var familyAddress = groupLocationService.Queryable().Where( l => l.GroupId == familyGroup.Id && l.GroupLocationTypeValueId == dvHomeAddressType.Id ).FirstOrDefault();
                                                if ( familyAddress != null && string.IsNullOrWhiteSpace( acAddress.Street1 ) )
                                                {
                                                    // delete the current address
                                                    History.EvaluateChange( changes, familyAddress.GroupLocationTypeValue.Value + " Location", familyAddress.Location.ToString(), string.Empty );
                                                    groupLocationService.Delete( familyAddress );
                                                    rockContext.SaveChanges();
                                                }
                                                else
                                                {
                                                    if ( !string.IsNullOrWhiteSpace( acAddress.Street1 ) )
                                                    {
                                                        if ( familyAddress == null )
开发者ID:NewSpring,项目名称:Rock,代码行数:67,代码来源:PublicProfileEdit.ascx.cs


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