Ejemplo n.º 1
1
        public override void Execute(IProcessExecutionContext executionContext, IWorkSession session, ITransaction transaction, ISerializedParameters parameters)
        {
            try
            {
                if (!parameters.ContainsKey("ActionName"))
                {
                    throw new Exception("ContextRecordAction requires a parameter for ActionName");
                }

                var contextRecord = transaction.TransactionContext;
                var dataRecord    = transaction.DataRecord;

                var req = new OrganizationRequest(parameters["ActionName"]);
                req["Target"]      = new EntityReference(contextRecord.RecordType, contextRecord.Id);
                req["Transaction"] = transaction.ToEntityReference();
                req["DataRecord"]  = new EntityReference(dataRecord.RecordType, dataRecord.Id);

                //process any additional parameter data passed in from the configuration.
                if (parameters.Count > 1)
                {
                    foreach (var key in parameters.Keys)
                    {
                        if (key != "ActionName" && !string.IsNullOrEmpty(parameters[key]))
                        {
                            req[key] = parameters[key];
                        }
                    }
                }

                executionContext.DataService.ToOrgService().Execute(req);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
 public override void ValidateStepParameters(IProcessExecutionContext executionContext, ISerializedParameters parameters)
 {
     if (parameters.Count > 0)
     {
         throw new Exception("Branch Step does not support parameters");
     }
 }
 public override bool Rollback(IProcessExecutionContext executionContext, IWorkSession session, ITransaction transaction, ISerializedParameters parameters)
 {
     //No Action
     return(false);
 }
 public override void Execute(IProcessExecutionContext executionContext, IWorkSession session, ITransaction transaction, ISerializedParameters parameters)
 {
     //No Action
 }
Ejemplo n.º 5
0
 public override void ValidateStepParameters(IProcessExecutionContext executionContext, ISerializedParameters parameters)
 {
     if (!parameters.ContainsKey("ActionName") || string.IsNullOrEmpty(parameters["ActionName"]))
     {
         throw new Exception("ContextRecordAction requires a parameter for ActionName.");
     }
 }
Ejemplo n.º 6
0
 public override IUIPointer GetUIPointer(IProcessExecutionContext executionContext, ITransaction transaction, ISerializedParameters parameters)
 {
     return(null);
 }
Ejemplo n.º 7
0
        protected internal TransactionType(IRecordPointer <Guid> transactionTypeId, string name, int displayRank, ITransactionGroup group, IRecordPointer <Guid> startupProcessId, ISerializedParameters dataRecordType, IEnumerable <IRecordPointer <Guid> > authorizedChannels, IEnumerable <IRecordPointer <Guid> > authorizedRoles, IEnumerable <ITransactionProcess> processes, IEnumerable <IRequirement> requirements, IEnumerable <IRecordPointer <Guid> > initialFees, IEnumerable <ITransactionContextType> contexts)
            : base(transactionTypeId)
        {
            this.Name                      = name;
            this.DisplayRank               = displayRank;
            this.Group                     = group;
            this.StartUpProcessId          = startupProcessId;
            this.TransactionDataRecordType = dataRecordType ?? throw new ArgumentNullException("dataRecordType");;
            _authorizedChannels            = authorizedChannels != null?authorizedChannels.ToList() : throw new ArgumentNullException("authorizedChannel");

            _authorizedRoles = authorizedRoles != null?authorizedRoles.ToList() : throw new ArgumentNullException("authorizedRoles");

            _availableProcesses = processes != null?processes.ToList() : throw new ArgumentNullException("processes");

            _requirements = requirements != null?requirements.ToList() : throw new ArgumentNullException("requirements");

            _initialFeeSchedule = initialFees != null?initialFees.ToList() : throw new ArgumentNullException("initialFees");

            _eligibleContexts = contexts != null?contexts.ToList() : throw new ArgumentNullException("contexts");
        }
Ejemplo n.º 8
0
 public override void ValidateStepParameters(IProcessExecutionContext executionContext, ISerializedParameters parameters)
 {
     if (!parameters.ContainsKey("FormId") || string.IsNullOrEmpty(parameters["FormId"]))
     {
         throw new Exception("Entity Data Capture step requires parameter 'FormId'");
     }
 }
Ejemplo n.º 9
0
        public override IUIPointer GetUIPointer(IProcessExecutionContext executionContext, ITransaction transaction, ISerializedParameters parameters)
        {
            try
            {
                var dataRecord = transaction.DataRecord;
                executionContext.Trace("Creating UI Pointer for retrieved data record.");

                return(new UIPointer
                {
                    UIType = eUIStepTypeEnum.DataForm,
                    UIRecordType = dataRecord.RecordType,
                    UIRecordId = dataRecord.Id,
                    UIDefinition = parameters["FormId"]
                });
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex);
            }
        }