Beispiel #1
0
 private DateTime?GetDateAttributeValue(PlayerAccountAttributeType attributeType)
 {
     return(DateTimeValueEditor.TryParse(GetPlayerAttributeValue <string>(attributeType), new DateTimeValueEditor()).Value);
 }
Beispiel #2
0
        public override IPropertyValueEditor CreateEditor(System.ComponentModel.PropertyDescriptor propertyDescriptor, object targetObject)
        {
            if (propertyDescriptor.PropertyType != typeof(DateTime) && propertyDescriptor.PropertyType != typeof(DateTime?))
                throw new InvalidOperationException("PropertyDateTimeEditor works only with DateTime type properties");

            DateTimeValueEditor editor = new DateTimeValueEditor();
            editor.AutoBorderSize = 1;

            if (!string.IsNullOrEmpty(CustomFormat))
            {
                editor.Format = eDateTimePickerFormat.Custom;
                editor.CustomFormat = CustomFormat;
            }
            else
                editor.Format = Format;
            editor.AllowEmptyState = AllowEmptyState;
            editor.BackgroundStyle.Class = "";
            editor.BackgroundStyle.BackColor = Color.White;
            editor.MinDate = this.MinDate;
            editor.MaxDate = this.MaxDate;
            
            if (AllowEmptyState)
            {
                editor.ButtonClear.Visible = true;
                editor.ButtonDropDown.DisplayPosition = 1;
            }
            editor.Height = 14;
            editor.ButtonDropDown.Visible = ShowDropDownButton;

            return editor;
        }
Beispiel #3
0
 private string FormatDateTime(DateTime?value)
 {
     return(DateTimeValueEditor.FormatDate(value.Value));
 }