public static void UpdateFile(string fileName, string filePath, string attrString, int portalID, string userName, int userModuleID, string secureToken)
    {
        AuthenticateService objService = new AuthenticateService();

        if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken))
        {
            filePath = GetAbsolutePath(filePath);
            try
            {
                FileInfo file = new FileInfo(filePath);
                /// Checking if file exists
                if (file.Exists)
                {
                    ///get the folder path
                    filePath = filePath.Substring(0, filePath.LastIndexOf("/") + 1);
                    filePath = filePath + fileName;
                    file.MoveTo(filePath);
                    //FileManagerController.UpdateFile(fileId, fileName);
                    FileManagerHelper.SetFileAttributes(filePath, attrString);
                    //CacheHelper.Clear("FileManagerFileList");
                }
            }
            catch (Exception ex)
            {
                fb.ProcessException(ex);
            }
        }
    }
Example #2
0
    public static void UpdateFile(string fileName, string filePath, string attrString)
    {
        filePath = GetAbsolutePath(filePath);


        try
        {
            FileInfo file = new FileInfo(filePath);
            /// Checking if file exists
            if (file.Exists)
            {
                ///get the folder path
                filePath = filePath.Substring(0, filePath.LastIndexOf("/") + 1);
                filePath = filePath + fileName;
                file.MoveTo(filePath);
                //FileManagerController.UpdateFile(fileId, fileName);
                FileManagerHelper.SetFileAttributes(filePath, attrString);
                //CacheHelper.Clear("FileManagerFileList");
            }
        }
        catch (Exception ex)
        {
            fb.ProcessException(ex);
        }
    }
    public static void UpdateFile(int fileId, int folderId, string fileName, string filePath, string attrString)
    {
        filePath = GetAbsolutePath(filePath);
        List <Folder> lstFolder  = FileManagerController.GetFolders();
        int           folderType = 0;
        int index = lstFolder.FindIndex(
            delegate(Folder obj)
        {
            return(obj.FolderId == folderId);
        }
            );

        if (index > -1)
        {
            folderType = lstFolder[index].StorageLocation;
        }
        string newFileName = fileName;

        if (folderType == 1)
        {
            filePath    += ".resources";
            newFileName += ".resources";
        }
        try
        {
            FileInfo file = new FileInfo(filePath);
            /// Checking if file exists
            if (file.Exists)
            {
                ///get the folder path
                filePath = filePath.Substring(0, filePath.LastIndexOf("/") + 1);
                filePath = filePath + newFileName;
                file.MoveTo(filePath);
                FileManagerController.UpdateFile(fileId, fileName);
                FileManagerHelper.SetFileAttributes(filePath, attrString);
                CacheHelper.Clear("FileManagerFileList");
            }
        }
        catch (Exception ex)
        {
            fb.ProcessException(ex);
        }
    }