Esempio n. 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);
             }
         }
     }
 }
Esempio n. 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);
             }
         }
     }
 }
Esempio n. 3
0
 public static void DeleteUserFolder(MembershipUser user)
 {
     if (user != null)
     {
         UsersDataEntity userdata = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty);
         DeleteUserFolder(user, userdata);
     }
 }
Esempio n. 4
0
 //---------------------------------------------------------------------------
 #endregion
 public static void ConfigureSubSiteIfExist(MembershipUser user)
 {
     if (user != null)
     {
         UsersDataEntity userdata = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty);
         CreateUserFolder(user, userdata);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Creates UsersData object by calling UsersData data provider create method.
        /// <example>[Example]bool status=UsersDataFactory.Create(usersDataObject);.</example>
        /// </summary>
        /// <param name="usersDataObject">The UsersData object.</param>
        /// <returns>Status of create operation.</returns>
        public static bool Create(MembershipUser user, UsersDataEntity usersDataObject)
        {
            bool status = UsersDataSqlDataPrvider.Instance.Create(usersDataObject);

            if (status)
            {
                UsersDataFactory.CreateUserFolder(user, usersDataObject);
                //------------------------------------------------------------------------
            }
            return(status);
        }
Esempio n. 6
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single UsersData object .
        /// <example>[Example]bool status=UsersDataFactory.Delete(userProfileID);.</example>
        /// </summary>
        /// <param name="userProfileID">The usersDataObject id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(Guid userID)
        {
            UsersDataEntity usersDataObject = GetUsersDataObject(userID, SitesHandler.GetOwnerIDAsGuid());
            bool            status          = UsersDataSqlDataPrvider.Instance.Delete(userID);

            if (status)
            {
                MembershipUser user = Membership.GetUser(userID);
                Membership.DeleteUser(user.UserName, true);
                //------------------------------------------------
                //DeleteFiles(usersDataObject);
                //------------------------------------------------
                UsersDataFactory.DeleteUserFolder(user, usersDataObject);
                //------------------------------------------------------------------------
            }
            return(status);
        }
Esempio n. 7
0
        //---------------------------------------------------------------------------
        public static void UpdateSmsMobileNo(string oldMobile, UsersDataEntity usersDataObject)
        {
            SMSNumbersEntity smsUser = SMSNumbersFactory.GetObject(usersDataObject.ModuleTypeID, oldMobile);

            if (smsUser != null)
            {
                if (!string.IsNullOrEmpty(usersDataObject.Mobile))
                {
                    smsUser.Numbers = usersDataObject.Mobile;
                    SMSNumbersFactory.Update(smsUser);
                }
                else
                {
                    SMSNumbersFactory.Delete(smsUser.NumID);
                }
            }
            else
            {
                UsersDataFactory.RegisterInSms(usersDataObject);
            }
        }
Esempio n. 8
0
        //---------------------------------------------------------------------------
        public static void UpdateMailListEmail(string oldEmail, UsersDataEntity usersDataObject)
        {
            MailListUsersEntity mlUser = MailListUsersFactory.GetObject(usersDataObject.ModuleTypeID, oldEmail);

            if (mlUser != null)
            {
                if (!string.IsNullOrEmpty(usersDataObject.Email))
                {
                    mlUser.Email = usersDataObject.Email;
                    MailListUsersFactory.Update(mlUser);
                }
                else
                {
                    MailListUsersFactory.Delete(mlUser.UserID);
                }
            }
            else
            {
                UsersDataFactory.RegisterInMailList(usersDataObject);
            }
        }
Esempio n. 9
0
        //----------------------------------------------------------------------------------------------------------
        public static void IncreaseSubSiteVisites()
        {
            HttpContext context = HttpContext.Current;

            OwnerInterfaceType interfaceType = SitesHandler.GetOwnerInterfaceType();

            if (interfaceType == OwnerInterfaceType.SubSites)
            {
                Guid   OwnerID         = SitesHandler.GetOwnerIDAsGuid();
                string OwnerIdentifire = SitesHandler.GetOwnerIdentifire();
                //--------------------------------------
                List <string> visitorSubSites = null;
                try
                {
                    visitorSubSites = (List <string>)context.Session["VisitorSubSites"];
                }
                catch
                {
                }
                //--------------------------------------
                if (visitorSubSites == null)
                {
                    visitorSubSites = new List <string>();
                }
                //--------------------------------------
                foreach (string site in visitorSubSites)
                {
                    if (OwnerIdentifire == site)
                    {
                        return;
                    }
                }
                //--------------------------------------
                UsersDataFactory.IncreaseVisits(OwnerID);
                visitorSubSites.Add(OwnerIdentifire);
                context.Session["VisitorSubSites"] = visitorSubSites;
            }
        }
Esempio n. 10
0
        //----------------------------------------------------------------------------------------------------------
        //----------------------------------------------------------------------------------------------------------
        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);
            }
        }
Esempio n. 11
0
        //-------------------------------------------------------------
        public static UsersDataEntity GetOwnerData()
        {
            UsersDataEntity SiteOwner = null;
            HttpContext     context   = HttpContext.Current;

            if (context.Items["SiteOwnerData"] != null)
            {
                SiteOwner = (UsersDataEntity)context.Items["SiteOwnerData"];
            }
            else
            {
                if (context.Items["OwnerInterfaceType"] != null)
                {
                    OwnerInterfaceType ownerInterfaceType = (OwnerInterfaceType)context.Items["OwnerInterfaceType"];
                    if (ownerInterfaceType == OwnerInterfaceType.SubAdmin)
                    {
                        MembershipUser user = Membership.GetUser(context.User.Identity.Name);
                        if (user != null)
                        {
                            SiteOwner = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty);
                            if (SiteOwner != null)
                            {
                                context.Items["OwnerID"]         = new Guid(SiteOwner.UserId.ToString());
                                context.Items["OwnerIdentifire"] = SiteOwner.UserName;
                                context.Items["OwnerTitle"]      = SiteOwner.Name;
                            }
                            else
                            {
                                context.Response.Redirect(SiteSettings.Site_WebsiteDomain);
                            }
                        }
                    }
                    else if (ownerInterfaceType == OwnerInterfaceType.SubSites)
                    {
                        string SubSiteIdentifire = (string)context.Items["SubSiteIdentifire"];
                        if (!string.IsNullOrEmpty(SubSiteIdentifire))
                        {
                            MembershipUser user = Membership.GetUser(SubSiteIdentifire);
                            if (user != null)
                            {
                                SiteOwner = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty);
                                if (SiteOwner != null)
                                {
                                    context.Items["OwnerID"]         = new Guid(SiteOwner.UserId.ToString());
                                    context.Items["OwnerIdentifire"] = SiteOwner.UserName;
                                    context.Items["OwnerTitle"]      = SiteOwner.Name;
                                }
                            }
                            else
                            {
                                context.Response.Redirect(SiteSettings.Site_WebsiteDomain);
                            }
                        }
                    }
                }
            }
            //---------------------------------------------------------
            //
            if (SiteOwner == null)
            {
                context.Items["OwnerID"]         = Guid.Empty;
                context.Items["OwnerIdentifire"] = "";
                context.Items["OwnerTitle"]      = "";
            }
            //---------------------------------------------------------
            return(SiteOwner);
            //---------------------------------------------------------
        }
Esempio n. 12
0
        //----------------------------------------------------------------------------------------------------------
        public static void IncreaseSubSiteVisites2()
        {
            Guid OwnerID = SitesHandler.GetOwnerIDAsGuid();

            UsersDataFactory.IncreaseVisits(OwnerID);
        }