예제 #1
0
        protected override void ExecuteAction(Context context, Step step)
        {
            string first = step.GetParameterValue<string>("String", 1);
            string second = step.GetParameterValue<string>("String", 2);

            ServiceAgent.Currency from = (ServiceAgent.Currency)Enum.Parse(typeof(ServiceAgent.Currency), first, true);
            ServiceAgent.Currency to = (ServiceAgent.Currency)Enum.Parse(typeof(ServiceAgent.Currency), second, true);

            ConfigurationChannelFactory<ServiceAgent.CurrencyConvertorSoap> channelFactory = null;
            double rate;
            try
            {
                channelFactory = new ConfigurationChannelFactory<ServiceAgent.CurrencyConvertorSoap>("CurrencyConvertorSoap", conf.Configuration, null);
                var client = channelFactory.CreateChannel();
                rate = client.ConversionRate(from, to);
            }
            catch (Exception)
            {
                rate = double.NaN;
            }
            finally
            {
                if (channelFactory != null)
                    channelFactory.Close();
            }

            context.AddPublishedItem("Number", step.Id, rate);
        }
        protected override void ExecuteAction(Context context, Step step)
        {
            Action<IDataReader> action = step.GetParameterValue<Action<IDataReader>>("Row Action");
            string connString = step.GetParameterValue<string>("Connection String");
            Query query = step.GetParameterValue<Query>("Query Definition");

            var parameters = query.Parameters == null ? null : query.Parameters.ToSqlParameterArray();

            var dal = new DataAccess(connString);
            dal.ForEachRow(action, query.Sql, query.Type, parameters);
        }
예제 #3
0
        protected override void ExecuteAction(Context context, Step step)
        {
            IExecutable action = step.GetParameterValue<IExecutable>("Configuration Info");
            Logger.DebugFormat("action = {0}", action.GetType().Name);
            string queryName = step.GetParameterValue<string>("String");
            Logger.DebugFormat("query name = {0}", queryName);

            var conf = new ConfigurationHelper(new ConfigurationManagerWrapper(action.GetType()));

            var query = conf.GetSection<Query>(queryName);
            Logger.DebugFormat("query retrieved = {0}", query.ToXml());

            context.AddPublishedItem(new Public("Query Definition"), step.Id, query);
        }
예제 #4
0
        protected override void ExecuteAction(Context context, Step step)
        {
            const string number = "Number";
            const string integer = "Integer";

            double first = step.GetParameterValue<int>(integer, 100);
            double second = step.GetParameterValue<int>(integer, 200);

            context.AddPublishedItem(number, 4, step.Id, second == 0.0 ? double.NaN : first / second);
            context.AddPublishedItem(number, 5, step.Id, second == 0.0 ? double.NaN : first % second);
            context.AddPublishedItem(number, 1, step.Id, first + second);
            context.AddPublishedItem(number, 2, step.Id, first - second);
            context.AddPublishedItem(number, 3, step.Id, first * second);
        }
 protected override void ExecuteAction(Context context, Step step)
 {
     string name = step.GetParameterValue<string>("String");
     Logger.DebugFormat("connection string name = {0}", name);
     string returnValue = conf.ConnectionString(name);
     Logger.DebugFormat("connection string retrieved = {0}", returnValue);
     context.AddPublishedItem(new Public("Connection String"), step.Id, returnValue);
 }
        protected override void ExecuteAction(Context context, Step step)
        {
            string cs = step.GetParameterValue<string>("Connection String");
            if (string.IsNullOrEmpty(cs))
                throw new ExecutionInterruptedException("cs is null");

            var builder = new SqlConnectionStringBuilder(cs);
            context.AddPublishedItem("Connection String Parts", step.Id, builder);
        }
        protected override void ExecuteAction(Context context, Step step)
        {
            var builder = step.GetParameterValue<SqlConnectionStringBuilder>("Connection String Parts");
            if (builder == null)
                throw new ExecutionInterruptedException("builder is null");

            string user = builder.IntegratedSecurity ? "<current>" :
                          string.IsNullOrEmpty(builder.UserID) ? "<empty>" : builder.UserID;
            string question = string.Format("Connect to server {0}, database {1} as {2} ?",
                                            builder.DataSource, builder.InitialCatalog, user);
            context.AddPublishedItem("String", step.Id, question);
        }
예제 #8
0
 protected override void ExecuteAction(Context context, Step step)
 {
     string str = step.GetParameterValue<string>("String");
     if (!Common.UIHelper.Confirm(str))
         throw new ExecutionInterruptedException("Stopped by the user");
 }
예제 #9
0
 protected override void ExecuteAction(Context context, Step step)
 {
     Common.UIHelper.DisplayMessage(step.GetParameterValue<string>("String"));
 }
예제 #10
0
 protected override void ExecuteAction(Context context, Step step)
 {
     double number = step.GetParameterValue<double>("Number");
     context.AddPublishedItem("String", step.Id, string.Format("Result = {0:G}", number));
 }
예제 #11
0
 protected override void ExecuteAction(Context context, Step step)
 {
     string actual = step.GetParameterValue<string>("something");
     if (actual != "test string")
         throw new ExecutionInterruptedException();
 }