Пример #1
0
        public void SetDeleteTime(int value, TimeUnit units, TimeOrigin origin, bool growOnly)
        {
            var originTime = (origin == TimeOrigin.ReceivedDate && StoreTime.HasValue) ? StoreTime.Value
                                                : (origin == TimeOrigin.StudyDate && StudyDate.HasValue) ? StudyDate.Value
                                                                        : Platform.Time; //todo: not sure whether assigning current time if other values are null is the right thing to do...

            DateTime?newTime = null;

            switch (units)
            {
            case TimeUnit.Days:
                newTime = originTime.AddDays(value);
                break;

            case TimeUnit.Weeks:
                newTime = originTime.AddDays(value * 7);
                break;

            case TimeUnit.Minutes:
                newTime = originTime.AddMinutes(value);
                break;

            case TimeUnit.Hours:
                newTime = originTime.AddHours(value);
                break;
            }
            if (!growOnly || !this.DeleteTime.HasValue || newTime > this.DeleteTime.Value)
            {
                this.DeleteTime = newTime;
            }
        }
Пример #2
0
        private void CreateTimeOrigin(int timeSeriesId, string timeOriginType, int instanceId)
        {
            var timeOrigin = new TimeOrigin();

            timeOrigin.TimeSeriesId         = timeSeriesId;
            timeOrigin.TimeOriginType       = timeOriginType;
            timeOrigin.TimeOriginInstanceId = instanceId;

            m_dbAdapter.TimeOrigin.New(timeOrigin);
        }
Пример #3
0
        /// <summary>
        /// Gets a user-friendly description of this value.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string GetDescription(this TimeOrigin value)
        {
            switch (value)
            {
            case TimeOrigin.ReceivedDate:
                return(SR.TimeOriginReceivedDate);

            case TimeOrigin.StudyDate:
                return(SR.TimeOriginStudyDate);
            }
            throw new ArgumentOutOfRangeException();
        }
Пример #4
0
		public void SetDeleteTime(int value, TimeUnit units, TimeOrigin origin, bool growOnly)
		{
			var originTime = (origin == TimeOrigin.ReceivedDate && StoreTime.HasValue) ? StoreTime.Value
			                      	: (origin == TimeOrigin.StudyDate && StudyDate.HasValue) ? StudyDate.Value
									: Platform.Time; //todo: not sure whether assigning current time if other values are null is the right thing to do...

			DateTime? newTime = null;
			switch (units)
			{
				case TimeUnit.Days:
					newTime = originTime.AddDays(value);
					break;
				case TimeUnit.Weeks:
					newTime = originTime.AddDays(value * 7);
					break;
				case TimeUnit.Minutes:
					newTime = originTime.AddMinutes(value);
					break;
				case TimeUnit.Hours:
					newTime = originTime.AddHours(value);
					break;
			}
			if (!growOnly || !this.DeleteTime.HasValue || newTime > this.DeleteTime.Value)
				this.DeleteTime = newTime;
		}