Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            DynamicValue taskdata = context.GetValue(this.Data);

            DynamicValue MessageId = new DynamicValue();

            taskdata.TryGetValue("MessageId", out MessageId);

            IMessageStore messageStore = strICT.InFlow.Db.StoreHandler.getMessageStore(context.GetValue(cfgSQLConnectionString));
            M_Message     message      = messageStore.getMessageBymsgId(Convert.ToInt32(MessageId.ToString()));

            //store message-type in GlobalTransition
            context.SetValue(GlobalTransition, message.Sender_SubjectName + "|" + message.Message_Type);


            DynamicValue data      = DynamicValue.Parse(message.Data);
            DynamicValue variables = context.GetValue(GlobalVariables);

            //write message data to GlobalVariables
            foreach (string i in data.Keys)
            {
                DynamicValue value = new DynamicValue();
                data.TryGetValue(i, out value);
                if (variables.ContainsKey(i))
                {
                    variables.Remove(i);
                }
                variables.Add(i, value);
            }
            context.SetValue(GlobalVariables, variables);

            //mark message in message-store as received
            messageStore.markMessageAsReceived(message.Id);
        }
        private void EvaluateDynamicvaluePath()
        {
            try
            {
                var dv  = DynamicValue.Parse(txtWebPayload.Text);
                var act = new EvaluateDynamicValuePath
                {
                    Input = new LambdaValue <DynamicValue>(c => dv),
                    Path  = txtPath.Text
                };

                var result = WorkflowInvoker.Invoke(act);

                txtResults.Text = result.Count == 0 ? "< No Results >" : result.ToString();
            }
            catch (Exception ex)
            {
                txtResults.Text = string.Format("ERROR\r\n{0}", ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Set taskanswer for a send-state task
        /// </summary>
        /// <param name="taskId">Id of the task</param>
        /// <param name="recipientName">choosen recipient/s</param>
        /// <param name="editableParameters">edited parameters</param>
        public void submitSendTaskAnswer(int taskId, string recipientName, string editableParameters, string username)
        {
            IProcessStore processStore = StoreHandler.getProcessStore(connectionString);
            ITaskStore    taskStore    = StoreHandler.getTaskStore(connectionString);

            T_Task openTask = taskStore.getTaskById(taskId);

            //check if task isn't already answered
            if (openTask.Done == false && openTask.Type.Equals("S"))
            {
                P_ProcessSubject processSubject = processStore.getProcessSubjectForWFId(openTask.WFId);
                P_Process        process        = processStore.getProcess(processSubject.Process_Id);

                DynamicValue val = DynamicValue.Parse(editableParameters);
                val.Add("recipient", new DynamicValue(recipientName));

                submitTaskAnswer(val, process, openTask);

                //set task as answered
                //taskStore.setTaskStatus(taskId, true);
                taskStore.setTaskStatus(taskId, username, editableParameters, recipientName);
            }
        }