Пример #1
0
        public void SetValues(SavedEvent @event)
        {
            TitleTB.SetText(@event.Title);
            CommentTB.SetText(@event.Comment ?? string.Empty);
            DateTime now = DateTime.Now;

            DateTime start = TimeAndDateUtility.ConvertDateAndTime_DateTime(@event.ActivationDate);
            DateTime end   = TimeAndDateUtility.ConvertDateAndTime_DateTime(@event.DeactivationDate);

            StartPicker.SetDates(now > start ? start.Date : now.Date, start, DateTime.MaxValue);
            EndPicker.SetDates(now > end ? end.Date : now.Date, end, DateTime.MaxValue);

            if (start < now)
            {
                StartPicker.GetControl().Enabled = false;
            }

            if (end < now)
            {
                EndPicker.GetControl().Enabled = false;
            }

            if (!StartPicker.GetControl().Enabled&& !EndPicker.GetControl().Enabled)
            {
                TitleTB.GetControl().Enabled   = false;
                CommentTB.GetControl().Enabled = false;

                _purpose = CrudPurposes.None;
                SetTitle();
            }
        }
Пример #2
0
 /// <summary>
 /// Gets all dates that have events
 /// </summary>
 /// <returns>A list of the dates where events occur</returns>
 public IEnumerable <DateTime> GetAllEventDates()
 {
     return
         (_eventRepo.GetEvents()
          .Select(x => TimeAndDateUtility.ConvertDateAndTime_DateTime(x.ActivationDate))
          .Distinct()
          .OrderBy(x => x));
 }
Пример #3
0
        /// <summary>
        /// Set the delay and date to start the delay
        /// </summary>
        /// <param name="delay">The amount of seconds to delay</param>
        /// <param name="date">The date to start the delay</param>
        public void SetDelay(int delay, DateAndTime date)
        {
            int delayTime = delay > 0 ? delay : 30;

            DateDelayed = date;
            DateTime continued = TimeAndDateUtility.ConvertDateAndTime_DateTime(date).AddSeconds(delayTime);

            DateContinued = TimeAndDateUtility.ConvertDateTime_DateAndTime(continued);
            Lock          = true;
        }