本文整理汇总了C#中Workflow.SetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# Workflow.SetAttributeValue方法的具体用法?C# Workflow.SetAttributeValue怎么用?C# Workflow.SetAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow.SetAttributeValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HydrateObjects
private bool HydrateObjects()
{
LoadWorkflowType();
// Set the note type if this is first request
if ( !Page.IsPostBack )
{
var entityType = EntityTypeCache.Read( typeof( Rock.Model.Workflow ) );
var noteTypes = NoteTypeCache.GetByEntity( entityType.Id, string.Empty, string.Empty );
ncWorkflowNotes.NoteTypes = noteTypes;
}
if ( _workflowType == null )
{
ShowNotes( false );
ShowMessage( NotificationBoxType.Danger, "Configuration Error", "Workflow type was not configured or specified correctly." );
return false;
}
if ( !_workflowType.IsAuthorized( Authorization.VIEW, CurrentPerson ) )
{
ShowNotes( false );
ShowMessage( NotificationBoxType.Warning, "Sorry", "You are not authorized to view this type of workflow." );
return false;
}
// If operating against an existing workflow, get the workflow and load attributes
if ( !WorkflowId.HasValue )
{
WorkflowId = PageParameter( "WorkflowId" ).AsIntegerOrNull();
if ( !WorkflowId.HasValue )
{
Guid guid = PageParameter( "WorkflowGuid" ).AsGuid();
if ( !guid.IsEmpty() )
{
_workflow = _workflowService.Queryable()
.Where( w => w.Guid.Equals( guid ) && w.WorkflowTypeId == _workflowType.Id )
.FirstOrDefault();
if ( _workflow != null )
{
WorkflowId = _workflow.Id;
}
}
}
}
if ( WorkflowId.HasValue )
{
if ( _workflow == null )
{
_workflow = _workflowService.Queryable()
.Where( w => w.Id == WorkflowId.Value && w.WorkflowTypeId == _workflowType.Id )
.FirstOrDefault();
}
if ( _workflow != null )
{
_workflow.LoadAttributes();
foreach ( var activity in _workflow.Activities )
{
activity.LoadAttributes();
}
}
}
// If an existing workflow was not specified, activate a new instance of workflow and start processing
if ( _workflow == null )
{
string workflowName = PageParameter( "WorkflowName" );
if ( string.IsNullOrWhiteSpace(workflowName))
{
workflowName = "New " + _workflowType.WorkTerm;
}
_workflow = Rock.Model.Workflow.Activate( _workflowType, workflowName);
if ( _workflow != null )
{
// If a PersonId or GroupId parameter was included, load the corresponding
// object and pass that to the actions for processing
object entity = null;
int? personId = PageParameter( "PersonId" ).AsIntegerOrNull();
if ( personId.HasValue )
{
entity = new PersonService( _rockContext ).Get( personId.Value );
}
else
{
int? groupId = PageParameter( "GroupId" ).AsIntegerOrNull();
if ( groupId.HasValue )
{
entity = new GroupService( _rockContext ).Get( groupId.Value );
}
}
// Loop through all the query string parameters and try to set any workflow
// attributes that might have the same key
foreach ( string key in Request.QueryString.AllKeys )
{
_workflow.SetAttributeValue( key, Request.QueryString[key] );
}
//.........这里部分代码省略.........