Esempio n. 1
0
        public Calendargram(string name, string value, string period, string[] tags = null) : base(tags)
        {
            if (value.Length > MAX_VALUE_LENGTH)
            {
                throw new ArgumentException(String.Format("Cannot have a Calendargram value longer than {0} characters", MAX_VALUE_LENGTH));
            }
            base.MessageType = MessageType.Calendargram;
            base.Name        = name;
            Value            = value;
            _rawPeriod       = period;
            switch (period)
            {
            case PERIOD_ONE_MINUTE: Period = CalendargramRetentionPeriod.OneMinute; break;

            case PERIOD_FIVE_MINUTES: Period = CalendargramRetentionPeriod.FiveMinute; break;

            case PERIOD_HOUR: Period = CalendargramRetentionPeriod.Hour; break;

            case PERIOD_DAY: Period = CalendargramRetentionPeriod.Day; break;

            case PERIOD_DAY_OF_WEEK: Period = CalendargramRetentionPeriod.DayOfWeek; break;

            case PERIOD_WEEK: Period = CalendargramRetentionPeriod.Week; break;

            case PERIOD_MONTH: Period = CalendargramRetentionPeriod.Month; break;

            default: throw new ArgumentException("Unknown retention period: " + period, "period");
            }
        }
Esempio n. 2
0
 public Calendargram(string name, string value, CalendargramRetentionPeriod period)
 {
     if (value.Length > MAX_VALUE_LENGTH)
     {
         throw new ArgumentException(String.Format("Cannot have a Calendargram value longer than {0} characters", MAX_VALUE_LENGTH));
     }
     base.MessageType = MessageType.Calendargram;
     base.Name = name;
     Value = value;
     Period = period;
 }
Esempio n. 3
0
 public Calendargram(string name, string value, CalendargramRetentionPeriod period, string[] tags = null) : base(tags)
 {
     if (value.Length > MAX_VALUE_LENGTH)
     {
         throw new ArgumentException(String.Format("Cannot have a Calendargram value longer than {0} characters", MAX_VALUE_LENGTH));
     }
     base.MessageType = MessageType.Calendargram;
     base.Name        = name;
     Value            = value;
     Period           = period;
 }
Esempio n. 4
0
 public string GetTimePeriod(CalendargramRetentionPeriod period)
 {
     switch (period)
     {
         case CalendargramRetentionPeriod.OneMinute: return OneMinute;
         case CalendargramRetentionPeriod.FiveMinute: return FiveMinute;
         case CalendargramRetentionPeriod.Hour: return OneHour;
         case CalendargramRetentionPeriod.Day: return DayOfMonth;
         case CalendargramRetentionPeriod.Week: return Week;
         case CalendargramRetentionPeriod.DayOfWeek: return DayOfWeek;
         case CalendargramRetentionPeriod.Month: return Month;
         default: throw new ArgumentException("Unknown period: " + period.ToString(), "period");
     }
 }
Esempio n. 5
0
        public string GetTimePeriod(CalendargramRetentionPeriod period)
        {
            switch (period)
            {
            case CalendargramRetentionPeriod.OneMinute: return(OneMinute);

            case CalendargramRetentionPeriod.FiveMinute: return(FiveMinute);

            case CalendargramRetentionPeriod.Hour: return(OneHour);

            case CalendargramRetentionPeriod.Day: return(DayOfMonth);

            case CalendargramRetentionPeriod.Week: return(Week);

            case CalendargramRetentionPeriod.DayOfWeek: return(DayOfWeek);

            case CalendargramRetentionPeriod.Month: return(Month);

            default: throw new ArgumentException("Unknown period: " + period.ToString(), "period");
            }
        }
Esempio n. 6
0
 public Calendargram(string name, string value, string period)
 {
     if (value.Length > MAX_VALUE_LENGTH)
     {
         throw new ArgumentException(String.Format("Cannot have a Calendargram value longer than {0} characters", MAX_VALUE_LENGTH));
     }
     base.MessageType = MessageType.Calendargram;
     base.Name = name;
     Value = value;
     _rawPeriod = period;
     switch (period)
     {
         case PERIOD_ONE_MINUTE: Period = CalendargramRetentionPeriod.OneMinute; break;
         case PERIOD_FIVE_MINUTES: Period = CalendargramRetentionPeriod.FiveMinute; break;
         case PERIOD_HOUR: Period = CalendargramRetentionPeriod.Hour; break;
         case PERIOD_DAY: Period = CalendargramRetentionPeriod.Day; break;
         case PERIOD_DAY_OF_WEEK: Period = CalendargramRetentionPeriod.DayOfWeek; break;
         case PERIOD_WEEK: Period = CalendargramRetentionPeriod.Week; break;
         case PERIOD_MONTH: Period = CalendargramRetentionPeriod.Month; break;
         default: throw new ArgumentException("Unknown retention period: " + period, "period");
     }
 }