Exemple #1
0
 public HangfireLogger(int Id, int RequestInfoCode, string TaskId, string Parent, string TaskType, TaskStatusCode TaskStatus, string RequestTime, string ExecutionTime)
 {
     this.Id = Id;
     this.RequestInfoCode = RequestInfoCode;
     this.TaskId          = TaskId;
     this.Parent          = Parent;
     this.TaskType        = TaskType;
     this.TaskStatus      = TaskStatus;
     this.RequestTime     = RequestTime;
     this.ExecutionTime   = ExecutionTime;
 }
Exemple #2
0
        /// <summary>
        /// Creates an XML proxy from the object.
        /// </summary>
        /// <param name="idPrefix">A prefix to be appended to the IDs of any child XML elements that
        /// require an ID. For certain XML elements, the schema requires an ID that is unique within
        /// the XML document. Instead of generating random IDs, these are systematic and hierarchical
        /// in this software. To ensure uniqueness, each ID prefix can occur only once. The ID is of
        /// type xsd:id. This derives from xsd:NCName, so not all characters are allowed.</param>
        /// <returns>Proxy.</returns>
        public XsdNs.StatusReportType ToXmlProxy(string idPrefix)
        {
            var proxy = new XsdNs.StatusReportType()
            {
                // #1 in XML schema: task
                task = TaskId,

                // #3 in XML schema: event (not implemented)

                // #5 in XML schema: procedure
                procedure = ProcedureId,

                // #6 in XML schema: requestStatus
                requestStatus = RequestStatus.ToString(),

                // #9 in XML schema: updateTime
                updateTime = UpdateTime

                             // #10 in XML schema: alternative (not implemented)
            };

            // #2 in XML schema: estimatedToC
            // Assign if defined
            if (EstimatedTimeOfCompletion.HasValue)
            {
                // UTC not expected because already supposedly checked in the setter, but check just in case
                XNeut.Helper.ExpectDateTimeIsUtc(EstimatedTimeOfCompletion.Value); // throws DateTimeException
                proxy.estimatedToC = EstimatedTimeOfCompletion.Value;
            }
            proxy.estimatedToCSpecified = EstimatedTimeOfCompletion.HasValue;

            // #4 in XML schema: percentCompletion
            if (PercentCompletion.HasValue)
            {
                proxy.percentCompletion = PercentCompletion.Value;
            }
            proxy.percentCompletionSpecified = PercentCompletion.HasValue;

            // #7 in XML schema: statusMessage
            if (StatusMessages != null && StatusMessages.Count > 0)
            {
                proxy.statusMessage = new XsdNs.LanguageStringType[StatusMessages.Count];

                for (int a = 0; a < StatusMessages.Count; ++a)
                {
                    proxy.statusMessage[a] = new XsdNs.LanguageStringType
                    {
                        Value = StatusMessages[a]
                    };
                }
            }

            // Assign status code only if known
            // #8 in XML schema: taskStatus
            if (TaskStatusCode != TaskStatusCodeType.Unknown)
            {
                proxy.taskStatus = TaskStatusCode.ToString();
            }

            // Assign tasking parameters if defined
            // #11 in XML schema: taskingParameters
            if (TaskingParameters.ItemNames.Count > 0)
            {
                var paramsProc = new TaskingParameterProcessor(TaskingParameters);

                proxy.taskingParameters = new XsdNs.ParameterDataPropertyType()
                {
                    ParameterData = paramsProc.ToXmlProxy(idPrefix + "TaskPar-")
                };
            }

            return(proxy);
        }