示例#1
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);
             }
         }
     }
 }
示例#2
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);
             }
         }
     }
 }
示例#3
0
    //--------------------------------------------------------
    #endregion

    public string GetSubSiteFolderSize(object identifire)
    {
        string text                   = "";
        long   folderSize             = 0;
        string folderPath             = DCSiteUrls.GetPath_SubSiteUploadFolder((string)identifire);
        string folderPathPhysicalPath = DCServer.MapPath(folderPath);

        if (Directory.Exists(folderPathPhysicalPath))
        {
            DirectoryInfo dir = new DirectoryInfo(folderPathPhysicalPath);
            DcDirectoryManager.GetDirectorySize(dir, ref folderSize);
            text = DcDirectoryManager.CalculateSizeToRead(folderSize);
        }
        return(text);
    }