예제 #1
0
 public ResultBase NewUserCategory(string categoryPath)
 {
     return(this.Invoke(() =>
     {
         var categoryName = new Ntreev.Library.ObjectModel.CategoryName(categoryPath);
         var category = this.GetCategory(categoryName.ParentPath);
         category.AddNewCategory(this.authentication, categoryName.Name);
     }));
 }
        public _C Prepare(string categoryPath)
        {
            var categoryName = new CategoryName(categoryPath);

            if (this.ContainsKey(categoryName.ParentPath) == false)
            {
                this.Prepare(categoryName.ParentPath);
            }
            if (this.ContainsKey(categoryPath) == false)
            {
                return(this.BaseAddNew(categoryName.Name, categoryName.ParentPath, null));
            }
            return(this[categoryPath]);
        }
        public virtual void ValidateAddNew(string name, string parentCategoryPath, object validation, params object[] args)
        {
            if (this.Contains(parentCategoryPath) == false)
            {
                throw new ArgumentException(string.Format(Resources.Exception_NotFoundFolder_Format, parentCategoryPath), nameof(parentCategoryPath));
            }

            var parent = this[parentCategoryPath];

            if (parent.Categories.ContainsKey(name) == true)
            {
                throw new ArgumentException(Resources.Exception_SameFolderInParent);
            }

            if (parent.Items.ContainsKey(name) == true)
            {
                throw new ArgumentException(Resources.Exception_SameItemInParent);
            }

            if (this.Contains(CategoryName.MakePath(parentCategoryPath, name)) == true)
            {
                throw new ArgumentException(string.Format(Resources.Exception_AlreadyExistedItem_Format, name), nameof(name));
            }
        }