コード例 #1
0
        public StepResult GetResult(Process process, string databaseName)
        {
            _process = process;
            var result     = new StepResult();
            var resultRows = new List <Row>();

            // if we have an input step then we need to get the rows from the input step and then
            // delete these particular rows
            if (HasInputStep)
            {
                var resultStep = InputStep.GetResult(_process, DatabaseName);
                var table      = _process.GetDatabase(DatabaseName).GetTable(TableName);
                foreach (var row in resultStep.Rows)
                {
                    table.RemoveRow(row.Id);
                }
                resultRows = resultStep.Rows;
            }
            else
            {
                // delete all rows in the table
                var table = _process.GetDatabase(DatabaseName).GetTable(TableName);
                var rows  = table.GetAllRows();
                table.RemoveAllRows();
                resultRows = rows;
            }

            result.Rows = resultRows;
            return(result);
        }
コード例 #2
0
    public StepResult GetResult(Process process, string databaseName)
    {
        var result = new StepResult();

        _process = process;
        var resultRows = new List <Row>();

        // if we have an input step then we need to get the rows from the input step and then
        // update those rows and save back to the database
        if (HasInputStep)
        {
            var resultStep = InputStep.GetResult(_process, DatabaseName);
            foreach (var row in resultStep.Rows)
            {
                foreach (var value in row.Values)
                {
                    if (value.ColumnName.ToUpper() == ColumnName.ToUpper())
                    {
                        value.Value = Value.Replace("'", string.Empty);
                    }
                }

                _process.GetDatabase(DatabaseName).GetTable(TableName).UpdateRow(row.ToReference(_process, TableName, DatabaseName), row.Values);
            }
            resultRows = resultStep.Rows;
        }
        else
        {
            var table = _process.GetDatabase(DatabaseName).GetTable(TableName);
            var rows  = table.GetAllRows();
            foreach (var row in rows)
            {
                foreach (var value in row.Values)
                {
                    if (value.ColumnName == ColumnName)
                    {
                        value.Value = Value;
                    }
                }

                table.UpdateRow(row.ToReference(_process, TableName, DatabaseName), row.Values);
            }

            resultRows = rows;
        }

        result.Rows = resultRows;
        return(result);
    }