コード例 #1
0
        /// <summary>
        /// Gets entity key.
        /// </summary>
        /// <param name="entity">Entity.</param>
        /// <returns>Entity key.</returns>
        private string GetEntityKey(Entity entity, IEnumerable <string> columnsNames)
        {
            StringBuilder sb = new StringBuilder();
            EntitySchemaColumnCollection schemaColumns = entity.Schema.Columns;

            foreach (string columnName in columnsNames)
            {
                EntitySchemaColumn schemaColumn = schemaColumns.GetByName(columnName);
                object             columnValue  = entity.GetColumnValue(schemaColumn);
                sb.Append(columnValue);
            }
            return(sb.ToString());
        }
        /// <inheritdoc />
        public override string GetExecutionData()
        {
            CoreEntitySchema entitySchema = UserConnection.EntitySchemaManager.GetInstanceByUId(ObjectSchemaId);
            var defaultColumnValues       = new Dictionary <string, object>();

            foreach (var columnValue in RecordColumnValues.Values)
            {
                var column = entitySchema.GetSchemaColumnByMetaPath(columnValue.Key);
                if ((column.DataValueType is LookupDataValueType || column.DataValueType is MultiLookupDataValueType) &&
                    ((Guid)columnValue.Value).IsEmpty())
                {
                    continue;
                }
                defaultColumnValues[column.Name] = SerializeEntityColumn(column, columnValue.Value);
            }
            var editMode = (RecordEditMode)Enum.ToObject(typeof(RecordEditMode), EditMode);

            if (editMode == RecordEditMode.New)
            {
                EntitySchemaColumnCollection columns = entitySchema.Columns;
                defaultColumnValues["ProcessListeners"] =
                    SerializeEntityColumn(columns.GetByName("ProcessListeners"), (int)EntityChangeType.Inserted);
            }
            string actionName        = GetActionName();
            string informationOnStep = LocalizableString.IsNullOrEmpty(InformationOnStep)
                                ? GetParameterValue("InformationOnStep")?.ToString() ?? string.Empty
                                : InformationOnStep.Value;

            return(SerializeToString(new {
                processId = ProcessUserTaskUtilities.GetParentProcessId(Owner),
                procElUId = UId,
                name = Name,
                isProcessExecutedBySignal = ProcessUserTaskUtilities.GetIsProcessExecutedBySignal(Owner),
                processName = Owner.Name,
                action = actionName,
                entitySchemaName = entitySchema.Name,
                recordId = RecordId,
                activityRecordId = CurrentActivityId,
                recommendation = GetActivityTitle(),
                informationOnStep,
                defaultValues = defaultColumnValues.Count > 0 ? defaultColumnValues : null,
                executionContext = ExecutionContext,
                completeExecution = actionName == "add",
                pageTypeId = PageTypeUId == Guid.Empty ? string.Empty : PageTypeUId.ToString(),
                nextProcElUId = "nextProcElUIdValue"
            }));
        }