protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } string stringToPad = StringToPad.Get(context); string padCharacter = PadCharacter.Get(context); int length = Length.Get(context); string paddedString = stringToPad; for (int i = 0; i < length; i++) { paddedString = paddedString + padCharacter; } PaddedString.Set(context, paddedString); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { string stringToPad = StringToPad.Get(executionContext); string padCharacter = PadCharacter.Get(executionContext); int length = Length.Get(executionContext); string paddedString = stringToPad; while (paddedString.Length < length) { paddedString += padCharacter; } PaddedString.Set(executionContext, paddedString); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }