Esempio n. 1
0
        protected override bool ValidateProperties(DbConnection conn, out Exception exception)
        {
            if (String.IsNullOrEmpty(Name))
            {
                exception = new PropertyNotSetException(typeof(FileType), "Name");
                return(false);
            }

            if (IsInDatabase)
            {
                FileType clone = new FileType(Id);

                if (clone.Name != Name)
                {
                    if (FileTypeNameExists(Name))
                    {
                        exception = new DuplicatePropertyValueException(typeof(FileType), "Name", Name);
                        return(false);
                    }
                }
            }
            else
            {
                if (FileTypeNameExists(Name))
                {
                    exception = new DuplicatePropertyValueException(typeof(FileType), "Name", Name);
                    return(false);
                }
            }

            exception = null;
            return(true);
        }
Esempio n. 2
0
        protected override bool ValidateProperties(DbConnection conn, out Exception exception)
        {
            if (IntelligentString.IsNullOrEmpty(Path))
            {
                exception = new PropertyNotSetException(GetType(), "Path");
                return(false);
            }

            Boolean checkPathExists = true;

            if (IsInDatabase)
            {
                RootFolder clone = new RootFolder(MediaItemType, Priority);

                if (clone.Path == Path)
                {
                    checkPathExists = false;
                }
            }

            if (checkPathExists)
            {
                if (RootFolderPathExists(MediaItemType, Path))
                {
                    exception = new DuplicatePropertyValueException(GetType(), "Path", Path);
                    return(false);
                }
            }

            exception = null;
            return(true);
        }