Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 private void ThrowIfNoFolderName(AssetFolderDM item)
 {
     if (string.IsNullOrEmpty(item.Name))
     {
         throw new ExpectedException("No folder name.");
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 5
0
 public void Save(AssetFolderDM item, Guid actedBy)
 {
     Save(item, Guid.Empty, actedBy);
 }