2009-06-19 07:39:16 +00:00
using System ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using System.ComponentModel ;
using System.Collections ;
using System.Globalization ;
2010-02-15 14:14:02 +00:00
using umbraco.uicontrols.DatePicker ;
2009-06-19 07:39:16 +00:00
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for dateField.
/// </summary>
2013-09-25 19:03:05 +10:00
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
2010-02-15 14:14:02 +00:00
public class dateField : DateTimePicker , interfaces . IDataEditor
2009-06-19 07:39:16 +00:00
{
interfaces . IData _data ;
public dateField ( interfaces . IData Data ) {
_data = Data ;
}
public virtual bool TreatAsRichTextEditor
{
get { return false ;}
}
public bool ShowLabel
{
get { return true ;}
}
public Control Editor {
get { return this ;}
}
public void Save ()
{
try
{
if ( this . Text == String . Empty )
throw new FormatException ();
2010-02-15 14:14:02 +00:00
//DateTime date = DateTime.Parse(this.Text);
//this.Text = date.ToString("yyyy-MM-dd") + " " + date.ToLongTimeString();
//_data.Value = date;
_data . Value = this . DateTime ;
2009-06-19 07:39:16 +00:00
}
catch {
2010-02-15 14:14:02 +00:00
//this.Text = "";
2009-06-19 07:39:16 +00:00
_data . Value = null ;
}
}
protected override void OnInit ( EventArgs e )
{
//base.ShowTime = false;
2010-02-15 14:14:02 +00:00
//base.CustomMinutes = "00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55";
if ( _data != null && _data . Value != null && _data . Value is DateTime )
{
this . DateTime = ( DateTime ) _data . Value ;
}
else
{
//base.EmptyDateAsDefault = true;
//this.Text = "";
}
2009-06-19 07:39:16 +00:00
base . OnInit ( e );
}
}
}