Exemple #1
0
        /// <summary>
        /// Converts a bit masked long integer into an array of numbers representing
        /// days of the week or the month
        /// </summary>
        /// <param name="period">Type of the recurring period.</param>
        /// <param name="mask">Bit mask value.</param>
        /// <returns>And array with the days.</returns>
        private int[] GetDaysFromMask(RecurringPeriod period, long mask)
        {
            int        max = 0;
            List <int> res = new List <int>();


            switch (period)
            {
            case RecurringPeriod.Weekly:
                max = 7;
                break;

            case RecurringPeriod.Monthly:
                max = 31;
                break;
            }

            for (int i = 0; i < max; i++)
            {
                if ((mask & 0x00000001) != 0)
                {
                    res.Add(i);
                }

                mask = mask >> 1;
            }

            return(res.ToArray());
        }
Exemple #2
0
        /// <summary>
        /// Converts numbers to string representation of the day.
        /// </summary>
        /// <param name="period">Type of the recurring period.</param>
        /// <param name="days">A list of the days.</param>
        /// <returns>An array containing the string representations of days.</returns>
        private string[] GetDayNamesFromMask(RecurringPeriod period, int[] days)
        {
            string[] res = new string[days.Length];
            for (int i = 0; i < days.Length; i++)
            {
                switch (period)
                {
                case RecurringPeriod.Weekly:
                    res[i] = global::System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[i];
                    break;

                case RecurringPeriod.Monthly:
                    res[i] = days[i].ToString();
                    break;
                }
            }

            return(res);
        }
Exemple #3
0
 /// <summary>
 /// Creates a deep copy of the passed object.
 /// </summary>
 /// <param name="old">A <b>Database Definition</b> object to create the deep copy from.</param>
 private void CopyMembers(JobInstance old)
 {
     this.workflowTypeName   = old.workflowTypeName;
     this.dateStarted        = old.dateStarted;
     this.dateFinished       = old.dateFinished;
     this.jobExecutionStatus = old.jobExecutionStatus;
     this.suspendTimeout     = old.suspendTimeout;
     this.scheduleType       = old.scheduleType;
     this.scheduleTime       = old.scheduleTime;
     this.recurringPeriod    = old.recurringPeriod;
     this.recurringInterval  = old.recurringInterval;
     this.recurringMask      = old.recurringMask;
     this.workflowInstanceId = old.workflowInstanceId;
     this.adminRequestTime   = old.adminRequestTime;
     this.adminRequestData   = old.adminRequestData == null ? null : new JobAdminRequestData(old.adminRequestData);
     this.adminRequestResult = old.adminRequestResult;
     this.exceptionMessage   = old.exceptionMessage;
     this.parameters         = new ParameterCollection(old.parameters);
 }
Exemple #4
0
 private void InitializeMembers(StreamingContext context)
 {
     this.workflowTypeName   = string.Empty;
     this.dateStarted        = DateTime.MinValue;
     this.dateFinished       = DateTime.MinValue;
     this.jobExecutionStatus = JobExecutionState.Unknown;
     this.suspendTimeout     = DateTime.MinValue;
     this.scheduleType       = ScheduleType.Unknown;
     this.scheduleTime       = DateTime.MinValue;
     this.recurringPeriod    = RecurringPeriod.Unknown;
     this.recurringInterval  = 0;
     this.recurringMask      = 0;
     this.workflowInstanceId = Guid.Empty;
     this.adminRequestTime   = DateTime.MinValue;
     this.adminRequestData   = null;
     this.adminRequestResult = -1;
     this.exceptionMessage   = null;
     this.parameters         = new ParameterCollection();
 }
Exemple #5
0
        /// <summary>
        /// Initializes member variables to their initial values.
        /// </summary>
        /// <remarks>
        /// This function is called by the contructors.
        /// </remarks>
        private void InitializeMembers()
        {
            base.EntityType = EntityType.JobInstance;
            base.EntityGroup = EntityGroup.Jobs;

            this.workflowTypeName = string.Empty;
            this.dateStarted = DateTime.MinValue;
            this.dateFinished = DateTime.MinValue;
            this.jobExecutionStatus = JobExecutionState.Unknown;
            this.suspendTimeout = DateTime.MinValue;
            this.scheduleType = ScheduleType.Unknown;
            this.scheduleTime = DateTime.MinValue;
            this.recurringPeriod = RecurringPeriod.Unknown;
            this.recurringInterval = 0;
            this.recurringMask = 0;
            this.workflowInstanceId = Guid.Empty;
            this.adminRequestTime = DateTime.MinValue;
            this.adminRequestData = null;
            this.adminRequestResult = -1;
            this.exceptionMessage = null;

            this.parameters = new Dictionary<string, JobParameter>();
            this.checkpoints = new List<JobCheckpoint>();
        }
Exemple #6
0
        /// <summary>
        /// Converts a bit masked long integer into an array of numbers representing
        /// days of the week or the month
        /// </summary>
        /// <param name="period">Type of the recurring period.</param>
        /// <param name="mask">Bit mask value.</param>
        /// <returns>And array with the days.</returns>
        private int[] GetDaysFromMask(RecurringPeriod period, long mask)
        {
            int max = 0;
            List<int> res = new List<int>();

            switch (period)
            {
                case RecurringPeriod.Weekly:
                    max = 7;
                    break;
                case RecurringPeriod.Monthly:
                    max = 31;
                    break;
            }

            for (int i = 0; i < max; i++)
            {
                if ((mask & 0x00000001) != 0)
                    res.Add(i);

                mask = mask >> 1;
            }

            return res.ToArray();
        }
Exemple #7
0
        /// <summary>
        /// Converts numbers to string representation of the day.
        /// </summary>
        /// <param name="period">Type of the recurring period.</param>
        /// <param name="days">A list of the days.</param>
        /// <returns>An array containing the string representations of days.</returns>
        private string[] GetDayNamesFromMask(RecurringPeriod period, int[] days)
        {
            string[] res = new string[days.Length];
            for (int i = 0; i < days.Length; i++)
            {
                switch (period)
                {
                    case RecurringPeriod.Weekly:
                        res[i] = global::System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[i];
                        break;
                    case RecurringPeriod.Monthly:
                        res[i] = days[i].ToString();
                        break;
                }
            }

            return res;
        }
Exemple #8
0
        /// <summary>
        /// Creates a deep copy of the passed object.
        /// </summary>
        /// <param name="old">A <b>Database Definition</b> object to create the deep copy from.</param>
        private void CopyMembers(JobInstance old)
        {
            this.workflowTypeName = old.workflowTypeName;
            this.dateStarted = old.dateStarted;
            this.dateFinished = old.dateFinished;
            this.jobExecutionStatus = old.jobExecutionStatus;
            this.suspendTimeout = old.suspendTimeout;
            this.scheduleType = old.scheduleType;
            this.scheduleTime = old.scheduleTime;
            this.recurringPeriod = old.recurringPeriod;
            this.recurringInterval = old.recurringInterval;
            this.recurringMask = old.recurringMask;
            this.workflowInstanceId = old.workflowInstanceId;
            this.adminRequestTime = old.adminRequestTime;
            this.adminRequestData = old.adminRequestData == null ? null : new JobAdminRequestData(old.adminRequestData);
            this.adminRequestResult = old.adminRequestResult;
            this.exceptionMessage = old.exceptionMessage;

            // TODO: do deep copy here?
            this.parameters = new Dictionary<string, JobParameter>(old.parameters);
            this.checkpoints = new List<JobCheckpoint>(old.checkpoints);
        }