Introduction
Welcome to second installment of "Examining Organizational Workflows under the hood of .NET" , the first part gives overview of what exactly Organizational Workflow's are and how an organization can analyze them, its also examine the basic components of Workflow and key points that one needs to be aware of before designing a Organizational Workflow. Now having this knowledge under our belt we can delve into the real world and examine the Workflow Solutions available in the Software Market, off course needless to say offering full fledged support of .NET. By the way the sole purpose of placing Part II heading is to give tribute to great Hollywood film of all time named "The Godfather Part II" by Francis Ford Copola.
Overview of K2.net 2003 Workflow
K2.net Workflow solution is a product by SourceCode Technology Holdings (Pvt) Ltd , which facilitate workflow and business integration, provide in-depth support to its business partners and build a comprehensive knowledge base for its products. The K2.net Work Flow, is an enterprise human-to-human and human-to-system workflow platform built on .NET for .NET.K2.net automates business processes spanning people, technology and distance using the .NET platform. To the business minded peoples the K2.net is a platform to manage the business processes in an organization, allowing users to spend more time on key business drivers such as customer satisfaction and innovation, and less time on micro management.K2.net provides the underlying infrastructure, built on the .NET platform, to integrate, leverage and optimize the investment in technology infrastructure.
The figure 1.0 illustrate the K2.Net Workflow methodology

Figure 1.0
The figure 1.0 convey the following three key points
- K2.net uses an event-driven workflow engine that provides an environment where programs and processes can run seamlessly.
- K2.net creates "seamless distance" - connecting companies, programs and processes across platforms, networks and time.
- Connected processes ensure that activities are completed efficiently, resulting in decreased Turn around times and increased service levels.
K2.Net Technical Standing
The K2.Net Workflow essentially complements Microsoft based solution as depict in figure 1.2

Here we can clearly see K2.Net (with its miscellaneous components which we will see later on) integrates and expands the domain of vast number of Microsoft Software Products this includes the software's listed next, the brief overview is also provided in order to give better understanding and the position of K2.net with these product, as K2.net enhances and elevates the scope of these product to considerable extend.
Microsoft Exchange Server: Messaging integration with MS Exchange Server, it allows you to integrate with Microsoft Exchange Server or any other SMPT compliant messaging infrastructures.
BizTalk Server 2004 integration: K2.net 2003 allows you to seamlessly interact with BizTalk in the following way:
- K2.net 2003 Business Rules can be native BizTalk business rules and managed by the BizTalk Business Rules engine and services.
- K2.net 2003 can call BizTalk orchestrations, and also integrate with BizTalk Application Adaptors.
- K2.net 2003 can orchestrate BizTalk Human Workflow Services actions.
- K2.net 2003 can integrate with BizTalk Business Activity Monitoring (BAM).
Microsoft Office InfoPath 2003 integration:
K2.net 2003 can natively create Info Path based processes through a wizard based interface, and can consume and manipulate InfoPath data and views as part of any process.
Microsoft SharePoint Server 2003: You can integrate K2.Net with Microsoft SharePoint Server to rapidly build Web portals, also the default WebPart provided by K2.net gives seamless manipulation of workflow steps from within SharePoint Portal Server 2003
The K2.net Workflow Solution strictly follows Multi-Tier Architecture, this allows decoupling between components and also preserves the logical abstraction between components. One of the classic example of this decoupling is the distinction of Presentation Layer with Data Access Layer (see figure 1.3)

Figure 1.3
Now, we are pretty much in position to take a tour of the basic features of the K2.Net Workflow solution, the next section is devoted to it.
Taking a Tour of K2.Net Features
As we already seen in the previous section that K2.Net Workflow Solution Integrates with number of products by Microsoft Corporation , in order to keep integration up to the mark, its very important that the product itself provides rich feature set which carter needs for both developers and business users. In this section I will give overview of basic feature set provide by K2.Net. Take a moment to look at figure 1.4 that shows the features in a nutshell

Figure 1.4
Now lets examine each feature shown in Figure 1.4 .
K2.net Studio:
The K2.Net Studio is center place for designing workflow, its an intuitive design platform incorporating all key features required to map business processes quickly and efficiently. (see figure 1.5)

Figure 1.5
The K2.Net Studio is truly modelled around Microsoft Visual Studio.NET minimizing learning curves, its drag-n-drop workflow design IDE made it very cosy for both the developers and the Business Users to design Work Flow in a very short time. The Code editor is also present with code auto completion and Intellisense allowing for development of business rules in .NET languages like VB.NET and C#.
K2.net Server
The K2.Net Server is the Kernel for the K2.Net Workflow Solution like IIS for ASP.NET Applications. The K2.net Server runs on Microsoft Windows 2000 or Windows Server 2003 platforms - optimized for high load enterprise environments. K2.Net Server's fully scalable architecture ensuring that risk is mitigated and that high volume environments are effectively deployed (see figure 1.6 ). K2.net Server uses Microsoft SQL 2000 or MSDE 2000 as its private data store. The Data Store consists of the K2.net Transaction and Log databases. One of the key features of K2.Net Server is that it integrates with Microsoft Active Directory for real-time role resolution.

Figure 1.6
K2.net server encompass multiple interface mechanisms including .NET Assemblies and WSDL Web Services using SOAP as its RPC protocol, moreover its Integration with WMI (Windows Management Instrumentation) and Windows Performance Monitor made it highly suitable for distributed environments.
K2.net Service Manager
The K2.net Service Manager is a Microsoft Management Console snap-in, allowing a K2.net system administrator access to the configuration and management of the following K2.net Server components:
- K2.net Server
- K2.net Log Service
- Solutions
- Processes
- Security
K2.net Workspace
K2.Net Workspace is a Web Based Interface for deliver work items to a user or group (see figure 1.7), platform independently onto any device. Through k2.net Console user gain access to work assigned to your direct reports. Its supports platforms such as ASP, ASP.net, Win32, SMTP Mail, Microsoft Exchange Server, mobile and WAP devices. I think one the clear plus point is that users can view process and activity reports and statistics from a central console and drill down into processes to view activity status and user activity.
Figure 1.7
Following are the Key Features of K2.net Workspace
- Report periodically on process and user performance
- Uses DHTML, ASP and XML to allow anywhere/anytime access to performance information
- Colour-coding allows users to easily identify process status
- Comprehensive search engine allows users to find instances quickly and easily
- Incorporates K2.net View Flow technology to display process status
Where are We:-
In the previous sections we look in to the basic functionality and features of K2.Net Workflow. We also briefly saw how K2.net integrates with existing Microsoft products. This knowledge of K2.Net Workflow solution will servers us to design and develop the workflow solutions in K2.net. Now in the Next sections we will try to understand the Runtime Object Model for K2.Net which servers as the building block that is provide by K2.net for developers.
K2.net 2003 Server Runtime Object Model
Every developer today that involves in building rational application identifies the Object Model as the crux to develop the application, intact a poorly designed Object Model led to a bad product. K2.net done the fabulous job in this arena, and build a highly reusable and extensible object model for developers .I will explain the basic building block of K2.net ROM (runtime object model ) and drill down their sole purpose.
What is the Runtime Object Model for K2.net 2003 Server?
The K2.Net ROM is a full set of API's exposed as both .NET assemblies and WSDL Web services, it provides solution developers a programming interface to the K2.net 2003 Server. K2ROM allows access to the running process instances and their components on the K2.net server. The following are the list of prime object included in the K2 ROM.
- Connection
- Server Items - executed by K2.net Server
- Process Instance
- Worklist Items - requiring user action
As shown in the figure 1.8, the K2ROM acts as the hub of interaction, moreover provides full access to all the elements of the workflow. Also note that K2ROM can interact with IIS, IIS WSDL or any other External request (see figure 1.8).

Figure 1.8
Examining the Objects Model in K2.Net ROM
Let's take a look into the Objects provided by K2.Net ROM, these are the objects that as a developer you will be using all the time. The object hierarchy is shown in figure 1.9

Figure 1.9
Let's examine each of the objects shown in figure 1.9 in turn.
The Connection Object
On the top of Object Model Hierarchy (figure 1.9) lies the Connection Object. This object is used to connect to a K2.net 2003 Server. Once the connection is established, this object acts as the base (or context) for subsequent objects. Next lets look into the members of Connection (see figure 2.0)

Figure 2.0
Connection Class Members:
- Open: Used to open a connection to a specified K2.net Server.
- CreateProcessInstance: This method is used to get a handle to a new process instance. This method is used in conjunction with StartProcessInstance to start the process specified with this method.
- Export: The export method is used to export an entire K2.net solution to the connected K2.net Server. The entire solution is exported as an XML Schema (obtaining this XML schema from the K2Studio Object Model is beyond the scope of this module).
- OpenWorklist: This method is used to obtain a handle to a Worklist object for the specified username.
- OpenWorklistItem: This method is used to obtain a handle to a specific work item based on the work items' Serial No. Worklist Items can also be obtained through the Worklist object.
- StartProcessInstance: This object is used to start the process (the handle is given as a parameter) that was created using the CreateProcessInstance method.
- OpenServerItem: This method is used to obtain a handle to a Worklist object for the specified server work item.
- ViewProcessInstance: This method is used to view the a specific process based on the required PID parameter.
The ProcessInstance Object
A ProcessInstance is a single running instance of a process based on a process definition designed by a process developer using K2.net 2003 Studio. A process also contains handles to its associated Data Fields and XML Fields.

Figure 2.1
ProcessInstance Class Members:
- Name: This property returns the name of the process instance.
- Description: This property returns the description of the process instance.
- Metadata: Gets the MetaData that describes ProcessInstance. This field typically contains an XML String (however is not restricted to this).
- StartDate: This method returns the Start Date and Time of the process instance.
- DataFields: This method returns a handle to the collection of Data Field items.
- XMLFields: This method returns a handle to the collection of XML Field items.
- Priority: This method gets or sets the priority for the process instance.
The Worklist Object
The Worklist Object represents a collection of Work Items that still need to be completed by a specific user, It returns a collection of WorklistItem objects. The Worklist Class Members along with are WorkListItem are shown in figure 2.2

Figure 2.2
Worklist Class Members:
- Count: This property returns the number of Work Items within the current worklist object.
- Item: This method returns a handle to the specified instance of a WorklistItem in the Worklist collection via a unique index.
The WorklistItem Object
- The WorklistItem Object represents a single work item instance.
- The WorklistItem Object can be considered a meta-object providing access to the related event item within it.
- This object is used during the development of custom worklists and workspaces.
WorklistItem Class Members:
- ActivityInstanceDestination: This method returns a handle to the specific activity instance, allocated to the current user (with its related data).
- ProcessInstance: This method returns a handle to the process instance (with its related data)
- Open: This method flags the work item as being worked on by the current user.
- Update: This saves all the current data variables without continuing with the process for the current work item.
- Finish: This completes the current work item (event) and requests K2.net to continued with the process.
- SerialNumber: This property returns the unique serial number for the particular event item. This is used to uniquely instantiate a work item.
Conclusion and What Next:-
In this instalment of "Examining Organizational Workflows under the hood of .NET" we examine K2.net WorkFlow solution. We start by examine K2.net technical standing and its integration support for the Microsoft Server Family Products, later we drill down into K2.Net features and demystify their functionality . We also examine the K2.Net ROM, by taking a tour of its basic class hierarchy. In the next installment of this series I explain how to build a simple process in K2.Net, we also write small code fragments that amplify the K2.net object model usage (for e.g the connection object ). Till then Happy Programming.