protected override void Execute(CodeActivityContext executionContext) { var n = Number1.Get <decimal>(executionContext); var n2 = Number2.Get <decimal>(executionContext); switch (Symbol.Get <string>(executionContext)) { case "+": n += n2; break; case "-": n -= n2; break; case "/": n /= n2; break; case "*": n *= n2; break; } Result.Set(executionContext, n); }
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); }
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); decimal maxValue = number1 >= number2 ? number1 : number2; MaxValue.Set(context, maxValue); }
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)); } 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); }
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); }
protected override void Execute(CodeActivityContext executionContext) { Result.Set(executionContext, Math.Max(Number1.Get <int>(executionContext), Number2.Get <int>(executionContext))); }