示例#1
0
        protected override bool EnsureValidState()
        {
            var isValid = base.EnsureValidState();

            Doctors.EnsureValidState();
            Managers.EnsureValidState();

            Unavailabilities.EnsureValidState();
            if (Unavailabilities.Count > 0)
            {
                if (!Location.HasValue())
                {
                    throw new RuleViolationException(Resources.ClinicEntity_NotLocated);
                }
                if (!Owner.HasValue())
                {
                    throw new RuleViolationException(Resources.ClinicEntity_NotOwned);
                }
                if (!License.HasValue())
                {
                    throw new RuleViolationException(Resources.ClinicEntity_NotRegistered);
                }
            }

            return(isValid);
        }