本文整理汇总了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 )