protected void ButtonSubmit_Click(object sender, EventArgs e) { try { User user = (User)Session["CurrentUser"]; if (user == null) return; int aid = (ViewState["AssessmentOID"] != null) ? (Convert.ToInt32(ViewState["AssessmentOID"])) : 0; Assessment ass = new Assessment(); ass = ass.GetAssessmentByOID(aid); ReminderEmail reminderEmail = new ReminderEmail(); //reminderEmail.EmailBody = TextBoxEMail.Text; //reminderEmail.EmailBody = Server.HtmlEncode(TextBoxEMail.Text); reminderEmail.EmailBody = EMailBodyHtml; reminderEmail.AssessmentOID = aid; reminderEmail.CreatedBy = user.UserOID; reminderEmail.LastModifiedBy = user.UserOID; //Result Detail ReminderEmail rEmail = reminderEmail.GetReminderEmailByAOID(aid); bool status = false; if (rEmail == null) { status = reminderEmail.AddReminderEmail(); } else { reminderEmail.AssessmentReminderOID = rEmail.AssessmentReminderOID; status = reminderEmail.UpdateReminderEmail(); } if (status) { LabelMessage.Text = "Saved Successfully."; this.ShowEmailBody(aid); } else { LabelMessage.Text = "Not Saved."; } } catch (Exception ex) { LabelMessage.Text = "Not Saved."; } }
private void ShowEmailBody(int assessmentOID) { ReminderEmail reminderEmail = new ReminderEmail(); reminderEmail = reminderEmail.GetReminderEmailByAOID(assessmentOID); if (reminderEmail == null) { //TextBoxEMail.Text = ""; this.EMailBodyHtml = ""; } else { //TextBoxEMail.Text = reminderEmail.EmailBody; //TextBoxEMail.Text = Server.HtmlDecode(reminderEmail.EmailBody); this.EMailBodyHtml = reminderEmail.EmailBody; } }