Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hai to all ,
i have to put validation on EstimationStartDate and EstimatedCompletionFields...

I Tried like this.

private DateTime _estimatedStartDate;
[DataMember]
public DateTime EstimatedStartDate
{
    get { return _estimatedStartDate; }
    set
    {
        if (value == _estimatedStartDate)
            return;

        _estimatedStartDate = value;
        NotifyPropertyChange(EstimatedStartDate);
    }

}

private DateTime _estimatedCompletionDate;
[PropertyComparisonValidator(EstimatedStartDate", ComparisonOperator.GreaterThanEqual , MessageTemplate = Estimated Completion Date should be Greater than or equal to the Estimated Start Date)]
[DataMember]
public DateTime EstimatedCompletionDate
{
    get{ return _estimatedCompletionDate; }
    set
    {
        if (value == _estimatedCompletionDate)
            return;

        _estimatedCompletionDate = value;
        NotifyPropertyChange("EstimatedCompletionDate");
    }

}


This is working fine when i changed the dates ...

Those are the ComboBox Fields...

when i changed the ExstimationCompletionDate combobox field ...I am getting default time as 12:00:00 A.M for the fields ...so I was not able to save...
I try to changed EstimatedComplitionData combobox then I get that time...

please help me ...
Posted
Updated 28-Oct-10 1:28am
v2

1 solution

Unless you actually have an estimated start/end time, you should both change your properties to the following:


C++
public DateTime WhicheverDate
{
    get{ return _backingField.Date; }
    set
    {
        if (value.Date == _backingField.date)
            return;
        _backingField. = value.Date;
        NotifyPropertyChange("WhicheverDate");
    }
}


This removes the ambiguity around the time. If you need to keep the time, obviouly this is not a solution.
 
Share this answer
 
Comments
satyagrahi_2010 29-Oct-10 0:51am    
Nice Answer Help me...
Thanks Barrow...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900