protected override void ExecuteWorkflowLogic()
        {
            var formattedValue =
                DateTimeValue.Get(Context.ExecutionContext).ToString(Format.Get(Context.ExecutionContext));

            FormattedDateTimeValue.Set(Context.ExecutionContext, formattedValue);
        }
Exemple #2
0
        protected override void ExecuteWorkflowLogic()
        {
            var dateTimeValue = DateTimeValue.Get(Context.ExecutionContext);

            Year.Set(Context.ExecutionContext, dateTimeValue.Year);
            Month.Set(Context.ExecutionContext, dateTimeValue.Month);
            Day.Set(Context.ExecutionContext, dateTimeValue.Day);
            DayofWeek.Set(Context.ExecutionContext, (int)dateTimeValue.DayOfWeek);
        }
Exemple #3
0
        protected override void ExecuteWorkflowLogic()
        {
            var result    = DateTimeValue.Get(Context.ExecutionContext);
            var daysToAdd = DaystoAdd.Get(Context.ExecutionContext);

            var weekendDays = WeekendDays.Get(Context.ExecutionContext).Split('|').Select(t => (DayOfWeek)int.Parse(t)).ToList();
            var holidays    = new List <DateTime>();

            var holidaysQuery = HolidaysQuery.Get(Context.ExecutionContext);

            if (!string.IsNullOrEmpty(holidaysQuery))
            {
                holidays = QueryWithPaging(new FetchExpression(holidaysQuery))
                           .Where(t => t.Contains("holiday"))
                           .Select(t => t.GetAttributeValue <DateTime>("holiday").Date)
                           .ToList();
            }

            while (daysToAdd > 0)
            {
                result = result.AddDays(1);

                if (weekendDays.Contains(result.DayOfWeek))
                {
                    continue;
                }

                if (holidays.Contains(result.Date))
                {
                    continue;
                }

                daysToAdd--;
            }

            Result.Set(Context.ExecutionContext, result);
        }