コード例 #1
0
        public void ScheduleEvent(SchedulerEventData eventData, IEventRepository repository)
        {
            var weeklyEventData = eventData as WeeklySchedulerEventData;

            if (weeklyEventData == null)
            {
                throw new InvalidSchedulerEventDataException();
            }

            var weeklyEventTimeData = CreateWeeklyEventTimeData(weeklyEventData.Interval, weeklyEventData.WeekDays,
                                                                weeklyEventData.StartDate, weeklyEventData.EndDate, weeklyEventData.RepeatCount);

            var reminders = CreateReminders(weeklyEventData.Reminders);

            var weeklyEventDto = new EventDto
            {
                Title       = weeklyEventData.Title,
                Description = weeklyEventData.Description,
                EventData   = weeklyEventTimeData,
                IsPrivate   = weeklyEventData.VisibilityType == EventVisibilityType.Private, //TODO: inherit visibility time from schedule
                Reminders   = reminders,
                ScheduleId  = weeklyEventData.ScheduleId
            };

            repository.Save(weeklyEventDto.ToEntity());
        }
コード例 #2
0
        protected override void SerializeSuccessData(SchedulerDataOutput target, StreamWriter output)
        {
            output.Write(',');
            output.WritePropertyName("n");
            output.WriteValueString(target.Name);

            output.Write(',');
            output.WritePropertyName("_");
            output.WriteValueString(target.InstanceId);

            output.Write(',');
            output.WritePropertyName("sim");
            output.WriteValueNumber(target.ServerInstanceMarker);

            output.Write(',');
            output.WritePropertyName("st");
            output.WriteValueString(target.Status);

            output.Write(',');
            output.WritePropertyName("jt");
            output.WriteValueNumber(target.JobsTotal);

            output.Write(',');
            output.WritePropertyName("je");
            output.WriteValueNumber(target.JobsExecuted);

            if (target.RunningSince.HasValue)
            {
                output.Write(',');
                output.WritePropertyName("rs");
                output.WriteValueNumber(target.RunningSince.Value);
            }

            /* Events */
            if (target.Events != null && target.Events.Length > 0)
            {
                output.Write(',');
                output.WritePropertyName("ev");
                output.Write('[');
                for (var i = 0; i < target.Events.Length; i++)
                {
                    if (i > 0)
                    {
                        output.Write(',');
                    }

                    SchedulerEventData eventData = target.Events[i];
                    output.Write('"');
                    output.Write(eventData.Id.ToString(CultureInfo.InvariantCulture));
                    output.Write('|');
                    output.Write(eventData.Date.ToString(CultureInfo.InvariantCulture));
                    output.Write('|');
                    output.Write(eventData.Data.EventType.ToString(CultureInfo.InvariantCulture));
                    output.Write('|');
                    output.Write(eventData.Data.Scope.ToString(CultureInfo.InvariantCulture));
                    output.Write('|');
                    output.Write(eventData.Data.FireInstanceId);
                    output.Write('|');
                    output.Write(eventData.Data.ItemKey);
                    output.Write('"');
                }

                output.Write(']');
            }

            if (target.InProgress != null && target.InProgress.Length > 0)
            {
                output.Write(',');
                output.WritePropertyName("ip");
                output.Write('[');
                for (var i = 0; i < target.InProgress.Length; i++)
                {
                    if (i > 0)
                    {
                        output.Write(',');
                    }

                    var executingJobInfo = target.InProgress[i];
                    output.WriteValueString(executingJobInfo.FireInstanceId + "|" + executingJobInfo.UniqueTriggerKey);
                }

                output.Write(']');
            }

            if (target.JobGroups != null && target.JobGroups.Length > 0)
            {
                output.Write(',');
                output.WritePropertyName("jg");
                output.WriteArray(target.JobGroups, new JobGroupSerializer());
            }
        }
コード例 #3
0
 public void ScheduleEvent(SchedulerEventData eventData, IEventRepository repository)
 {
     throw new NotImplementedException();
 }