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 textToConvert = TextToConvert.Get(context); bool isValid = DateTime.TryParse(textToConvert, out var convertedDate); ConvertedDate.Set(context, convertedDate); IsValid.Set(context, isValid); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { string textToConvert = TextToConvert.Get(executionContext); DateTime convertedDate; bool isValid = DateTime.TryParse(textToConvert, out convertedDate); ConvertedDate.Set(executionContext, convertedDate); IsValid.Set(executionContext, isValid); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }