Class DateTimeProperty
Represents a property of type date + time in the Time Cockpit data model.
Inheritance
Implements
Inherited Members
Namespace: TimeCockpit.Data.DataModel
Assembly: TimeCockpit.Data.dll
Syntax
[DataType(typeof(DateTime))]
[Column(typeof(DateTime), PrecisionPropertyName = "FractionalSecondsPrecision")]
[DefaultValue(typeof(DateTime))]
[FriendlyTypeName("DateTime")]
public class DateTimeProperty : DateProperty, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo, INullable
Constructors
DateTimeProperty()
Initializes a new instance of the DateTimeProperty class.
Declaration
public DateTimeProperty()
DateTimeProperty(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the DateTimeProperty class.
Declaration
public DateTimeProperty(IEnumerable<KeyValuePair<object, object>> properties)
Parameters
Type | Name | Description |
---|---|---|
System. |
properties | Collection of properties. |
DateTimeProperty(DateTimeProperty)
Initializes a new instance of the Date
Declaration
public DateTimeProperty(DateTimeProperty element)
Parameters
Type | Name | Description |
---|---|---|
Date |
element | The element. |
Properties
ClrDefaultValue
Gets the default valud for the datatype for the property.
Declaration
public override object ClrDefaultValue { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
DataType
Gets the datatype for the property.
Declaration
public override Type DataType { get; }
Property Value
Type | Description |
---|---|
System. |
Overrides
FractionalSecondsPrecision
Gets or sets the fractional seconds precision for the date+time value.
Declaration
[SchemaDatabaseMapping(SchemaDatabaseColumn.PropertyLengthPrecision)]
public int FractionalSecondsPrecision { get; set; }
Property Value
Type | Description |
---|---|
System. |
Remarks
The default value is 0. The value must be between 0 and 7.
Exceptions
Type | Condition |
---|---|
System. |
Value is <0 or >7. |
ShowTime
Gets or sets a value indicating whether the time part should be shown.
Declaration
public bool ShowTime { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
Convert(Object)
Converts an object to the type of the property.
Declaration
public override object Convert(object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | Object to convert. |
Returns
Type | Description |
---|---|
System. |
Returns the converted object. |
Overrides
Validate(ref IList<PropertyValidationMessage>, Boolean)
Validates a Model
Declaration
protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)
Parameters
Type | Name | Description |
---|---|---|
System. |
messages | An list of strings that stores that picks up the validation errors of a model element. |
System. |
validateRecursively | Indicates wheter to validate only the current model element or all its children (recursively) as well. |
Overrides
Remarks
The rules the Model
When Validate(ref IList<PropertyValidationMessage>, Boolean) is called on a modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.
ValidateValue(Object, out String)
Validates that the value is of type DateTime or null, if the property is null-able.
Declaration
public override bool ValidateValue(object value, out string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to validate. |
System. |
errorMessage | The resulting error message, or null if there is none. |
Returns
Type | Description |
---|---|
System. |
Returns true if the value is valid, false otherwise. |