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); } } } }
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); } } } }
//---------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------- public static void AddUserRelatedPages(UsersDataEntity usersDataObject) { UsersDataGlobalOptions usersModuleOptions = UsersDataGlobalOptions.GetType(usersDataObject.ModuleTypeID); bool HasProfilePage = usersModuleOptions.HasProfilePage; bool doUpdate = false; //*-------------------------------------------------------- if (HasProfilePage && usersDataObject.ProfilePageID <= 0) { SubSiteHandler.AddProfilePageDetails(usersDataObject); doUpdate = true; } //*-------------------------------------------------------- if (UsersDataFactory.IsSubSubSiteOwner(usersDataObject.UserType) && string.IsNullOrEmpty(usersDataObject.SiteStaticPages)) { SubSiteHandler.AddSubSitePages(usersDataObject); doUpdate = true; } //*-------------------------------------------------------- if (doUpdate) { UsersDataFactory.Update(usersDataObject); } }