public static async Task <CreateDocumentResponse> CreateDocument([ActivityTrigger] IDurableActivityContext context) { var contextInput = context.GetInput <(CreateDocumentRequest createDocumentRequest, string archeoId)>(); CreateDocumentResponse createDocumentResponse = await RestService.RestService.CreateDocument(contextInput.createDocumentRequest, contextInput.archeoId); return(createDocumentResponse); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateDocumentResponse response = new CreateDocumentResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("DocumentDescription", targetDepth)) { var unmarshaller = DocumentDescriptionUnmarshaller.Instance; response.DocumentDescription = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static async Task Run([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log) { _globalLogger = log; //Input from VTFK var docToP360Request = context.GetInput <(DocToP360Request DocToP360Request, string archeoTransGuid)>(); PrivatePersonLookupRequest privatePersonLookupRequest = (PrivatePersonLookupRequest)docToP360Request.DocToP360Request; //Check if the personalIdNumber exsits in P360 if (!await context.CallActivityAsync <bool>("DoesPersonExsist", (privatePersonLookupRequest, docToP360Request.archeoTransGuid))) { //if not, create a user with given input PrivatePersonSyncRequest privatePersonSyncRequest = (PrivatePersonSyncRequest)docToP360Request.DocToP360Request; await context.CallActivityAsync("CreatePrivatePerson", (privatePersonSyncRequest, docToP360Request.archeoTransGuid)); } //Checks if d exists with given Initials EnterpriseDepartmentLookupRequest enterpriseDepartmentLookupRequest = (EnterpriseDepartmentLookupRequest)docToP360Request.DocToP360Request.parameter; //Gets the Recno from GetEnterprise var recNO = await context.CallActivityAsync <int>("GetEnterPriseRecno", (enterpriseDepartmentLookupRequest, docToP360Request.archeoTransGuid)); //Sends GetEnterprise recno to CreateCase CreateCaseRequest createCaseRequest = (CreateCaseRequest)(docToP360Request.DocToP360Request, recNO); createCaseRequest.parameter.ResponsibleEnterpriseRecno = recNO; //Stores CaseNumber from CreateCase var caseNumber = await context.CallActivityAsync <string>("CreateCase", (createCaseRequest, docToP360Request.archeoTransGuid)); //Creates document with given parameters, CaseNumber from CreateCase and Recno from GetEnterprise CreateDocumentRequest createDocumentRequest = (CreateDocumentRequest)(docToP360Request.DocToP360Request, caseNumber, recNO); CreateDocumentResponse createDocumentResponse = await context.CallActivityAsync <CreateDocumentResponse>("CreateDocument", (createDocumentRequest, docToP360Request.archeoTransGuid)); //Updates the case with created CaseNumber UpdateCaseRequest updateCaseRequest = (UpdateCaseRequest)(docToP360Request.DocToP360Request, caseNumber); UpdateCaseResponse UpdateCaseResponse = await context.CallActivityAsync <UpdateCaseResponse>("UpdateCase", (updateCaseRequest, docToP360Request.archeoTransGuid)); }