protected override void Execute(NativeActivityContext context) { try { dtable = DataTableObject.Get(context); string lstResult = string.Empty; rowcount = 0; // activitycount = Activities.Count - 1; activitycount = 0; DataRow dataRow = dtable.Rows[rowcount]; CurrentDataRow.Set(context, dataRow); lstResult = Convert.ToString(dataRow[ColumnNumber]); ListResult.Set(context, lstResult); var itemInner = Activities[activitycount]; context.ScheduleActivity(itemInner, onCompleted); } catch (Exception ex) { Logger.Log.Logger.LogData(ex.Message + " in activity DataTableForEach", Logger.LogLevel.Error); if (!ContinueOnError) { context.Abort(); } } }
private void onCompleted(NativeActivityContext context, ActivityInstance completedInstance) { try { activitycount = activitycount + 1; if (MoveNextRow) { MoveNextRow = false; rowcount = rowcount + 1; if (dtable.Rows.Count <= rowcount) { return; } else { DataRow dataRow = dtable.Rows[rowcount]; CurrentDataRow.Set(context, dataRow); lstResult = Convert.ToString(dataRow[ColumnNumber]); ListResult.Set(context, lstResult); //activitycount = Activities.Count; activitycount = 0; } } // rowcount =rowcount++; if (activitycount >= Activities.Count) { MoveNextRow = true; onCompleted(context, completedInstance); return; } if (activitycount == Activities.Count - 1) { MoveNextRow = true; } var itemInner = Activities[activitycount]; context.ScheduleActivity(itemInner, onCompleted); }catch (Exception ex) { Logger.Log.Logger.LogData(ex.Message, LogLevel.Error); } }
protected override void Execute(NativeActivityContext context) { try { int colNumber = 0; if (ColumnNumber != null) { colNumber = ColumnNumber.Get(context); } DataRow dataRow = CurrentDataRow.Get(context); dynamic currentValue = CurrentRowColumnValue.Get(context); dataRow[colNumber] = currentValue; } catch (Exception ex) { Logger.Log.Logger.LogData(ex.Message + " in activity DataTableSetCurrentRowCellValue", Logger.LogLevel.Error); if (!ContinueOnError) { context.Abort(); } } }
public override void update() { CswNbtMetaDataObjectClass FireExtinguisherOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( "FireExtinguisherClass" ); if (null != FireExtinguisherOC) { /* Remove the remaining object class props */ IEnumerable<CswNbtMetaDataObjectClassProp> FireExtinguisherOCProps = FireExtinguisherOC.getObjectClassProps(); foreach (CswNbtMetaDataObjectClassProp FireExtinguisherOCP in FireExtinguisherOCProps) { // Remove any rows from jct_nodes_props CswTableUpdate JctNodesPropsTU = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("removeRowsAssocWithFireExtOCP_28277", "jct_nodes_props"); DataTable JctNodesPropsDt = JctNodesPropsTU.getTable("where objectclasspropid = " + FireExtinguisherOCP.PropId); foreach (DataRow CurrentDataRow in JctNodesPropsDt.Rows) { CurrentDataRow.Delete(); } JctNodesPropsTU.update(JctNodesPropsDt); // Delete the OCP _CswNbtSchemaModTrnsctn.MetaData.DeleteObjectClassProp(FireExtinguisherOCP, true); } /* Remove any rows from jct_modules_objectclass */ _CswNbtSchemaModTrnsctn.deleteAllModuleObjectClassJunctions(FireExtinguisherOC); } /* Remove the FireExtinguisherClass from object_class */ CswTableUpdate ObjectClassTU = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "removeFireExtinguisherOC_28277", "object_class" ); DataTable ObjectClassDt = ObjectClassTU.getTable( "where objectclass = 'FireExtinguisherClass'" ); if( 1 == ObjectClassDt.Rows.Count ) // we should only get one row { ObjectClassDt.Rows[0].Delete(); } ObjectClassTU.update( ObjectClassDt ); } //Update()