/// <summary> /// Handles the specified command. /// </summary> /// <param name="command">The command.</param> public void Handle(SetJobLastKnownEventCommand <IDbConnection, IDbTransaction> command) { using (var commandSql = command.Connection.CreateCommand()) { commandSql.Transaction = commandSql.Transaction; commandSql.CommandText = _commandCache.GetCommand(CommandStringTypes.SetJobLastKnownEvent); var param = commandSql.CreateParameter(); param.ParameterName = "@JobName"; param.DbType = DbType.AnsiString; param.Value = command.JobName; commandSql.Parameters.Add(param); param = commandSql.CreateParameter(); param.ParameterName = "@JobEventTime"; param.DbType = DbType.AnsiString; param.Value = command.JobEventTime.ToString(CultureInfo.InvariantCulture); commandSql.Parameters.Add(param); param = commandSql.CreateParameter(); param.ParameterName = "@JobScheduledTime"; param.DbType = DbType.AnsiString; param.Value = command.JobScheduledTime.ToString(CultureInfo.InvariantCulture); commandSql.Parameters.Add(param); commandSql.ExecuteNonQuery(); } }
/// <summary> /// Handles the specified command. /// </summary> /// <param name="command">The command.</param> public void Handle(SetJobLastKnownEventCommand <SqlConnection, SqlTransaction> command) { using (var conn = new SqlConnection(_connectionInformation.ConnectionString)) { conn.Open(); using (var commandSql = conn.CreateCommand()) { commandSql.CommandText = _commandCache.GetCommand(CommandStringTypes.SetJobLastKnownEvent); commandSql.Parameters.Add("@JobName", SqlDbType.VarChar); commandSql.Parameters["@JobName"].Value = command.JobName; commandSql.Parameters.Add("@JobEventTime", SqlDbType.DateTimeOffset); commandSql.Parameters["@JobEventTime"].Value = command.JobEventTime; commandSql.Parameters.Add("@JobScheduledTime", SqlDbType.DateTimeOffset); commandSql.Parameters["@JobScheduledTime"].Value = command.JobScheduledTime; commandSql.ExecuteNonQuery(); } } }