Click here to Skip to main content
15,881,600 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.
��USE [CarAutomation]

GO

/****** Object:  StoredProcedure [dbo].[isp_WorkFlowStatePersistence]    Script Date: 10/20/2008 18:55:51 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

 

CREATE PROCEDURE [dbo].[isp_WorkFlowStatePersistence]  

 -- Add the parameters for the stored procedure here  

    @Car_ID int,  

    @Updated_By int,  

    @Current_State_ID int,  

    @Previous_State_ID int,  

    @Remarks VARCHAR(max)  

AS   



   

 

  if Exists (select Car_ID From Car where Car_ID=  @Car_ID

   and Current_State_ID=@Previous_State_ID)  

  BEGIN   

   -- Audit Log  

   BEGIN  TRAN

    INSERT INTO [CarAutomation].[dbo].[StateAuditLog]

           ([Car_ID]

           ,[State_ID]

           ,[Remarks]

           ,[Last_Updated_By]

           ,[Last_Updated_Date])

     VALUES

           (@Car_ID

           ,@Current_State_ID

           ,@Remarks



           ,@Updated_By

           ,GetDate())

   

   -- Update State Demand Table  

   UPDATE  Car  

   SET     [Current_State_ID] = @Current_State_ID,  

     [Previous_State_ID] = @Previous_State_ID,  

     [Last_Updated_By] = @Updated_By  

   WHERE   [Car_ID] = @Car_ID   

  if(@@error=0)

	commit

  else

    Rollback

END

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