/// <inheritdoc/> public override string GetExecutionData() { var page = ClientUnitSchemaManager.GetItemByUId(ClientUnitSchemaUId); var processSchema = (ProcessSchema)Owner.Schema; bool isInheritedFromTemplate = ClientUnitSchemaManager.IsInheritedFrom(ClientUnitSchemaUId, Template); string recommendation = LocalizableString.IsNullOrEmpty(Recommendation) ? GetParameterValue("Recommendation")?.ToString() ?? string.Empty : Recommendation.Value; string informationOnStep = LocalizableString.IsNullOrEmpty(InformationOnStep) ? GetParameterValue("InformationOnStep")?.ToString() ?? string.Empty : InformationOnStep.Value; var executionData = new { procElUId = UId, name = Name, processId = Utilities.GetParentProcessId(Owner), isProcessExecutedBySignal = Utilities.GetIsProcessExecutedBySignal(Owner), processName = Owner.Name, header = Title.Value, recommendation, informationOnStep, pageCaption = page.Caption.ToString(), nextProcElUId = "nextProcElUIdValue", urlToken = GetUrlToken(page.Name), recordId = EntityId, parameters = GetPageParameters(processSchema, isInheritedFromTemplate), attributes = isInheritedFromTemplate ? GetAttributes() : null, preconfiguredPage = true, action = Action }; string jsonData = JsonConvert.SerializeObject(executionData, Formatting.None, GetSerializeJsonSettings()); jsonData = GetUserContextExecutionData(jsonData); return(jsonData); }
public string GetExecutionData(EmailTemplateUserTask userTask) { string informationOnStep = LocalizableString.IsNullOrEmpty(userTask.InformationOnStep) ? userTask.GetParameterValue("InformationOnStep")?.ToString() ?? string.Empty : userTask.InformationOnStep.Value; string allowedActivityResults = ProcessUserTaskUtilities.GetAllowedActivityResults(UserConnection, userTask.ActivityId); Guid parentProcessId = ProcessUserTaskUtilities.GetParentProcessId(userTask.Owner); return (ServiceStackTextHelper.Serialize( new { procElUId = userTask.UId, name = userTask.Name, processId = parentProcessId, isProcessExecutedBySignal = userTask.Owner.IsProcessExecutedBySignal, processName = userTask.Owner.Name, entitySchemaName = "Activity", recommendation = GetActivityTitle(userTask), informationOnStep, pageTypeId = ActivityConsts.EmailTypeUId, activityRecordId = userTask.ActivityId, executionContext = userTask.ExecutionContext, nextProcElUId = "nextProcElUIdValue", allowedResults = allowedActivityResults })); }
public override string GetExecutionData() { LocalizableParameterValuesList decisionOptionItems = null; if (BranchingDecisions.Value.IsNotNullOrEmpty()) { Process process = Owner; ProcessSchema processSchema = process.ProcessSchema; string resourceManagerName = processSchema.OwnerSchema == null ? processSchema.GetResourceManagerName() : processSchema.OwnerSchema.GetResourceManagerName(); var element = processSchema.GetBaseElementByUId(SchemaElementUId); var resourceItemName = "BaseElements." + element.Name + ".Parameters.BranchingDecisions.Value"; var localizableString = new LocalizableString(Storage, resourceManagerName, resourceItemName); string value = localizableString.Value; if (value.IsNotNullOrEmpty()) { decisionOptionItems = LocalizableParameterValuesList.DeserializeFrom77FormatData(value, "Caption"); } else { decisionOptionItems = LocalizableParameterValuesList.DeserializeData(BranchingDecisions.Value); decisionOptionItems.SetupDefaultLocalizableValues("Caption", NoCaptionLocalizableString.Value); } } string informationOnStep = LocalizableString.IsNullOrEmpty(InformationOnStep) ? GetParameterValue("InformationOnStep")?.ToString() ?? string.Empty : InformationOnStep.Value; string executionData = SerializeToString(new { procElUId = UId, name = Name, processId = ProcessUserTaskUtilities.GetParentProcessId(Owner), isProcessExecutedBySignal = ProcessUserTaskUtilities.GetIsProcessExecutedBySignal(Owner), processName = Owner.Name, urlToken = "ProcessCardModuleV2/UserQuestionProcessPageV2", recommendation = GetActivityTitle(), informationOnStep, activityRecordId = CurrentActivityId, questionText = Question.ToString(), decisionMode = DecisionMode, isDecisionRequired = IsDecisionRequired, decisionOptions = decisionOptionItems?.To77FormatList(), executionContext = ExecutionContext, nextProcElUId = "nextProcElUIdValue" }); string userContextData = ProcessLane?.GetUserContextData(); if (!string.IsNullOrEmpty(userContextData)) { var sb = new StringBuilder(executionData); sb.Length--; sb.Append(","); sb.Append(userContextData); sb.Append("}"); executionData = sb.ToString(); } return(executionData); }
protected string GetEmailSubject() { var subject = string.Empty; if (!LocalizableString.IsNullOrEmpty(EmailUserTask.Subject)) { subject = EmailUserTask.Subject; } return(subject); }
private static LocalizableString GetSchemaElementCaption(ProcessActivity processElement) { BaseProcessSchemaElement schemaElement = processElement.GetSchemaElement(); LocalizableString schemaElementCaption = schemaElement.Caption; return(LocalizableString.IsNullOrEmpty(schemaElementCaption) ? new LocalizableString("Terrasoft.Core", string.Concat("ProcessSchema", processElement.Schema.Name, ".Caption")) : schemaElementCaption); }
/// <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" })); }
private string GetDefaultEmailSubject() { string subject = String.Empty; var processSchema = EmailUserTask.Owner.Schema as ProcessSchema; if (processSchema != null) { var schemaElementCaption = processSchema.GetBaseElementByUId(EmailUserTask.SchemaElementUId).Caption; if (!LocalizableString.IsNullOrEmpty(schemaElementCaption)) { subject = schemaElementCaption; } } if (string.IsNullOrEmpty(subject)) { string resourceItemName = "LocalizableStrings.DefaultEmailSubject.Value"; subject = new LocalizableString(UserConnection.ResourceStorage, "EmailTemplateUserTaskMessageProvider", resourceItemName); } return(subject); }
/// <summary> /// Returns title of the activity. /// </summary> /// <param name="processElement">Process element.</param> /// <param name="recommendation">Text of the recommendation.</param> /// <param name="currentActivityId">Identifier of the current activity.</param> /// <returns></returns> public static string GetActivityTitle(ProcessActivity processElement, LocalizableString recommendation, Guid currentActivityId) { if (processElement.IsExecuted) { var select = (Select) new Select(processElement.UserConnection) .Column("Title") .From("Activity").WithHints(Hints.NoLock) .Where("Id").IsEqual(Column.Parameter(currentActivityId)); return(select.ExecuteScalar <string>()); } LocalizableString titleValue = null; if (!LocalizableString.IsNullOrEmpty(recommendation)) { titleValue = recommendation; } return((titleValue ?? GetSchemaElementCaption(processElement)) .Value?.Truncate(500)); }