Beispiel #1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- ValidPickerDate -->
        /// <summary>
        ///      Converts a date to one accepted by a DateTimePicker
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static DateTime ValidPickerDate(object obj)
        {
            DateTime date = TimeDate_old.ClrDate(obj, DateTimePicker.MinimumDateTime);

            if (date < DateTimePicker.MinimumDateTime)
            {
                return(DateTimePicker.MinimumDateTime);
            }
            if (date > DateTimePicker.MaximumDateTime)
            {
                return(DateTimePicker.MaximumDateTime);
            }
            return(date);
        }
Beispiel #2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- Dates -->
        /// <summary>
        ///      Sets the date field of a control
        /// </summary>
        /// <param name="form">allows no-op if the control is not on the form</param>
        /// <param name="control"></param>
        /// <param name="date"></param>
        public static void Dates(Form form, Control control, TimeDate_old date)
        {
            if (Scrape.Active(form, control))
            {
                DateTime clrDate = TimeDate_old.ClrDate(date);
                Type     type    = control.GetType();
                switch (type.Name.ToString())
                {
                case "DateTimePicker": Dates(form, ((DateTimePicker)control), clrDate, new Label()); break;

                default: control.Text = date.ToString(); break;
                }
            }
        }
Beispiel #3
0
 // ----------------------------------------------------------------------------------------
 /// <!-- _Date -->
 /// <summary>
 ///      Retrieves an xml datetime given the path
 /// </summary>
 /// <param name="xdoc"></param>
 /// <param name="namespacePrefix"></param>
 /// <returns></returns>
 public DateTime _Date(PathSlicer xpath, string namespacePrefix)
 {
     return(TimeDate_old.ClrDate(_Str(xpath, namespacePrefix, ""), (DateTime)SqlDateTime.MinValue));
 }