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


C# Rock.SetAttributeValue方法代码示例

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


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

示例1: SaveAttributeValue

        private static void SaveAttributeValue( Rock.Model.Workflow workflow, string key, string value, 
            FieldTypeCache fieldType, RockContext rockContext, Dictionary<string, string> qualifiers = null )
        {
            if (workflow.Attributes.ContainsKey(key))
            {
                workflow.SetAttributeValue( key, value );
            }
            else
            {
                // If workflow attribute doesn't exist, create it
                // ( should only happen first time a background check is processed for given workflow type)
                var attribute = new Rock.Model.Attribute();
                attribute.EntityTypeId = workflow.WorkflowType.TypeId;
                attribute.EntityTypeQualifierColumn = "WorkflowTypeId";
                attribute.EntityTypeQualifierValue = workflow.WorkflowTypeId.ToString();
                attribute.Name = key.SplitCase();
                attribute.Key = key;
                attribute.FieldTypeId = fieldType.Id;

                if ( qualifiers != null )
                {
                    foreach( var keyVal in qualifiers )
                    {
                        var qualifier = new Rock.Model.AttributeQualifier();
                        qualifier.Key = keyVal.Key;
                        qualifier.Value = keyVal.Value;
                        attribute.AttributeQualifiers.Add( qualifier );
                    }
                }

                // Set the value for this action's instance to the current time
                var attributeValue = new Rock.Model.AttributeValue();
                attributeValue.Attribute = attribute;
                attributeValue.EntityId = workflow.Id;
                attributeValue.Value = value;
                new AttributeValueService( rockContext ).Add( attributeValue );
            }
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:38,代码来源:ProtectMyMinistry.cs

示例2: CopyAttributes

        private void CopyAttributes(Rock.Model.Workflow newWorkflow, Rock.Model.WorkflowActivity currentActivity, RockContext rockContext)
        {
            if (currentActivity.Attributes == null)
            {
                currentActivity.LoadAttributes( rockContext );
            }

            if (currentActivity.Workflow.Attributes == null)
            {
                currentActivity.Workflow.LoadAttributes( rockContext );
            }

            // Pass attributes from current Workflow to new Workflow.
            foreach (string key in currentActivity.Workflow.AttributeValues.Keys)
            {
                newWorkflow.SetAttributeValue( key, currentActivity.Workflow.GetAttributeValue( key ) );
            }

            // Pass attributes from current Activity to new Workflow.
            foreach (string key in currentActivity.AttributeValues.Keys)
            {
                newWorkflow.SetAttributeValue( key, currentActivity.GetAttributeValue(key) );
            }
        }
开发者ID:Kronos11,项目名称:rock_lib_RlmExtensions,代码行数:24,代码来源:ActivateWorkflow.cs


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