protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime originalDate = OriginalDate.Get(executionContext); int yearsToAdd = YearsToAdd.Get(executionContext); DateTime updatedDate = originalDate.AddYears(yearsToAdd); UpdatedDate.Set(executionContext, updatedDate); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime originalDate = OriginalDate.Get(context); int yearsToAdd = YearsToAdd.Get(context); DateTime updatedDate = originalDate.AddYears(yearsToAdd); UpdatedDate.Set(context, updatedDate); }
protected override void Execute(CodeActivityContext executionContext) { var result = new DateTime(); var start = StartDate.Get <DateTime>(executionContext); if (start != DateTime.MinValue) { result = start; } if (start != DateTime.MinValue && DaysToAdd.Get <int>(executionContext) != 0) { result = start.AddYears(YearsToAdd.Get <int>(executionContext)) .AddMonths(MonthsToAdd.Get <int>(executionContext)) .AddDays((7 * WeeksToAdd.Get <int>(executionContext)) + DaysToAdd.Get <int>(executionContext)) .AddHours(HoursToAdd.Get <int>(executionContext)) .AddMinutes(MinutesToAdd.Get <int>(executionContext)); } Result.Set(executionContext, result); }