Beispiel #1
0
        public static async Task <ActivityTemplateDTO> GetActivityTemplate(this IHubCommunicator that, Guid activityTemplateId)
        {
            var allActivityTemplates = await that.GetActivityTemplates();

            var foundActivity = allActivityTemplates.FirstOrDefault(a => a.Id == activityTemplateId);


            if (foundActivity == null)
            {
                throw new Exception($"ActivityTemplate was not found. Id: {activityTemplateId}");
            }

            return(foundActivity);
        }
Beispiel #2
0
        public static async Task <ActivityTemplateDTO> GetActivityTemplate(this IHubCommunicator that, string terminalName, string activityTemplateName, string activityTemplateVersion = "1", string terminalVersion = "1")
        {
            var allActivityTemplates = await that.GetActivityTemplates();

            var foundActivity = allActivityTemplates.FirstOrDefault(a =>
                                                                    a.Terminal.Name == terminalName && a.Terminal.Version == terminalVersion &&
                                                                    a.Name == activityTemplateName && a.Version == activityTemplateVersion);

            if (foundActivity == null)
            {
                throw new Exception($"ActivityTemplate was not found. TerminalName: {terminalName}\nTerminalVersion: {terminalVersion}\nActivitiyTemplateName: {activityTemplateName}\nActivityTemplateVersion: {activityTemplateVersion}");
            }

            return(foundActivity);
        }
Beispiel #3
0
        private async Task CreateAndActivateNewMADSEPlan(IHubCommunicator hubCommunicator, AuthorizationToken authToken)
        {
            try
            {
                var emptyMonitorPlan = new PlanNoChildrenDTO
                {
                    Name        = "MonitorAllDocuSignEvents",
                    Description = "MonitorAllDocuSignEvents",
                    PlanState   = "Active",
                    Visibility  = new PlanVisibilityDTO()
                    {
                        Hidden = true
                    }
                };

                var monitorDocusignPlan = await hubCommunicator.CreatePlan(emptyMonitorPlan);

                Debug.WriteLine("Attemting to create a new MADSE plan");
                var activityTemplates = await hubCommunicator.GetActivityTemplates();

                var recordDocusignEventsTemplate = GetActivityTemplate(activityTemplates, "Prepare_DocuSign_Events_For_Storage");
                var storeMTDataTemplate          = GetActivityTemplate(activityTemplates, "Save_All_Payload_To_Fr8_Warehouse");
                Debug.WriteLine($"Calling create and configure with params {recordDocusignEventsTemplate} {authToken.UserId} {monitorDocusignPlan}");
                await hubCommunicator.CreateAndConfigureActivity(recordDocusignEventsTemplate.Id, "Record DocuSign Events", 1, monitorDocusignPlan.StartingSubPlanId, false, new Guid(authToken.Id));

                var storeMTDataActivity = await hubCommunicator.CreateAndConfigureActivity(storeMTDataTemplate.Id, "Save To Fr8 Warehouse", 2, monitorDocusignPlan.StartingSubPlanId);

                //save this
                await hubCommunicator.ConfigureActivity(storeMTDataActivity);

                await hubCommunicator.RunPlan(monitorDocusignPlan.Id, null);

                Logger.Info($"#### New MADSE plan activated with planId: {monitorDocusignPlan.Id}");
            }
            catch (Exception exc)
            {
                Logger.Error($"#### Failed to create MADSE plan for {authToken.ExternalAccountId} Exception:{exc.Message} {exc.StackTrace.Substring(255)}");
            }
        }
        public async Task InitialPlanConfiguration()
        {
            var emptyMonitorPlan = new PlanNoChildrenDTO
            {
                Name        = "MonitorSubmissionTerminalForm",
                Description = "MonitorSubmissionTerminalForm",
                PlanState   = "Active",
                Visibility  = new PlanVisibilityDTO()
                {
                    Hidden = true
                }
            };

            monitorTerminalSubmissions = await _hubCommunicator.CreatePlan(emptyMonitorPlan);

            var activityTemplates = await _hubCommunicator.GetActivityTemplates(null);

            monitorFormResponsesTmpl = GetActivityTemplate(activityTemplates, "Monitor_Form_Responses");
            buildMessageTmpl         = GetActivityTemplate(activityTemplates, "Build_Message");
            saveJiraIssueTmpl        = GetActivityTemplate(activityTemplates, "Save_Jira_Issue");
            publishToSlackTmpl       = GetActivityTemplate(activityTemplates, "Publish_To_Slack", "2");
        }