Пример #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
        private bool CheckStartAndEndDate()
        {
            DateTimePicker startPicker = StartPicker.GetControl();
            DateTimePicker endPicker   = EndPicker.GetControl();

            return((startPicker.Value == endPicker.Value) || (startPicker.Value > endPicker.Value));
        }
Пример #3
0
        private bool CheckMinDate()
        {
            DateTimePicker startPicker = StartPicker.GetControl();
            DateTimePicker endPicker   = EndPicker.GetControl();

            return((startPicker.Enabled && (startPicker.Value < startPicker.MinDate || startPicker.Value < DateTime.Now)) ||
                   (endPicker.Enabled && (endPicker.Value < endPicker.MinDate || endPicker.Value < DateTime.Now)));
        }