protected override void Execute(CodeActivityContext executionContext) { TimeSpan?begin = DateUtilities.ParseTimeSpan(BusinessTimeStart.Get <string>(executionContext)); TimeSpan?end = DateUtilities.ParseTimeSpan(BusinessTimeEnd.Get <string>(executionContext)); var rules = DateUtilities.GetRules(executionContext); //Change the result based on the rules such as Check OnlyLastDay, etc. var result = DateUtilities.ModifyDateTime(rules, CheckOnlyLastDay.Get <bool>(executionContext), StartDate.Get <DateTime>(executionContext), Operations.Subtract, DaysToSubtract.Get <int>(executionContext), HoursToSubtract.Get <int>(executionContext), MinutesToSubtract.Get <int>(executionContext), begin, end); Result.Set(executionContext, result); }
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 && DaysToSubtract.Get <int>(executionContext) != 0) { result = start.AddYears(-1 * YearsToSubtract.Get <int>(executionContext)) .AddMonths(-1 * MonthsToSubtract.Get <int>(executionContext)) .AddDays((-7 * WeeksToSubtract.Get <int>(executionContext)) + (-1 * DaysToSubtract.Get <int>(executionContext))) .AddHours(-1 * HoursToSubtract.Get <int>(executionContext)) .AddMinutes(-1 * MinutesToSubtract.Get <int>(executionContext)); } Result.Set(executionContext, result); }