protected void Page_Load(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.AdminSystem); this.RequirePermission(Affinity.RolePermission.AffinityManager); this.Master.SetLayout("Edit Content Page", MasterPage.LayoutStyle.ContentOnly); if (!Page.IsPostBack) { string code = Request["code"]; Affinity.Content c = new Affinity.Content(this.phreezer); if (code == null) { // this is an insert } else { //this is an update c.Load(code); txtCode.ReadOnly = true; } txtCode.Text = c.Code.ToString(); txtMetaTitle.Text = c.MetaTitle.ToString(); txtMetaKeywords.Text = c.MetaKeywords.ToString(); txtMetaDescription.Text = c.MetaDescription.ToString(); txtHeader.Text = c.Header.ToString(); txtBody.Text = c.Body.ToString(); txtModified.Text = c.Modified.ToShortDateString(); } }
protected void btnSave_Click(object sender, EventArgs e) { Affinity.Content c = new Affinity.Content(this.phreezer); c.MetaTitle = txtMetaTitle.Text; c.MetaKeywords = txtMetaKeywords.Text; c.MetaDescription = txtMetaDescription.Text; c.Header = txtHeader.Text; c.Body = txtBody.Text; c.Modified = DateTime.Now; c.Code = txtCode.Text; if (txtCode.ReadOnly) { c.Update(); } else { c.Insert(false); } // the default page is cached so we need to treat it specially: if (c.Code == Affinity.Content.HomePageCode) { Application[Affinity.Content.HomePageCode] = c; } this.Redirect("AdminContents.aspx?feedback=Content+Updated"); }
protected void Page_Load(object sender, EventArgs e) { this.Master.SetLayout("Please Login", MasterPage.LayoutStyle.Photo_01); // get the main content. this is cached for performance Affinity.Content c; if (Application[Affinity.Content.HomePageCode] == null) { c = new Affinity.Content(this.phreezer); c.Load(Affinity.Content.HomePageCode); Application[Affinity.Content.HomePageCode] = c; } else { c = (Affinity.Content)Application[Affinity.Content.HomePageCode]; } header.InnerHtml = c.Header; welcome.InnerHtml = c.Body; }
protected void Page_Load(object sender, EventArgs e) { Affinity.Account account = this.GetAccount(); string code = Request["page"] != null ? Request["page"] : ""; Affinity.Content c = new Affinity.Content(this.phreezer); try { c.Load(code); this.Master.SetLayout(c.MetaTitle, MasterPage.LayoutStyle.Photo_01); header.InnerHtml = c.Header; pnlBody.Controls.Clear(); pnlBody.Controls.Add(new LiteralControl(c.Body)); } catch (Exception ex) { // we don't really care - just show the default not-found message } }