Ejemplo n.º 1
0
    public bool PosTest1()
    {
        bool retVal = true;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method EndInvoke");
        try
        {
            HelperEvent helperEvent = new HelperEvent();

            EventHandler <HelperArgs> eventHandler = new EventHandler <HelperArgs>(setMessage);

            IAsyncResult iAR = null;

            eventHandler.EndInvoke(iAR);

            TestLibrary.TestFramework.LogError("001", "Expected NotSupportedException exception");
            retVal = false;
        }
        catch (NotSupportedException)
        {
            // expected
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Ejemplo n.º 2
0
    public bool PosTest1()
    {
        bool retVal = true;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method");
        try
        {
            HelperEvent helperEvent = new HelperEvent();

            EventHandler <HelperArgs> eventHandler = new EventHandler <HelperArgs>(setMessage);

            eventHandler.Invoke(helperEvent, new HelperArgs(temp));

            if (!helperArgs.message.Equals(temp))
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(true) !=ActualValue(false)");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Ejemplo n.º 3
0
    public bool PosTest1()
    {
        bool retVal = true;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method");
        try
        {
            HelperEvent helperEvent = new HelperEvent();

            EventHandler<HelperArgs> eventHandler = new EventHandler<HelperArgs>(setMessage);

            eventHandler.Invoke(helperEvent,new HelperArgs(temp));

            if (!helperArgs.message.Equals(temp))
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(true) !=ActualValue(false)");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
Ejemplo n.º 4
0
    public bool PosTest1()
    {
        bool retVal = true;

        bool expectedValue = true;
        bool actualValue   = false;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method BeginInvoke");
        try
        {
            HelperEvent helperEvent = new HelperEvent();
            helperEvent.setEvent += new EventHandler <HelperArgs>(setMessage);
            helperEvent.Desc      = temp;
            //if the Object helperArgs is changed,it shows that the event take off.

            if (!helperArgs.message.Equals(temp))
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Ejemplo n.º 5
0
    public bool PosTest1()
    {
        bool retVal = true;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method BeginInvoke with all arguments null");
        try
        {
            HelperEvent helperEvent = new HelperEvent();

            EventHandler<HelperArgs> eventHandler = new EventHandler<HelperArgs>(setMessage);

            IAsyncResult iAR = eventHandler.BeginInvoke(helperEvent, new HelperArgs(temp), null, null);

            TestLibrary.TestFramework.LogError("001", "Expected NotSupportedException exception");
            retVal = false;
        }
        catch (NotSupportedException)
        {
            // expected
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
Ejemplo n.º 6
0
        public void Excute(new_incidentservice new_incidentservice)
        {
            SubjectEmailSender email  = new SubjectEmailSender(_service, new_incidentservice);
            HelperEvent        helper = new HelperEvent(_service, new_incidentservice);
            var parameters            = helper.GetParamters();
            var originalFlight        = helper.GetOriginalFlight();

            var israelWF           = new IsraelWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var callCenterWF       = new CallCenterWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var cashierWF          = new CashierWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var groupWF            = new GroupWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var foodWF             = new FoodWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var customerRelationWF = new CustomerRelationWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var scheduleWF         = new ScheduleWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var cargoWF            = new CargoWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var crewsWF            = new CrewsWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);
            var sundorWF           = new SundorWF(_service, new_incidentservice, parameters, originalFlight, _wfemailTemp);

            email.Attach(israelWF);
            email.Attach(callCenterWF);
            email.Attach(cashierWF);
            email.Attach(groupWF);
            email.Attach(foodWF);
            email.Attach(customerRelationWF);
            email.Attach(scheduleWF);
            email.Attach(cargoWF);
            email.Attach(crewsWF);
            email.Attach(sundorWF);

            email.SendEmailsToTeams(_userid);
        }
Ejemplo n.º 7
0
    public bool PosTest1()
    {
        bool retVal = true;

        bool expectedValue = true;
        bool actualValue = false;

        String temp = TestLibrary.Generator.GetString(-55, false,1,255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method BeginInvoke");
        try
        {
            HelperEvent helperEvent = new HelperEvent();
            helperEvent.setEvent += new EventHandler<HelperArgs>(setMessage);
            helperEvent.Desc = temp;
            //if the Object helperArgs is changed,it shows that the event take off. 

            if (!helperArgs.message.Equals(temp))
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
Ejemplo n.º 8
0
        public async Task <IActionResult> SendPushNotificationEventSample(SendPushNotificationModel model)
        {
            var pushNotificationEvent = new SendPushNotificationEvent()
            {
                ApplicationToken = model.ApplicationToken,
                Title            = model.Title,
                Body             = model.Body,
                DeviceIds        = model.DeviceIds,
                CustomData       = model.CustomData,
                Badge            = model.Badge
            };

            await HelperEvent.PublishEvent(_publishEndpoint, pushNotificationEvent, _logger);

            return(Ok("Success"));
        }
        /// <summary>
        /// Executes the workflow activity.
        /// </summary>
        /// <param name="executionContext">The execution context.</param>
        protected override void Execute(CodeActivityContext executionContext)
        {
            // Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            if (tracingService == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
            }

            tracingService.Trace("Entered NewClaimCreateMailToLowsuit.Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
                                 executionContext.ActivityInstanceId,
                                 executionContext.WorkflowInstanceId);

            // Create the context
            IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>();

            if (context == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve workflow context.");
            }

            tracingService.Trace("NewClaimCreateMailToLowsuit.Execute(), Correlation Id: {0}, Initiating User: {1}",
                                 context.CorrelationId,
                                 context.InitiatingUserId);

            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                // TODO: Implement your custom Workflow business logic.
                Entity target = (Entity)context.InputParameters["Target"];
                new_incidentservice new_incidentservice = target.ToEntity <new_incidentservice>();

                SubjectEmailSender email = new SubjectEmailSender(service, new_incidentservice);

                HelperEvent     helper         = new HelperEvent(service, new_incidentservice);
                var             parameters     = helper.GetParamters();
                var             originalFlight = helper.GetOriginalFlight();
                EntityReference emailTemplate  = EmailTemplate.Get <EntityReference>(executionContext);
                EntityReference user           = FromUser.Get <EntityReference>(executionContext);
                WFEmailTemplate wfemailTemp    = new WFEmailTemplate(emailTemplate);

                var israelWF           = new IsraelWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var callCenterWF       = new CallCenterWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var cashierWF          = new CashierWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var groupWF            = new GroupWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var foodWF             = new FoodWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var customerRelationWF = new CustomerRelationWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var scheduleWF         = new ScheduleWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var cargoWF            = new CargoWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var crewsWF            = new CrewsWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var sundorWF           = new SundorWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);

                email.Attach(israelWF);
                email.Attach(callCenterWF);
                email.Attach(cashierWF);
                email.Attach(groupWF);
                email.Attach(foodWF);
                email.Attach(customerRelationWF);
                email.Attach(scheduleWF);
                email.Attach(cargoWF);
                email.Attach(crewsWF);
                email.Attach(sundorWF);

                email.SendEmailsToTeams(user.Id);
            }


            catch (FaultException <OrganizationServiceFault> e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());

                // Handle the exception.
                throw;
            }

            tracingService.Trace("Exiting NewClaimCreateMailToLowsuit.Execute(), Correlation Id: {0}", context.CorrelationId);
        }
        /// <summary>
        /// Executes the workflow activity.
        /// </summary>
        /// <param name="executionContext">The execution context.</param>
        protected override void Execute(CodeActivityContext executionContext)
        {
            // Create the tracing service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();

            if (tracingService == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
            }

            tracingService.Trace("Entered NewClaimCreateMailToLowsuit.Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
                executionContext.ActivityInstanceId,
                executionContext.WorkflowInstanceId);

            // Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

            if (context == null)
            {
                throw new InvalidPluginExecutionException("Failed to retrieve workflow context.");
            }

            tracingService.Trace("NewClaimCreateMailToLowsuit.Execute(), Correlation Id: {0}, Initiating User: {1}",
                context.CorrelationId,
                context.InitiatingUserId);

            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                // TODO: Implement your custom Workflow business logic.
                Entity target = (Entity)context.InputParameters["Target"];
                new_incidentservice new_incidentservice = target.ToEntity<new_incidentservice>();

                SubjectEmailSender email = new SubjectEmailSender(service, new_incidentservice);

               HelperEvent helper = new HelperEvent(service, new_incidentservice);
                var parameters = helper.GetParamters();
                var originalFlight = helper.GetOriginalFlight();
                EntityReference emailTemplate = EmailTemplate.Get<EntityReference>(executionContext);
                EntityReference user = FromUser.Get<EntityReference>(executionContext);
                WFEmailTemplate wfemailTemp = new WFEmailTemplate(emailTemplate);

                var israelWF = new IsraelWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var callCenterWF = new CallCenterWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var cashierWF = new CashierWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var groupWF = new GroupWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var foodWF = new FoodWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var customerRelationWF = new CustomerRelationWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var scheduleWF = new ScheduleWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var cargoWF = new CargoWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var crewsWF = new CrewsWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);
                var sundorWF = new SundorWF(service, new_incidentservice, parameters, originalFlight, wfemailTemp);

                email.Attach(israelWF);
                email.Attach(callCenterWF);
                email.Attach(cashierWF);
                email.Attach(groupWF);
                email.Attach(foodWF);
                email.Attach(customerRelationWF);
                email.Attach(scheduleWF);
                email.Attach(cargoWF);
                email.Attach(crewsWF);
                email.Attach(sundorWF);

                email.SendEmailsToTeams(user.Id);

            }

            catch (FaultException<OrganizationServiceFault> e)
            {
                tracingService.Trace("Exception: {0}", e.ToString());

                // Handle the exception.
                throw;
            }

            tracingService.Trace("Exiting NewClaimCreateMailToLowsuit.Execute(), Correlation Id: {0}", context.CorrelationId);
        }