About Me

My photo
System Analyst,Collaboration Servers Integrate,Enterprise setup planner.

Saturday, 19 March 2011

Project Server 2010 Custom Workflow by Visual Studio 2010

Design:
==========



WorkflowBranching.cs file:
==========================

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;

namespace BranchingWorkflow.BranchingWorkflow
{
public sealed partial class BranchingWorkflow : SequentialWorkflowActivity
{
public Guid workflowId = default(System.Guid);

// Stage 1: Initial Proposal Details stage. Replace GUIDs with your values.
public Guid stage1Guid = new Guid("4fd56302-cb51-4a81-958c-47d499456a61");

// Stage 2: Proposal Details stage.
public Guid stage2Guid = new Guid("400060e9-5f2b-4e60-82f6-451b83165190");

// Stage 3: Automated Rejection stage.
public Guid stage3Guid = new Guid("c39007f5-9338-4a0f-af99-761dc7a2e97c");

// Stage 4: Execution stage.
public Guid stage4Guid = new Guid("43a1eb7b-562d-42e8-9a96-88817ef74295");

// Custom field: Sample Proposal Cost.
public Guid proposedCostUid = new Guid("dc68b96a-965e-4b25-ac8a-15a5df729831");

public BranchingWorkflow()
{
wfContext = new Microsoft.SharePoint.WorkflowActions.WorkflowContext();
InitializeComponent();
}

// Class property for the workflow properties.
public SPWorkflowActivationProperties workflowProperties
{ get; set; }

// Class property for the workflow context.
public Microsoft.SharePoint.WorkflowActions.WorkflowContext wfContext
{ get; set; }

// Dispose the workflow properties and workflow context when disposing the workflow.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
wfContext.Dispose();
workflowProperties.Dispose();
}
}

// Event handler for the OnWorkflowActivated activity; initializes the workflow context.
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
wfContext.Initialize(workflowProperties);
}

// Property for comparing the budget cost result.
public bool CompareBudgetCostResult
{ get; set; }

// Method to compare the budget cost.
internal void CompareBudgetCost(object sender, ConditionalEventArgs args)
{
args.Result = CompareBudgetCostResult;
}
}
}

No comments:

Post a Comment