internal static object GetVariableValue(VariableReference variableReference, DataRow input, DataTable dataTable) { if (variableReference.UseInput) { return(DDIHelper.ConvertDBNullToNull(input, variableReference.Variable)); } DDIHelper.CheckDataTableForSingleObject(dataTable); return(DDIHelper.ConvertDBNullToNull(dataTable.Rows[0], variableReference.Variable)); }
public override bool IsRunnable(DataRow input, DataTable dataTable, DataObjectStore store) { if (!base.IsRunnable(input, dataTable, store)) { return(false); } DDIHelper.CheckDataTableForSingleObject(dataTable); object variableValue = DDIHelper.GetVariableValue(store.ModifiedColumns, this.Collection, input, dataTable, store.IsGetListWorkflow); return(variableValue is IEnumerable <object> && (variableValue as IEnumerable <object>).Count <object>() > 0); }
internal static object GetVariableValue(ICollection <string> modifiedColumns, string variableName, DataRow input, DataTable dataTable, bool isGetListWorkflow) { if (modifiedColumns.Contains(variableName)) { object obj = DDIHelper.ConvertDBNullToNull(input, variableName); if (obj != null || isGetListWorkflow) { return(obj); } } DDIHelper.CheckDataTableForSingleObject(dataTable); return(DDIHelper.ConvertDBNullToNull(dataTable.Rows[0], variableName)); }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { DDIHelper.CheckDataTableForSingleObject(dataTable); DataRow dataRow = dataTable.Rows[0]; if (!(dataRow[base.IdentityVariable] is ADObjectId)) { throw new NotSupportedException("Currently we don't support Back-Link look up based on the UMC type Identity!"); } if (this.EnableFilter) { base.Command.AddParameter("Filter", string.Format("{0} -{1} '{2}'", this.LinkProperty, this.FilterOperator, DDIHelper.ToQuotationEscapedString(((ADObjectId)dataRow[base.IdentityVariable]).DistinguishedName))); } RunResult runResult = new RunResult(); PowerShellResults <PSObject> powerShellResults; base.ExecuteCmdlet(null, runResult, out powerShellResults, false); if (!runResult.ErrorOccur) { List <ADObjectId> list = new List <ADObjectId>(); foreach (PSObject psobject in powerShellResults.Output) { if (!this.EnableFilter) { ADObjectId adobjectId = (ADObjectId)psobject.Properties[this.LinkProperty].Value; if (adobjectId != null && adobjectId.Equals(dataRow[base.IdentityVariable])) { list.Add(psobject.Properties["Identity"].Value as ADObjectId); } } else { list.Add(psobject.Properties["Identity"].Value as ADObjectId); } } dataRow[this.OutputVariable] = list; } return(runResult); }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { DDIHelper.CheckDataTableForSingleObject(dataTable); DataRow dataRow = dataTable.Rows[0]; RunResult runResult = new RunResult(); IList <object> list = new List <object>(); IEnumerable <object> enumerable = DDIHelper.GetVariableValue(store.ModifiedColumns, this.Collection, input, dataTable, store.IsGetListWorkflow) as IEnumerable <object>; this.totalItems = enumerable.Count <object>(); this.executedItemCount = 0; foreach (object obj in enumerable) { dataRow[this.Item] = obj; if (this.Activity.IsRunnable(input, dataTable, store)) { RunResult runResult2 = this.Activity.RunCore(input, dataTable, store, codeBehind, updateTableDelegate); runResult.DataObjectes.AddRange(runResult2.DataObjectes); this.statusReport = this.statusReport.Concat(this.Activity.GetStatusReport(input, dataTable, store)).ToArray <PowerShellResults>(); if (runResult2.ErrorOccur) { list.Add(obj); if (base.ErrorBehavior == ErrorBehavior.Stop && this.Activity.ErrorBehavior == ErrorBehavior.Stop) { runResult.ErrorOccur = true; break; } } } this.executedItemCount++; } if (!string.IsNullOrEmpty(this.FailedCollection)) { dataRow[this.FailedCollection] = list; } return(runResult); }