public async Task <string> GetJobCreatorAsync(string sessionId, string JobID) { KTA_JobServices.JobIdentity JobIdentity = new KTA_JobServices.JobIdentity(); JobIdentity.Id = JobID; KTA_JobServices.JobInfo JobInfo = new KTA_JobServices.JobInfo(); KTA_JobServices.JobHistoryFilter Filter = new KTA_JobServices.JobHistoryFilter(); var jobSvc = new KTA_JobServices.JobServiceClient(); JobInfo = await jobSvc.GetJobInfoAsync(sessionId, JobIdentity, Filter); return(JobInfo.Creator.Name); }
public async Task <string> CreateJobAsync(string sessionId, string process_ID, long requestNumber, InputVariableCollection inputVarCollection = null) { logger.LogDebug($"CreateJobAsync requestNumber fired {requestNumber}"); // Set up the create new job method // Create a job service client so we call the methods in the job service e.g. createjob etc var jobSvc = new KTA_JobServices.JobServiceClient(); // Set up variables for the CreateJob method. Create job requires sessionid, process identity, and process initialization variables (input variables) // CreateJob method returns the Job Identity (Job Id). var procIdentity = new KTA_JobServices.ProcessIdentity(); var jobInit = new KTA_JobServices.JobInitialization(); // These variables are used for the return object (job identity) var jobIdentity = new KTA_JobServices.JobIdentity(); // This is the process identity of the Loan Application API process. This Id was obtained by running a select * from the Business_Process table procIdentity.Id = process_ID; logger.LogDebug($"procIdentity.Id {procIdentity.Id}"); if (inputVarCollection == null) { inputVarCollection = new KTA_JobServices.InputVariableCollection(); // Set up each inputvariable to job (process initialization variables) // Must use the ID of the variable in the process, not its display name KTA_JobServices.InputVariable id = new KTA_JobServices.InputVariable(); logger.LogDebug($"KTA_JobServices.InputVariable id {id.Id}"); id.Id = "REQUESTID"; id.Value = requestNumber; inputVarCollection.Add(id); } // Populate the InputVariables to the job jobInit.InputVariables = inputVarCollection; // Create the job, passing the session id, process identity and inputvariables. A job identity object containing the job id(string) is returned // from the method call jobIdentity = await jobSvc.CreateJobAsync(sessionId, procIdentity, jobInit); logger.LogDebug($"Create Job Identity jobId fired {jobIdentity.Id}"); // Return the job i return(jobIdentity.Id); }