in Search
 
Home Blogs Forums Marketplace Files
 
 
 

Moving From One Task To The Next...

Building A Simple TaskList

Until recently, building a customized task list involved having an intimate knowledge with our database schema. The BQueryRuntime API, new to Captaris Workflow 6.5, was designed to change all that by introducing a simple model that would allow you to develop a query without the need to poke around in our database tables.

The BQueryRuntime class has only two responsibilities. The first is to create and return a query object and the second is to execute a query object and return the results in a DataSet. Both operations can be seen in the following sample:
using System;
using System.Data;
using System.Web.UI;
using Teamplate.BLL;
using Teamplate.BLL.Data;

namespace SimpleTaskList
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
BSession bSession = new BSession();
bSession.Connect(string.Empty, string.Empty, string.Empty);

gridView.DataSource = SelectAllTasks(bSession.GetToken());
gridView.DataBind();
}

private DataSet SelectAllTasks(string sessionToken)
{
BQueryRuntime runtime = new BQueryRuntime();
runtime.SetSessionToken(sessionToken);

IQuery query = runtime.CreateQuery(QueryType.TaskList); return runtime.ExecuteDataSet(query); } } }

The above sample is useful if you only have a few task records in your database. Since this is generally not the case, you need a way to limit the result set to only those records you are interested in. This is done by adding criteria to the query object. Criteria objects are created using the following syntax:

    ColumnName.Operator(valueToCompare)

The task list columns themselves are made available via the TaskList column collection object as seen in the following example:
using System;
using System.Data;
using System.Web.UI;
using Teamplate.BLL;
using Teamplate.BLL.Data;

namespace SimpleTaskList
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
BSession bSession = new BSession();
bSession.Connect(string.Empty, string.Empty, string.Empty);

gridView.DataSource = SelectAllTasksFor(bSession.GetUserId(), bSession.GetToken());
gridView.DataBind();
}

private DataSet SelectAllTasksFor(int userId, string sessionToken)
{
BQueryRuntime runtime = new BQueryRuntime();
runtime.SetSessionToken(sessionToken);

IQuery query = runtime.CreateQuery(QueryType.TaskList);
query.AddCriteria(TaskList.TaskStatus.MatchAny(TaskStatus.Ready | TaskStatus.Waiting)); query.AddCriteria(TaskList.ResponsibleId.EqualTo(userId)); return runtime.ExecuteDataSet(query);
}
}
}
That's it. Simply ask the BQueryRuntime to create a query object, add some criteria objects to limit the result set, and then ask the BQueryRuntime to execute your query object and return you a nice new DataSet.
Published Tuesday, May 22, 2007 9:39 AM by DonCampbell
Filed Under: ,

Comments

 

joelcade said:

This is great stuff.  I would like to see the addition of user lists, group lists, process lists, but this is a great start and a stellar improvement over the past practices.
May 23, 2007 10:19 AM
 

LeoRivas said:

Great, but can I put some process data on the tasklist? I mean, data from the XML
October 17, 2007 11:44 AM
Anonymous comments are disabled

This Blog

Post Calendar

<May 2007>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

Post Categories

Syndication

  Privacy    Site Terms   Contact Administrator