本文整理汇总了C#中IExecutionContext.GetResult方法的典型用法代码示例。如果您正苦于以下问题:C# IExecutionContext.GetResult方法的具体用法?C# IExecutionContext.GetResult怎么用?C# IExecutionContext.GetResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExecutionContext
的用法示例。
在下文中一共展示了IExecutionContext.GetResult方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Do
public override CommandResult Do(IExecutionContext context)
{
string operand1 = (string)(context.GetResult(FirstOperandName));
string operand2 = (string)(context.GetResult(SecondOperandName));
bool result = Compare(operand1, operand2);
context.SaveResult(ResultName, result);
return CommandResult.Next;
}
示例2: Do
public override CommandResult Do(IExecutionContext context)
{
string absoluteInstanceName = context.GetStringFrom(InstanceName);
string absoluteSAPassword = context.GetStringFrom(SAPassword);
string cmdParameters = ARGUMENTS_EXE_STRING.
Replace("{INSTANCE}", absoluteInstanceName).
Replace("{PWD}", absoluteSAPassword).
Replace("{USER}", "\"" + DEFAULT_INSTANCE_ACCOUNT + "\"");
string intResultName = Guid.NewGuid().ToString("N");
ExecuteProgram exec = new ExecuteProgram()
{
Arguments = "/qb " + cmdParameters,
ProgramExePath = SetupFilePath,
WindowType = Gin.Util.ProgramWindowType.WinForms,
IntResultName = intResultName
};
exec.Do(context);
int intResult = (int)context.GetResult(intResultName);
context.SaveResult(ResultName, intResult);
return CommandResult.Next;
}
示例3: Do
public override CommandResult Do(IExecutionContext context)
{
string stringBaseKey = KeyFullPath.Split('\\')[0];
string stringKey = KeyFullPath.Substring(KeyFullPath.LastIndexOf('\\') + 1);
string stringRelativePath = KeyFullPath.Substring(KeyFullPath.IndexOf('\\') + 1);
stringRelativePath = stringRelativePath.Remove(stringRelativePath.LastIndexOf('\\'));
RegistryKey baseKey;
switch (stringBaseKey)
{
case "HKEY_CLASSES_ROOT":
baseKey = Registry.ClassesRoot;
break;
case "HKEY_CURRENT_USER":
baseKey = Registry.CurrentUser;
break;
case "HKEY_LOCAL_MACHINE":
baseKey = Registry.LocalMachine;
break;
case "HKEY_USERS":
baseKey = Registry.Users;
break;
case "HKEY_CURRENT_CONFIG":
baseKey = Registry.CurrentConfig;
break;
default:
baseKey = Registry.LocalMachine;
break;
}
RegistryKey key = baseKey.OpenSubKey(stringRelativePath);
key.SetValue(stringKey, context.GetResult(ValueName));
return CommandResult.Next;
}
示例4: Do
public override CommandResult Do(IExecutionContext context)
{
DataRow row = (DataRow)context.GetResult(DataRowName);
context.SaveResult(ResultName, row[FieldName]);
return CommandResult.Next;
}
示例5: Do
public override CommandResult Do(IExecutionContext context)
{
DataTable table = (DataTable)context.GetResult(TableName);
DataRow row = table.Rows[0];
context.SaveResult(ResultName, row);
return CommandResult.Next;
}
示例6: Do
public override CommandResult Do(IExecutionContext context)
{
object argument = context.GetResult(ArgumentName);
List<ParsedResult> list = GetObjectValueMembers(argument.GetType(), argument, ArgumentName);
foreach (var item in list)
{
context.SaveResult(ExecutionContext.GetPercentedKey(item.Name), item.Value);
}
return CommandResult.Next;
}
示例7: Do
public override CommandResult Do(IExecutionContext context)
{
if ((bool)context.GetResult(ArgumentName))
{
ExecuteCommandIfExist(Then, context);
}
else
{
ExecuteCommandIfExist(Else, context);
}
return CommandResult.Next;
}
示例8: Do
public override CommandResult Do(IExecutionContext context)
{
object absoluteObject = context.GetResult(ObjectName);
string tempPath = Path.Combine(context.TempPath, Guid.NewGuid().ToString("N") + ".dat");
if (absoluteObject is DataTable)
{
DataTable dataTable = (DataTable)absoluteObject;
dataTable.WriteXml(tempPath);
}
else
{
GinSerializer.Serialize(absoluteObject, tempPath);
}
string objectStringValue = IOUtil.ReadFile(tempPath);
File.Delete(tempPath);
context.Log.AddLogInformation(ObjectName + "=" + objectStringValue);
return CommandResult.Next;
}
示例9: Do
public override CommandResult Do(IExecutionContext context)
{
string absolutePackageFilePath = context.GetStringFrom(PackageFilePath);
string logFilePath = Path.Combine(context.ExecutedPackage.PackagePath, Guid.NewGuid().ToString("N") + ".log");
DTSExecutor executor = new DTSExecutor(absolutePackageFilePath, logFilePath, false);
executor.OnLogger += new LoggerEvent(context.Log.AddLogEvent);
executor.OnProgress += new ProgressEvent(
(percent)=>
{
context.Log.SendProgress(new ExecutionProgressInfo()
{
Message = "Выполнение DTS-пакета",
ModuleName = "CMExecuteDTS",
ProgressCost = 0
});
//CheckForPendingCancel(context);
});
foreach (DTSGlobalVariable param in Parameters)
{
object absoluteVariableValue = context.GetResult(param.VariableValue);
executor.SaveParameter(param.VariableName, absoluteVariableValue);
}
CancellingExecutor cnclexecutor = new CancellingExecutor(() =>
{
QueryCancelEventArgs args = new QueryCancelEventArgs();
context.Log.GetPendingCancel(args);
return args.Cancel;
});
cnclexecutor.Execute(() =>
{
executor.Execute();
});
return CommandResult.Next;
}
示例10: Do
public override CommandResult Do(IExecutionContext context)
{
context.Log.AddLogInformation("Вход в метод CMExecuteSQLQuery.Do(ExecutionContext)");
string absoluteConnectionString = context.GetStringFrom(ConnectionString);
context.Log.AddLogInformation("ConnectionString = '" + absoluteConnectionString + "'", new ConnectionStringFilter());
using (SqlConnection connection = new SqlConnection(absoluteConnectionString))
{
SqlCommand command;
if (ScriptFilePath == null)
{
command = new SqlCommand(CommandText, connection);
command.CommandType = CommandType;
}
else
{
string absoluteScriptFilePath = context.GetStringFrom(ScriptFilePath);
string commandText = IOUtil.ReadFile(absoluteScriptFilePath);
commandText = context.GetStringFrom(commandText);
command = new SqlCommand(commandText, connection);
command.CommandType = CommandType.Text;
}
if (CommandTimeout > 0)
{
command.CommandTimeout = CommandTimeout;
}
else
{
command.CommandTimeout = SQLConst.DEFAULT_SQL_COMMAND_TIMEOUT;
}
if (Parameters != null)
{
foreach (SqlParameterClass parameter in Parameters)
{
object value = context.GetResult(parameter.ValueName);
SqlParameter sqlParameter = new SqlParameter(parameter.ParameterName, parameter.Type);
sqlParameter.Direction = parameter.Direction;
sqlParameter.Value = value != null ? value : DBNull.Value;
if (parameter.Size > 0)
{
sqlParameter.Size = parameter.Size;
}
command.Parameters.Add(sqlParameter);
}
}
connection.Open();
DataSet dataSet = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataSet);
DataTable table = null;
if (dataSet.Tables.Count > 0)
{
table = dataSet.Tables[0];
}
context.SaveResult(ResultName, table);
}
return CommandResult.Next;
}
示例11: Subtract
private int Subtract(IExecutionContext context)
{
NumericOperand firstOperand = NumericOperand.Create(context.GetResult(FirstOperandName));
NumericOperand secondOperand = NumericOperand.Create(context.GetResult(SecondOperandName));
return (firstOperand - secondOperand);
}
示例12: InitRestoreParameters
private List<SqlParameterClass> InitRestoreParameters(IExecutionContext context, string resultSetCtxName)
{
List<SqlParameterClass> parameters = new List<SqlParameterClass>();
DataTable fileList = (DataTable)context.GetResult(resultSetCtxName);
var files = fileList.AsEnumerable();
var rows = files.AsEnumerable();
var rowDataFile = rows.FirstOrDefault(r => (string)r["Type"] == "D");
if (rowDataFile == null)
{
throw new Exception("Бэкап не содержит файла MDF базы данных");
}
var rowLogFile = rows.FirstOrDefault(r => (string)r["Type"] == "L");
if (rowLogFile == null)
{
throw new Exception("Бэкап не содержит файла LDF журнала транзакций");
}
string ldfFileLogicalName = (string)rowLogFile["LogicalName"];
string mdfFileLogicalName = (string)rowDataFile["LogicalName"];
string ldfFilePhysicalName = (string)rowLogFile["PhysicalName"];
string mdfFilePhysicalName = (string)rowDataFile["PhysicalName"];
if (DataBaseFullPath != null)
{
string mdfFileOnlyName = Path.GetFileName(mdfFilePhysicalName);
string ldfFileOnlyName = Path.GetFileName(ldfFilePhysicalName);
DataBaseFullPath = context.GetStringFrom(DataBaseFullPath);
mdfFilePhysicalName = Path.Combine(DataBaseFullPath, mdfFileOnlyName);
ldfFilePhysicalName = Path.Combine(DataBaseFullPath, ldfFileOnlyName);
}
SqlParameterClass p = context.AddSqlParameterToContext("BASENAME", DatabaseName, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
string absoluteSourcePath = context.GetStringFrom(BackupFilePath);
p = context.AddSqlParameterToContext("FULLNAME", absoluteSourcePath, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
p = context.AddSqlParameterToContext("MDFLOGICALNAME", mdfFileLogicalName, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
p = context.AddSqlParameterToContext("MDFFILEPATH", mdfFilePhysicalName, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
p = context.AddSqlParameterToContext("LDFLOGICALNAME", ldfFileLogicalName, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
p = context.AddSqlParameterToContext("LDFFILEPATH", ldfFilePhysicalName, SqlDbType.VarChar, 1024, ParameterDirection.Input);
parameters.Add(p);
return parameters;
}
示例13: Create
public override Control Create(IExecutionContext context)
{
object list = context.GetResult(ListDataName);
_control = new SimpleComboBoxEditor(Caption, list, DropDownOnly, DisplayMember, ValueMember, null, null, null);
return _control;
}