protected void btnChangeName_Click(object sender, EventArgs e) { if (this.CurrentUserPageId != Guid.Empty) { UserPage userPage = new UserPage(this.CurrentUserPageId); userPage.PageName = this.txtCurrentPageName.Text; userPage.Save(); } WebUtils.SetupRedirect(this, SiteRoot + Request.RawUrl); }
public static String GetDefaultPagePath( Guid userGuid, SiteSettings siteSettings, String defaultFirstPageName, String deafaultFirstPagePath) { String result = String.Empty; int countOfPages = 0; using (IDataReader reader = DBUserPage.SelectByUser(userGuid)) { while ((reader.Read()) && (countOfPages < 1)) { result = reader["PagePath"].ToString(); result += 1; } } if (result == String.Empty) { UserPage userPage = new UserPage(); userPage.SiteId = siteSettings.SiteId; userPage.SiteGuid = siteSettings.SiteGuid; userPage.UserGuid = userGuid; userPage.PageName = defaultFirstPageName; userPage.PagePath = deafaultFirstPagePath; userPage.PageOrder = 1; userPage.Save(); result = deafaultFirstPagePath; } return result; }
protected void btnNewPage_Click(object sender, EventArgs e) { if (currentUser != null) { UserPage userPage = new UserPage(); userPage.UserGuid = currentUser.UserGuid; userPage.SiteId = siteSettings.SiteId; userPage.SiteGuid = siteSettings.SiteGuid; userPage.PageName = this.txtNewPage.Text; userPage.PagePath = Guid.NewGuid().ToString(); userPage.PageOrder = 3; userPage.Save(); } WebUtils.SetupRedirect(this, Request.RawUrl); }
protected void rptUserPageMenu_ItemCommand(object source, RepeaterCommandEventArgs e) { this.pnlAddPage.Visible = false; this.pnlChangeName.Visible = false; String argString = e.CommandArgument.ToString(); Guid userPageID = Guid.Empty; if (argString.Length == 36) { userPageID = new Guid(argString); CurrentUserPageId = userPageID; } switch (e.CommandName) { case "selectpage": // mojoPersonalizationProvider will adjust the path variable // based on cookie to retrieve personalizarion // for the correct user page if (argString.Length > 0) { CookieHelper.SetPersistentCookie(userPageCookie, argString); } WebUtils.SetupRedirect(this, Request.RawUrl); break; case "changename": if (userPageID != Guid.Empty) { this.pnlChangeName.Visible = true; UserPage userPage = new UserPage(userPageID); this.txtCurrentPageName.Text = userPage.PageName; } break; case "moveright": if (userPageID != Guid.Empty) { UserPage userPage = new UserPage(userPageID); userPage.MoveDown(); } WebUtils.SetupRedirect(this, Request.RawUrl); break; case "moveleft": if (userPageID != Guid.Empty) { UserPage userPage = new UserPage(userPageID); userPage.MoveUp(); } WebUtils.SetupRedirect(this, Request.RawUrl); break; case "remove": if (userPageID != Guid.Empty) { UserPage.DeleteUserPage(userPageID); } WebUtils.SetupRedirect(this, Request.RawUrl); break; case "addpage": this.pnlAddPage.Visible = true; break; } }