Пример #1
0
 private static void SetActivityRemindToOwnerDate(Activity activity, EmailTemplateUserTask userTask)
 {
     if (userTask.OwnerId.IsNotEmpty())
     {
         activity.OwnerId = userTask.OwnerId;
         if (userTask.RemindBefore != 0)
         {
             activity.RemindToOwner = true;
             var      processDurationPeriod = (ProcessDurationPeriod)userTask.RemindBeforePeriod;
             DateTime remindToOwnerDate     = ProcessUserTaskUtilities.NewDate(activity.StartDate, -1 * userTask.RemindBefore,
                                                                               processDurationPeriod);
             activity.RemindToOwnerDate = remindToOwnerDate;
         }
     }
 }
Пример #2
0
        private Activity CreateActivity(EmailMessage message, EmailTemplateUserTask userTask)
        {
            var activity = new Activity(UserConnection);

            activity.SetDefColumnValues();
            activity.Id            = Guid.NewGuid();
            activity.TypeId        = ActivityConsts.EmailTypeUId;
            activity.MessageTypeId = ActivityConsts.OutgoingEmailTypeId;
            userTask.Subject       = message.Subject;
            activity.Title         = message.Subject;
            activity.StartDate     = ProcessUserTaskUtilities.NewDate(
                UserConnection.CurrentUser.GetCurrentDateTime(), userTask.StartIn,
                (ProcessDurationPeriod)userTask.StartInPeriod);
            activity.DueDate = ProcessUserTaskUtilities.NewDate(
                activity.StartDate, userTask.Duration, (ProcessDurationPeriod)userTask.DurationPeriod);
            if (userTask.ActivityCategory.IsEmpty())
            {
                userTask.ActivityCategory = ActivityConsts.EmailActivityCategoryId;
            }
            activity.ActivityCategoryId = userTask.ActivityCategory;
            activity.ShowInScheduler    = userTask.ShowInScheduler;
            activity.Recepient          = message.To.ConcatIfNotEmpty(";");
            activity.CopyRecepient      = message.Cc.ConcatIfNotEmpty(";");
            activity.BlindCopyRecepient = message.Bcc.ConcatIfNotEmpty(";");
            activity.Body       = message.Body;
            activity.IsHtmlBody = true;
            activity.Sender     = message.From;
            SetActivityRemindToOwnerDate(activity, userTask);
            FillActivityConnections(activity, userTask);
            activity.ProcessElementId = userTask.UId;
            activity.AllowedResult    = userTask.GetResultAllowedValues();
            LinkActivityToProcess(activity, userTask);
            userTask.IsActivityCompleted = false;
            userTask.ActivityId          = activity.Id;
            return(activity);
        }
 /// <summary>
 /// Returns date and time with the specified offset period.
 /// </summary>
 /// <param name="dateTime">Date time.</param>
 /// <param name="offset">Offset value.</param>
 /// <param name="offsetPeriod">Offset period.</param>
 /// <returns></returns>
 public virtual DateTime GetDateTime(DateTime dateTime, int offset, ProcessDurationPeriod offsetPeriod)
 {
     return(ProcessUserTaskUtilities.NewDate(dateTime, offset, offsetPeriod));
 }