Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Product Family
Current publication
Table of Contents

Create Custom Web Parts

AVEVA Work Tasks provides six out of the box web parts. However, you can also create your own custom web parts to be used in the Enterprise Console.

For example, consider a scenario where you would like to see time zone information on the dashboard. The time zone information can be displayed on the dashboard by creating a custom web part and then adding it to the dashboard web part settings. You can select it from the dashboard web part settings and add it to the specified web part zone.

Note: You can customize the following sample code to create your own custom web parts.

To create custom web parts

Code to create a class library:

Note: In the class libarary, ensure that you add a reference to Skelta.WebParts and also inherit BaseWebPart as Skelta.WebParts.BaseWebPart.

using System.Data;

using Workflow.NET.Interfaces;

using Workflow.NET.Storage;

namespace CustomWebPart

{

public class TimeZone : Skelta.WebParts.BaseWebPart

{

protected override void CreateChildControls()

{

base.CreateChildControls();

System.Web.UI.WebControls.GridView gridView = new System.Web.UI.WebControls.GridView();

gridView.DataSource = this.GetData();

gridView.DataBind();

this.Controls.Add(gridView);

}

private DataTable GetData()

{

DataTable table = new DataTable();

IDataHandler dbHandler = DataHandlerFactory.GetDataHandler(new Workflow.NET.Config(ApplicationName));

using (dbHandler)

{

string query = "Select RegionalSetting, UTCDifference from SKTimeZones";

table = dbHandler.ReadData(query, null);

}

return table;

}

}

}

Place the dll in [AVEVA Work Tasks Installed Path]\AVEVA\Work Tasks\Bin and AVEVA Work Tasks\Web\EnterpriseConsole\Bin folders.

Note: If the assembly is strong named, place it in GAC and also add an entry in the web.config file.

Add a row in the SKAddinProvider table using the script given below: INSERT INTO [dbo].[SKAddInProviders] (Type,[Name],ClassName,Assembly) VALUES ('WebPart','<WebPartName>','<ClassName>','Bin\ProjectName.dll')

Navigate to Enterprise Console > Settings > Web Part Pages. Select any AVEVA Work Tasks home page.

Click the expand (+) icon of the Webparts Settings. The Webparts Settings pane expands.

In the Select Web Part list, select TimeZone.

In the Select Zone list, select Web Part Zone Left. Click Add Web Part. The TimeZone web part appears on the left zone of AVEVA Work Tasks home page.

Was this topic helpful?