Ejemplo n.º 1
0
        protected override async Task <bool> DoExecuteAsync()
        {
            var item = SyncTableManager.GetByPath(_oldFullPath);

            if (item != null)
            {
                var syncItems = SyncTableManager.GetAllByPath(_oldFullPath);

                if (syncItems != null)
                {
                    foreach (var syncItem in syncItems)
                    {
                        if (syncItem.Type == "F" &&
                            String.Compare(syncItem.FolderId, item.FolderId) == 0)
                        {
                            syncItem.Name = _newName;
                        }

                        syncItem.Path = syncItem.Path.Replace(_oldFullPath, _fullPath);
                    }
                }
                else
                {
                    item.Name = _newName;
                    item.Path = item.Path.Replace(_oldFullPath, _fullPath);
                }

                try
                {
                    return(await DokuFlexService.RenameFileFolderAsync(_ticket, item.GroupId, item.FolderId, _newName));
                }
                catch (Exception ex)
                {
                    var newMsg = string.Format("Rename directory, raise an exception with: {0}, Exception: {1}", item.Path, ex.Message);
                    throw new Exception(newMsg);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        protected override async Task <bool> DoExecuteAsync()
        {
            var item = SyncTableManager.GetByPath(_oldFullPath);

            if (item != null)
            {
                item.Name = _newName;
                item.Path = item.Path.Replace(_oldFullPath, _fullPath);
            }
            else
            {
                return(false);
            }

            try
            {
                return(await DokuFlexService.RenameFileFolderAsync(_ticket, item.GroupId, item.FileId, _newName));
            }
            catch (Exception ex)
            {
                var newMsg = string.Format("Rename file, raise an exception with: {0}, Exception: {1}", item.Path, ex.Message);
                throw new Exception(newMsg);
            }
        }