示例#1
0
        /// <summary>
        /// Executes the specified parent result.
        /// </summary>
        /// <param name="parentResult">
        /// The parent result.
        /// </param>
        /// <returns>
        /// The <see cref="GenericRecordSet"/>.
        /// </returns>
        public GenericRecordSet Execute(GenericRecordSet parentResult)
        {
            int i, count;

            count = parentResult.GetRowCount();

            this.SetLinkRecord(this.parent.InfoAreaId, "#parameterposition#", this.RootTreeItem.LinkId);

            var context = new StatementCreationContext(this);

            if (!string.IsNullOrEmpty(context.ErrorText))
            {
                // _crmDatabase.Trace(_crmDatabase, context.GetErrorText());
                return(null);
            }

            var statementString = this.CreateStatement(context, false);
            var parameters      = context.ParameterValues;
            var parameterCount  = parameters.Count;

            var parameterPos = 0;

            for (i = 0; i < parameterCount; i++)
            {
                if (parameters[i] != "#parameterposition#")
                {
                    continue;
                }

                parameterPos = i;
                break;
            }

            var query = new DatabaseQuery(this.crmDatabase);
            var ret   = query.Prepare(statementString);

            if (!ret)
            {
                return(null);
            }

            i = 0;
            while (i < count)
            {
                var currentRow      = parentResult.GetRow(i);
                var currentRecordId = currentRow.GetColumn(this.recordIdPos);
                if (string.IsNullOrEmpty(currentRecordId))
                {
                }
                else
                {
                    query.Reset();
                    parameters[parameterPos] = currentRecordId;
                    ret = query.Execute(parameters) == 0;
                    if (ret)
                    {
                        return(null);
                    }

                    var frs = new DatabaseRecordSet(query);

                    // TODO: Complete the implementation
                }

                i++;
            }

            return(null);
        }