protected void OnSave(object sender, EventArgs e) { if(m_oIAEmailTemplateID == null) { m_oIAEmailTemplateID = new IAEmailTemplate(); m_oIAEmailTemplateID.CreatedDateTime = DateTime.Now; DataAccess.IAEmailTemplates.InsertOnSubmit(m_oIAEmailTemplateID); } m_oIAEmailTemplateID.Name = m_txtName.Text; m_oIAEmailTemplateID.Body = m_txtBody.Content; DataAccess.SubmitChanges(); RedirectMessage("~/site-settings.aspx", "Email template saved.", InetSolution.Web.MessageTone.Positive); }
protected void Page_Load(object sender, EventArgs e) { if(Request.QueryString["id"] != null) { if(ApplicationContext.IsAdmin && ApplicationContext.IsStaff) { m_oIAEmailTemplateID = DataAccess.IAEmailTemplates.SingleOrDefault(row => row.IAEmailTemplateID == MemberProtect.Utility.ValidateInteger(Request.QueryString["id"])); } } if(!IsPostBack) { if(m_oIAEmailTemplateID != null) { m_txtName.Text = m_oIAEmailTemplateID.Name; m_txtBody.Content = m_oIAEmailTemplateID.Body; } else { m_txtName.Focus(); } } }