public void CreateFolder(InventoryFolder folder)
        {
            var skelInsert    = SKEL_INSERT_STMT.Bind(folder.OwnerId, folder.FolderId, folder.Name, folder.ParentId, folder.Type, (int)folder.Level);
            var contentInsert = FOLDER_ATTRIB_INSERT_STMT.Bind(folder.FolderId, FOLDER_MAGIC_ENTRY, folder.Name, folder.Type, UnixTimeNow(), folder.OwnerId);

            var batch = new BatchStatement()
                        .Add(skelInsert)
                        .Add(contentInsert);

            _session.Execute(batch);

            VersionInc(folder.OwnerId, folder.FolderId);
        }
        public void SaveFolder(InventoryFolder folder)
        {
            var skelUpdate    = SKEL_UPDATE_STMT.Bind(folder.Name, folder.Type, folder.OwnerId, folder.FolderId);
            var contentUpdate = FOLDER_UPDATE_STMT.Bind(folder.Name, folder.Type, folder.FolderId);

            var batch = new BatchStatement()
                        .Add(skelUpdate)
                        .Add(contentUpdate);

            _session.Execute(batch);

            VersionInc(folder.OwnerId, folder.FolderId);
        }
        public InventoryFolder GetFolderAttributes(Guid folderId)
        {
            var statement = FOLDER_SELECT_STMT.Bind(folderId);
            var rowset    = _session.Execute(statement);

            InventoryFolder retFolder = null;

            foreach (var row in rowset)
            {
                retFolder = new InventoryFolder {
                    FolderId = folderId
                };
                //should only be a single row
                MapRowToFolder(retFolder, row);
                break;
            }

            return(retFolder);
        }
        public void MoveItem(InventoryItem item, InventoryFolder parentFolder)
        {
            var insert = FOLDER_ITEM_INSERT_STMT.Bind(parentFolder.FolderId, item.ItemId, item.Name, item.AssetId, item.AssetType,
                                                      item.BasePermissions, item.CreationDate, item.CreatorId, item.CurrentPermissions, item.Description, item.EveryonePermissions,
                                                      item.Flags, item.GroupId, item.GroupOwned, item.GroupPermissions, item.InventoryType, item.NextPermissions,
                                                      item.OwnerId, item.SaleType);

            var removeOld = FOLDER_ITEM_REMOVE_STMT.Bind(item.FolderId, item.ItemId);

            var ownershipUpdate = ITEM_OWNERSHIP_UPDATE.Bind(parentFolder.FolderId, item.ItemId);

            var batch = new BatchStatement()
                        .Add(insert)
                        .Add(ownershipUpdate)
                        .Add(removeOld);

            _session.Execute(batch);

            VersionInc(item.OwnerId, item.FolderId);
            VersionInc(item.OwnerId, parentFolder.FolderId);
        }
 public void PurgeFolder(InventoryFolder folder)
 {
     this.PurgeFolderContents(folder);
     this.DeleteFolder(folder.OwnerId, folder.FolderId);
 }