public override bool IsValid(AppointmentResource resource) { if (!(resource is AppointmentResourcePatient)) { return(false); } return(this.Id == resource.Id); /*string pattern = (resource as AppointmentResourcePatient).FirstName.ToLower(); * * return LastName.ToLower().Contains(pattern) || FirstName.ToLower().Contains(pattern);*/ }
//public static AppointmentResourceTime ExtractFromDto(AppointmentResourceTimeDto dto) //{ // AppointmentResourceTime result = new AppointmentResourceTime(); // result.Account = new Account(dto.AccountId); // if (dto.StartTime <= dto.EndTime) // { // result.EndTime = dto.EndTime; // result.StartTime = dto.StartTime; // } // else // throw new SchedulerException(SchedulerExceptionType.TimeResourceIsWrong, "Appointment start time is bigger than end time"); // result.Id = dto.Id; // result.ResourceType = new AppointmentResourceType(dto.TypeId); // return result; //} public override bool IsValid(AppointmentResource resource) { AppointmentResourceTime resourceTime = (resource as AppointmentResourceTime); if (resourceTime == null) { return(true); } else { bool notMatch = (resourceTime.StartTime < this.StartTime && resourceTime.EndTime <= this.StartTime) || (resourceTime.StartTime >= this.EndTime && resourceTime.EndTime > this.EndTime); return(!notMatch); } }
//public virtual AppointmentResource Create(RepositoryLocator locator) //{ // throw new NotImplementedException(); //} //public virtual AppointmentResource Update(RepositoryLocator locator, AppointmentResource updatedResource) //{ // throw new NotImplementedException(); //} //public virtual void Delete(RepositoryLocator locator) //{ // throw new NotImplementedException(); //} public virtual bool IsValid(AppointmentResource resource) { return(this.Id == resource.Id); }