Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am new to windows work flows. I am creating a state machine work flow, I have 5 states
1. Initial state -- login.aspx
2. UserState -- Default.aspx
3. AuthoriserState -- authoriser.aspx
4. ApproverState -- approver.aspx
5. CompletedState -- Complete.aspx

when I am in initial state if i login how can i go different state
like
if i login as user I need to go to UserState
if login as authoriser I need to go to AuthoriserState
if login as approver I need to go to ApproverState
Posted

1 solution

create a object for login
C#
if(login.state==initial)
{
 if(login.role== user)
 {
 login.state =UserState;
 Response.Redirect("Default.aspx");
 }
 else if(login.role==authoriser)
 {
 login.state=authoriserstate;
 Response.Redirect("authoriser.aspx");
 }
}

i'm not sure whether it will work out plese refer this link

http://stackoverflow.com/questions/9406519/redirect-to-other-page-according-their-roles[^]
 
Share this answer
 
v3
Comments
Chitla Janardhan Reddy 14-Jun-12 23:44pm    
Hi Agustee,
Thanks for replying i have another question.
When I am going to resume the workflow it is throwing exception that workflow resume operation will perform only on started workflows. can you help me how to restart a suspended workflow. Here is my code sippet:

WorkflowRuntime workflowRuntime = new WorkflowRuntime();
WorkFlowDemo.states.state state = new WorkFlowDemo.states.state();
Guid state_ID = Guid.NewGuid();
Dictionary<string,> Params = new Dictionary<string,>();
ExternalDataExchangeService ExDateExchService = new ExternalDataExchangeService();
WorkflowInstance instance = null;
StateMachineWorkflowInstance ins = null;

protected void SendData_Click(object sender, EventArgs e)
{
workflowRuntime.AddService(ExDateExchService);
ExDateExchService.AddService(state);
instance =
workflowRuntime.CreateWorkflow(typeof(Workflow1), Params, state_ID);
Session["workflow"] = state_ID;
instance.Start();
ins = new StateMachineWorkflowInstance(workflowRuntime, state_ID);
workflowlist.Add(state_ID);

state.SubmitContent(state_ID);

if (ins.CurrentStateName == "Submitted")
{
SendData.Visible = false;
Approve.Visible = true;
Reject.Visible = true;
Incomplete.Visible = true;
Cancel.Visible = true;
}
instance.Suspend("waiting for user input");
}


{
instance = workflowRuntime.GetWorkflow(state_ID);/******Here I am getting error. I am not able to get the workflow and restart it*********/
instance.Resume();
ins = new StateMachineWorkflowInstance(workflowRuntime, state_ID);
// ins.WorkflowInstance.Load();
state.Approved(state_ID);

if (ins.CurrentStateName == "Complete")
{
Data.Visible = true;
Data.InnerText = "Approved";
ContentTextBox.Visible = false;
SendData.Visible = false;
Approve.Visible = false;
Reject.Visible = false;
Incomplete.Visible = false;
Cancel.Visible = false;
if (workflowRuntime != null)
{
workflowRuntime.StopRuntime();
workflowRuntime.Dispose();
}
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900