コード例 #1
0
    public static void CreateFolder(int FolderID, string filePath, string folderName, int fileType, int portalID, string userName, int userModuleID, string secureToken)
    {
        AuthenticateService objService = new AuthenticateService();

        if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken))
        {
            string        absolutePath = FileManagerHelper.ReplaceBackSlash(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath.ToString(), filePath));
            DirectoryInfo dir          = new DirectoryInfo(absolutePath);
            if (!dir.Exists)
            {
                dir.Create();
                Folder folder = new Folder();
                folder.PortalId        = fb.GetPortalID;
                folder.ParentID        = FolderID;
                folder.FolderPath      = filePath;
                folder.StorageLocation = fileType;
                folder.UniqueId        = Guid.NewGuid();
                folder.VersionGuid     = Guid.NewGuid();
                folder.IsActive        = 1;
                folder.AddedBy         = fb.GetUsername;
                try
                {
                    FileManagerController.AddFolder(folder);
                    CacheHelper.Clear("FileManagerFolders");
                }
                catch (Exception ex)
                {
                    fb.ProcessException(ex);
                }
            }
        }
    }