Click here to Skip to main content
15,881,248 members
Articles / Web Development / ASP.NET

State Machine Complier And Asp.net

Rate me:
Please Sign up or sign in to vote.
4.56/5 (4 votes)
20 Oct 2008CPOL4 min read 55.5K   307   31  
This article demonstrate the implementation of State Machine Compiler in .NET. This is small proof of concept for developing state machine workflow activity.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using StateMachineWorkflowActivity;
using Domain;
public partial class RunEngine : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ViewState["CAR_ID"] = Convert.ToInt32(Request.QueryString["CarID"]);
        ViewState["State"] = Convert.ToInt32(Request.QueryString["State"]);
    }
    protected void btnStop_Click(object sender, EventArgs e)
    {
        Car car = new Car();
        car.CarID = Convert.ToInt32(ViewState["CAR_ID"]);
        car.Remark = "State Machine Compiler:Stop Car";
        car.State = (Utilities.CarState)Convert.ToInt32(ViewState["State"]);
        car.User = 444;


        StateMachineWorkflowActivity.IWFFactory m_WFactory = new StateMachineWorkflowActivity.WFFactory();
        StateMachineWorkflowActivity.ICarWF m_CarWF = m_WFactory.StartWorkFlowStateMachine(car);

        m_CarWF.SubmitStop();
        Response.Redirect("CarDashboard.aspx", false);
    }
    protected void btnSlowDown_Click(object sender, EventArgs e)
    {
        Car car = new Car();
        car.CarID = Convert.ToInt32(ViewState["CAR_ID"]);
        car.Remark = "State Machine Compiler:Slow Down Car";
        car.State = (Utilities.CarState)Convert.ToInt32(ViewState["State"]);
        car.User = 444;


        StateMachineWorkflowActivity.IWFFactory m_WFactory = new StateMachineWorkflowActivity.WFFactory();
        StateMachineWorkflowActivity.ICarWF m_CarWF = m_WFactory.StartWorkFlowStateMachine(car);

        m_CarWF.SubmitSlowDown();
        Response.Redirect("CarDashboard.aspx", false);
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Technical Lead
Australia Australia
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

Comments and Discussions