コード例 #1
0
 public static void DeleteUserFolder(MembershipUser user, UsersDataEntity userdata)
 {
     if (user != null && userdata != null)
     {
         if (user.IsApproved && UsersDataFactory.IsSubSubSiteOwner(userdata.UserType))
         {
             string subSiteFolder             = DCSiteUrls.GetPath_SubSiteUploadFolder(user.UserName);
             string subSiteFolderPhysicalPath = DCServer.MapPath(subSiteFolder);
             if (Directory.Exists(subSiteFolderPhysicalPath))
             {
                 DirectoryInfo dir = new DirectoryInfo(subSiteFolderPhysicalPath);
                 DcDirectoryManager.DeletDirectory(dir);
             }
         }
         else
         {
             string folder             = DCSiteUrls.GetPath_UserDataDirectory(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID);
             string folderPhysicalPath = DCServer.MapPath(folder);
             if (Directory.Exists(folderPhysicalPath))
             {
                 DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                 DcDirectoryManager.DeletDirectory(dir);
             }
         }
     }
 }
コード例 #2
0
 public static void CreateUserFolder(MembershipUser user, UsersDataEntity userdata)
 {
     if (user != null && userdata != null)
     {
         if (user.IsApproved && UsersDataFactory.IsSubSubSiteOwner(userdata.UserType))
         {
             string subSiteFolder             = DCSiteUrls.GetPath_SubSiteUploadFolder(user.UserName);
             string subSiteFolderPhysicalPath = DCServer.MapPath(subSiteFolder);
             if (!Directory.Exists(subSiteFolderPhysicalPath))
             {
                 string        subSiteEmptyFolderPhysicalPath = DCServer.MapPath(DCSiteUrls.GetPath_DefaultSubSiteFolder());
                 DirectoryInfo diSource = new DirectoryInfo(subSiteEmptyFolderPhysicalPath);
                 DirectoryInfo diTarget = new DirectoryInfo(subSiteFolderPhysicalPath);
                 DcDirectoryManager.CopyAll(diSource, diTarget);
             }
         }
         else
         {
             // Create msg folder
             string folder             = DCSiteUrls.GetPath_UserDataDirectory(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID);
             string folderPhysicalPath = DCServer.MapPath(folder);
             if (!Directory.Exists(folderPhysicalPath))
             {
                 string        defaultFolder             = DCSiteUrls.GetPath_DefaultUserDataFolder();
                 string        defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder);
                 DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath);
                 DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath);
                 DcDirectoryManager.CopyAll(diSource, diTarget);
             }
         }
     }
 }