Esempio n. 1
0
        internal static bool TryReadFromPayloadReference(PayloadReference payloadReference, out Guid jobRunId, out int taskId, out PayloadLevel payloadLevel)
        {
            jobRunId     = Guid.Empty;
            taskId       = -1;
            payloadLevel = PayloadLevel.Job;
            bool result;

            try
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                PayloadIdentifier    payloadIdentifier    = javaScriptSerializer.Deserialize <PayloadIdentifier>(payloadReference.PayloadId);
                jobRunId = payloadIdentifier.JobRunId;
                if (payloadIdentifier.TaskId > -1)
                {
                    taskId       = payloadIdentifier.TaskId;
                    payloadLevel = PayloadLevel.Task;
                }
                else
                {
                    payloadLevel = PayloadLevel.Job;
                }
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }
Esempio n. 2
0
        internal static PayloadReference GetPayloadReference(Guid jobRunId, int taskId = -1)
        {
            PayloadIdentifier payloadIdentifier = new PayloadIdentifier
            {
                JobRunId = jobRunId,
                TaskId   = taskId
            };
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            return(new PayloadReference
            {
                PayloadId = javaScriptSerializer.Serialize(payloadIdentifier)
            });
        }