예제 #1
0
    public static void MoveFile(string filePath, string fromPath, string toPath)
    {
        string fullFilePath = GetAbsolutePath(filePath);
        string fullFromPath = GetAbsolutePath(fromPath);
        string fullToPath   = GetAbsolutePath(toPath);

        FileManagerHelper.TransferFile(filePath, toPath, (int)Action.MOVE, (int)TransferMode.NORMALTONORMAL, fullFilePath, fullFromPath, fullToPath);
    }
    public static void MoveFile(string filePath, string fromPath, string toPath, int portalID, string userName, int userModuleID, string secureToken)
    {
        AuthenticateService objService = new AuthenticateService();

        if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken))
        {
            string fullFilePath = GetAbsolutePath(filePath);
            string fullFromPath = GetAbsolutePath(fromPath);
            string fullToPath   = GetAbsolutePath(toPath);
            FileManagerHelper.TransferFile(filePath, toPath, (int)Action.MOVE, (int)TransferMode.NORMALTONORMAL, fullFilePath, fullFromPath, fullToPath);
        }
    }
예제 #3
0
    public static void CopyFile(string filePath, string fromPath, string toPath)
    {
        string fullFilePath = GetAbsolutePath(filePath);
        string fullFromPath = GetAbsolutePath(fromPath);
        string fullToPath   = GetAbsolutePath(toPath);



        try
        {
            //public static void TransferFile(string filePath, string toPath, int action, int mode, string fullFilePath, string fullFromPath, string fullToPath)
            FileManagerHelper.TransferFile(filePath, toPath, (int)Action.COPY, (int)TransferMode.NORMALTONORMAL, fullFilePath, fullFromPath, fullToPath);
        }
        catch (Exception ex)
        {
            fb.ProcessException(ex);
        }
    }
    public static void CopyFile(string filePath, string fromPath, string toPath, int portalID, string userName, int userModuleID, string secureToken)
    {
        AuthenticateService objService = new AuthenticateService();

        if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken))
        {
            string fullFilePath = GetAbsolutePath(filePath);
            string fullFromPath = GetAbsolutePath(fromPath);
            string fullToPath   = GetAbsolutePath(toPath);
            try
            {
                //public static void TransferFile(string filePath, string toPath, int action, int mode, string fullFilePath, string fullFromPath, string fullToPath)
                FileManagerHelper.TransferFile(filePath, toPath, (int)Action.COPY, (int)TransferMode.NORMALTONORMAL, fullFilePath, fullFromPath, fullToPath);
            }
            catch (Exception ex)
            {
                fb.ProcessException(ex);
            }
        }
    }
    public static void MoveFile(int fileId, string filePath, int folderId, int toFolderId, string fromPath, string toPath)
    {
        string fullFilePath = GetAbsolutePath(filePath);
        string fullFromPath = GetAbsolutePath(fromPath);
        string fullToPath   = GetAbsolutePath(toPath);

        List <Folder> lstFolder   = FileManagerController.GetFolders();
        int           folderType1 = 0;
        int           folderType2 = 0;
        int index1 = lstFolder.FindIndex(
            delegate(Folder obj)
        {
            return(obj.FolderId == folderId);
        }
            );

        if (index1 > -1)
        {
            folderType1 = lstFolder[index1].StorageLocation;
        }

        int index2 = lstFolder.FindIndex(
            delegate(Folder obj)
        {
            return(obj.FolderId == toFolderId);
        }
            );

        if (index2 > -1)
        {
            folderType2 = lstFolder[index2].StorageLocation;
        }

        string moveKey = folderType1.ToString() + folderType2.ToString();

        try
        {
            switch (moveKey)
            {
            case "00":    ///normal folder type to normal
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.NORMALTONORMAL, fullFilePath, fullFromPath, fullToPath);
                break;

            case "01":    ///normal to secure
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.NORMALTOSECURE, fullFilePath, fullFromPath, fullToPath);
                break;

            case "02":    ///normal to database
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.SECURETODATABASE, fullFilePath, fullFromPath, fullToPath);
                break;

            case "10":    ///secure to normal
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.SECURETONORMAL, fullFilePath, fullFromPath, fullToPath);
                break;

            case "11":    ///secure to secure
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.SECURETOSECURE, fullFilePath, fullFromPath, fullToPath);
                break;

            case "12":    ///secure to database
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.SECURETODATABASE, fullFilePath, fullFromPath, fullToPath);
                break;

            case "20":    ///database to normal
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.DATABASETONORMAL, fullFilePath, fullFromPath, fullToPath);
                break;

            case "21":    ///database to secure
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.DATABASETOSECURE, fullFilePath, fullFromPath, fullToPath);
                break;

            case "22":    ///database to database
                FileManagerHelper.TransferFile(filePath, fileId, toFolderId, toPath, (int)Action.MOVE, (int)TransferMode.DATABASETODATABASE, fullFilePath, fullFromPath, fullToPath);
                break;
            }
            CacheHelper.Clear("FileManagerFileList");
        }
        catch (Exception ex)
        {
            fb.ProcessException(ex);
        }
    }