Beispiel #1
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService tracer = executionContext.GetExtension <ITracingService>();

            try
            {
                DateTime originalDate = OriginalDate.Get(executionContext);
                int      hoursToAdd   = HoursToAdd.Get(executionContext);

                DateTime updatedDate = originalDate.AddHours(hoursToAdd);

                UpdatedDate.Set(executionContext, updatedDate);
            }
            catch (Exception ex)
            {
                tracer.Trace("Exception: {0}", ex.ToString());
            }
        }
        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.Add,
                                                      DaysToAdd.Get <int>(executionContext),
                                                      HoursToAdd.Get <int>(executionContext),
                                                      MinutesToAdd.Get <int>(executionContext), begin, end);

            Result.Set(executionContext, result);
        }
Beispiel #3
0
        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      hoursToAdd   = HoursToAdd.Get(context);

            DateTime updatedDate = originalDate.AddHours(hoursToAdd);

            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);
        }