示例#1
0
 public void SaveRoot(AssetFolderDM folder, Guid actedBy)
 {
     if (folder.IsRoot)
     {
         DB.Insert <AssetStructureDM>(new AssetStructureDM(folder.FolderId, Guid.Empty, true, 1, folder.Code), actedBy);
     }
 }
示例#2
0
 private void ThrowIfNoFolderName(AssetFolderDM item)
 {
     if (string.IsNullOrEmpty(item.Name))
     {
         throw new ExpectedException("No folder name.");
     }
 }
示例#3
0
        private AssetFolderDM SaveRoot(Guid userId)
        {
            var root = new AssetFolderDM()
            {
                Name   = "My Assets",
                UserId = userId,
                Code   = Let <SerialNo>().GenerateSerialNo(SerialNoType.AssetFolderCode, userId),
                IsRoot = true,
            };

            DB.Insert <AssetFolderDM>(root, userId);
            Let <AssetStructure>().SaveRoot(root, userId);

            return(root);
        }
示例#4
0
        public void Save(AssetFolderDM item, Guid folderId, Guid actedBy)
        {
            ThrowIfNoFolderName(item);

            item.Name = StringHelper.ToFolderName(item.Name);

            if (item.FolderId.Equals(Guid.Empty))
            {
                item.Code = Let <SerialNo>().GenerateSerialNo(SerialNoType.AssetFolderCode, actedBy);

                DB.Insert <AssetFolderDM>(item, actedBy);
                SaveStructure(item.FolderId, folderId, actedBy);
            }
            else
            {
                DB.Update <AssetFolderDM>(item, actedBy);
            }
        }
示例#5
0
 public void Save(AssetFolderDM item, Guid actedBy)
 {
     Save(item, Guid.Empty, actedBy);
 }