

public override DataTable Execute( string action, string argument)
{
try
{
// Create a record DataColumn list that will contain all the
// column DataColumns
List FieldColumnList = new List();
Column recFieldColumnOID = new Column("OID", typeof(System.String));
FieldColumnList.Add(recFieldColumnOID);
Column recFieldColumnName = new Column( "name", typeof(System.String) );
FieldColumnList.Add( recFieldColumnName );
Column recFieldColumnDryWeight = new Column( "Dry Weight", typeof(System.Double) );
FieldColumnList.Add(recFieldColumnDryWeight);
Column recFieldColumnTime = new Column( "Date Created", typeof(System.DateTime) );
FieldColumnList.Add( recFieldColumnTime );
Column recApprovalState = new Column( "Approval State", typeof(System.String) ) ;
FieldColumnList.Add( recApprovalState );
Column recFieldColumnDotNetLabel = new Column( "DotNetLabel", typeof(System.String) );
FieldColumnList.Add( recFieldColumnDotNetLabel );
// create and initialize the Data Table with the Columns ( user added
// columns and returned properties from the Delegated Query)
m_DataTable = InitializeDataTable( FieldColumnList );
// if the Evaluate property is set to true that means we need to
// return the data table with only columns names to the designer
// so that the control can display the column names at the design time
// The Query Builder calls the Execute with Evaluate set to true
if( EvaluateOnly )
{
return m_DataTable;
}
// loop through all the objects in the input objects
foreach ( BusinessObject oBO in InputObjects )
{
double dryWeightVal = 0.0;
// check if the Business Object supports the IJWeight.
if( oBO.SupportsInterface( "IJWeightCG" ) )
{
PropertyValueDouble dblWeight = ( PropertyValueDouble )oBO.GetPropertyValue( "IJWeightCG", "DryWeight" );
if ( null != dblWeight.PropValue )
{
dryWeightVal = (double)dblWeight.PropValue;
}
}
// data row to hold the data for current object
DataRow currentRow = m_DataTable.NewRow();
currentRow.SetField("OID", oBO.ObjectID.ToString());
currentRow.SetField("name", oBO.ToString());
currentRow.SetField("Dry Weight", dryWeightVal);
// Removed *time* portion of date created since it is highly dependent on
// the local time zone and will therefore not match the baseline for other zones.
currentRow.SetField("Date Created", oBO.DateCreated.Date);
currentRow.SetField("Approval State", oBO.ApprovalStatus.ToString());
currentRow.SetField("DotNetLabel", "[Equipment Properties]");
// Execute the Delegated Query.
System.Data.DataTable DelegatedDataTable = ExecuteDelegatedQuery(oBO);
// add the new row with the value to the record set
if ( DelegatedDataTable != null )
{
if ( DelegatedDataTable.Rows.Count >= 1 )
{
DataRow row = DelegatedDataTable.Rows[0];
// merge the column value pair to data table, excluding the oid column
foreach ( DataColumn col in row.Table.Columns )
{
if (col.ColumnName.ToLower() != "oid")
{
currentRow.SetField(col.ColumnName, row[col.ColumnName]);
}
}
}
}
// add the new row to the master data table
m_DataTable.Rows.Add(currentRow);
}
return m_DataTable;
}
catch ( Exception e )
{
MiddleServiceProvider.ErrorLogger.Log(0, typeof(ExampleQueryInterpreter).FullName, e.ToString(), string.Empty, (new StackTrace()).GetFrame(1).GetMethod().Name, string.Empty, string.Empty, -1);
throw;
}
}
}
相关阅读:
Intergraph Smart® 3D自定义命令部署方式及自定义工具条开发简述

您需要登录 或注册 后才可以发表评论。