Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello
I'm using Data Annotation in a Calburn Micro framework to validate my user input. User selects a date that needs to be 3 days in the future. Record is saved to db. 4 days later the record is opened again and validation kicks in on the selected date. What I need to do is turn off validation for my "RequiredStartDateTime" object on any old database records. I.E only validate when record is new. Can anyone advise on how to do this?

C#
private DateTime? _RequiredStartDateTime;        
        [Required(ErrorMessageResourceType = typeof(Properties.Resources), ErrorMessageResourceName = "ErrorMessageNullDate")]
        [ProcessingDelay001(ErrorMessageResourceType = typeof(Properties.Resources), ErrorMessageResourceName = "ErrorMessageRequiredStartDateTime")]
        public DateTime? RequiredStartDateTime
        {
            get { return _RequiredStartDateTime; }
            set 
            { 
               _RequiredStartDateTime = value;
               NotifyOfPropertyChange(() => RequiredStartDateTime);
               _events.PublishOnUIThread(new IsValidNotifier(NoValidationErrors));
            }
        }
Posted
Updated 2-Jul-15 16:46pm
v3

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