protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            var number             = Number.Get(context);
            var rootNumber         = RootNumber.Get(context);
            var roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            var result = Math.Pow(number, 1 / rootNumber);

            if (double.IsNaN(result))
            {
                throw new InvalidPluginExecutionException("Number under the radical must be positive.");
            }

            if (roundDecimalPlaces != -1)
            {
                result = Math.Round(result, roundDecimalPlaces);
            }

            Result.Set(context, result);
        }
        protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            decimal number1            = Number1.Get(context);
            decimal number2            = Number2.Get(context);
            int     roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            if (number2 == 0)
            {
                Quotient.Set(context, 0);
                return;
            }

            decimal quotient = number1 / number2;

            if (roundDecimalPlaces != -1)
            {
                quotient = Math.Round(quotient, roundDecimalPlaces);
            }

            Quotient.Set(context, quotient);
        }
Ejemplo n.º 3
0
        protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            decimal number1            = Number1.Get(context);
            decimal number2            = Number2.Get(context);
            int     roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            decimal difference = number1 - number2;

            if (roundDecimalPlaces != -1)
            {
                difference = Math.Round(difference, roundDecimalPlaces);
            }

            Difference.Set(context, difference);
        }
        protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            var number             = Number.Get(context);
            var powerNumber        = PowerNumber.Get(context);
            var roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            var result = Math.Pow(number, powerNumber);

            if (roundDecimalPlaces != -1)
            {
                result = Math.Round(result, roundDecimalPlaces);
            }

            Result.Set(context, result);
        }
        protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            decimal number1            = Number1.Get(context);
            decimal number2            = Number2.Get(context);
            int     roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            decimal sum = number1 + number2;

            if (roundDecimalPlaces != -1)
            {
                sum = Math.Round(sum, roundDecimalPlaces);
            }

            Sum.Set(context, sum);
        }
Ejemplo n.º 6
0
        protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            decimal number1            = Number1.Get(context);
            decimal number2            = Number2.Get(context);
            int     roundDecimalPlaces = RoundDecimalPlaces.Get(context);

            decimal averageValue = (number1 + number2) / 2;

            if (roundDecimalPlaces != -1)
            {
                averageValue = Math.Round(averageValue, roundDecimalPlaces);
            }

            AverageValue.Set(context, averageValue);
        }