コード例 #1
0
        protected override async Task <TerminateProcessResponse> OnTerminateByProcessNoStatusingAsync(int processId, ops.Person terminatingUser, CancellationToken cancellationToken, IDictionary <object, object> context)
        {
            try
            {
                NetworkIdentification1 terminateUser = new NetworkIdentification1
                {
                    Domain    = terminatingUser.Network.Domain,
                    NetworkId = terminatingUser.Network.Username
                };

                Binding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
                {
                    SendTimeout    = new TimeSpan(0, 5, 0),
                    ReceiveTimeout = new TimeSpan(0, 5, 0)
                };

                ChannelFactory <RoutingSoap> factory = new ChannelFactory <RoutingSoap>(binding, new EndpointAddress(_client.BaseAddress));
                RoutingSoap serviceProxy             = factory.CreateChannel();

                TerminationResponse result = await serviceProxy.TerminateByProcessNoStatusingAsync(processId, terminateUser);

                factory.Close();

                TerminateProcessResponse terminateProcessResponse = new TerminateProcessResponse()
                {
                    ProcessId = processId,
                    ResultId  = result.ResultId,
                    Status    = result.Status.ToUpper()
                };

                return(terminateProcessResponse);
            }
            catch (Exception exception)
            {
                _logger.LogError($"A web service error occurred while terminating the process with id: {processId}. Reason: {exception}");
                throw;
            }
        }
コード例 #2
0
        private static InstantiateProcessRequest CreateInstProcessRequest(RoutingItem routingItem, PersonIdentification submitterIds, PersonIdentification originatorIds, PersonIdentification beneficiaryIds)
        {
            NetworkIdentification1 instantiateUser = new NetworkIdentification1
            {
                Domain    = submitterIds.Domain,
                NetworkId = submitterIds.NetworkId
            };

            InstantiateProcessRequest process = new InstantiateProcessRequest
            {
                InstantiateUser = instantiateUser
            };

            RoutingPayload pay = new RoutingPayload
            {
                MetaData = new DocMetaData()
            };

            pay.MetaData.ApplicationIRI    = (int)routingItem.ApplicationItemId;
            pay.MetaData.DocumentTypeName  = routingItem.DocumentTypeName;
            pay.MetaData.DocumentAtAGlance = routingItem.DocumentTitle;

            pay.MetaData.DocumentId = routingItem.DocumentId;

            pay.MetaData.DocumentOriginator = new NetworkIdentification
            {
                Domain    = originatorIds.Domain,
                NetworkId = originatorIds.NetworkId
            };

            pay.MetaData.DocumentBeneficiary = new NetworkIdentification
            {
                Domain    = beneficiaryIds.Domain,
                NetworkId = beneficiaryIds.NetworkId
            };

            // Example
            //<MetaData>
            //<ApprovalTechEmplId/>
            //<ApprovalUserEmplId/>
            //<AuthorEmplId/>
            //<ChangeSw/>
            //<OtherApproverList>
            //<OtherApproverList_items Type="USERIDLIST -or- ROLENAME -or- LISTVALUES">
            //<ListItem Key="" Value=""/>
            //</OtherApproverList_items>
            //</OtherApproverList>
            //<QualityEngineerEmplId/>
            //<RadiologicalControlEmplId/>
            //<RespManagerEmplId/>
            //<SafetyAndHealth/>
            //<SMEApproverList>
            //<SMEApproverList_items Type="USERIDLIST -or- ROLENAME -or- LISTVALUES">
            //<ListItem Key="" Value=""/>
            //</SMEApproverList_items>
            //</SMEApproverList>
            //<USQDSESNo/>
            //<USQTNumber/>
            //</MetaData>

            XElement metaData = new XElement("MetaData");

            if (routingItem.IntFields != null && routingItem.IntFields.Count > 0)
            {
                foreach (var item in routingItem.IntFields)
                {
                    XElement element = new XElement(item.Key)
                    {
                        Value = item.Value.ToString()
                    };
                    metaData.Add(element);
                }
            }

            if (routingItem.StringFields != null && routingItem.StringFields.Count > 0)
            {
                foreach (var item in routingItem.StringFields)
                {
                    XElement element = new XElement(item.Key)
                    {
                        Value = item.Value
                    };
                    metaData.Add(element);
                }
            }

            if (routingItem.ListFields != null && routingItem.ListFields.Count > 0)
            {
                foreach (var item in routingItem.ListFields)
                {
                    XElement   listElement = new XElement(item.Key);
                    var        list        = item.Value;
                    XAttribute attribute   = new XAttribute("Type", list.ListType);
                    listElement.Add(attribute);

                    XElement items = new XElement("LIST_ITEMS");
                    listElement.Add(item);
                    foreach (var value in list.Values)
                    {
                        XElement element = new XElement("LIST_ITEM")
                        {
                            Value = value
                        };
                        metaData.Add(element);
                    }
                }
            }

            pay.MetaData.DocumentRoutingData = metaData;
            process.RoutingPayload           = pay;

            pay.Document = new Document
            {
                FileExtension = routingItem.Document.FileExtension,
                MimeType      = routingItem.Document.MimeType,
                AsciiContent  = routingItem.Document.AsciiContent,
                XslStylesheet = routingItem.Document.XslStyleSheet,
                Content       = routingItem.Document.Content
            };

            return(process);
        }