protected void MasterDetail_Item_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { WebModuleInfo MasterDetailModule = (WebModuleInfo)e.Row.DataItem; WebpageInfo page = MasterDetailModule.Webpage; MasterDetailItem item = MasterDetailItem.GetSafeResource(MasterDetailModule.Id); System.Web.UI.HtmlControls.HtmlAnchor selectLink = (System.Web.UI.HtmlControls.HtmlAnchor)e.Row.FindControl("SelectLink"); selectLink.HRef = ResolveUrl(MasterDetailModule.GetEditUrl()) //cheesy + "&returnTo=" + Server.UrlEncode(Request.Url.PathAndQuery); selectLink.InnerHtml = MasterDetailItem.Chop(page.Title, 45, true); Literal postDateCtl = (Literal)e.Row.FindControl("PostDateCtl"); if (page.PostDate.HasValue) { postDateCtl.Text = page.PostDate.Value.ToShortDateString(); if (page.PostDate.Value.TimeOfDay.TotalSeconds > .001) { postDateCtl.Text = string.Format("{0} {1}", postDateCtl.Text, page.PostDate.Value.ToShortTimeString()); } } CheckBox visibleCtl = (CheckBox)e.Row.FindControl("VisibleCtl"); visibleCtl.Checked = page.Visible; CheckBox featuredCtl = (CheckBox)e.Row.FindControl("FeaturedCtl"); featuredCtl.Checked = item.IsFeatured; } }
public void EmailNotifyAdmin() { try { var body = new StringBuilder(); string strNotifyEmails = this.FormBuilder_Module.NotifyEmail; string[] astrNotifyEmails = strNotifyEmails.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); if (astrNotifyEmails.Length > 0) { WebModuleInfo module = WebModule.GetModule(this.FormBuilder_Module.ModuleId); var dbContext = new FormBuilderDataContext(); List <FormBuilder_FieldInput> lInputsSorted = (from i in dbContext.FormBuilder_FieldInputs where i.ResponseId == this.Id orderby i.FormBuilder_Field.SortOrder select i).ToList(); foreach (var input in lInputsSorted) { if (input.FormBuilder_Field.Type == (int)FormBuilder_Field.FieldType.FileUpload && !String.IsNullOrEmpty(input.InputValue)) { body.Append(input.FormBuilder_Field.Name + String.Format(": <b>{0}", input.InputValue.Replace("~", "").Replace("//", "").Replace(@"\", "")) + "</b><br>"); } else if (input.FormBuilder_Field.Type == (int)FormBuilder_Field.FieldType.SectionHeader) { body.Append(String.Format("<br/><b>{0}</b><br/>", input.FormBuilder_Field.Name)); } else { body.Append(input.FormBuilder_Field.Name + ": <b>" + input.InputValue + "</b><br>"); } } MailMessage email = new MailMessage(); foreach (string strNotifyEmail in astrNotifyEmails) { MailAddress address = new MailAddress(strNotifyEmail.Trim()); email.To.Add(address); } email.Body = "<font face='Arial'>New form response submission has been received.<br>" + "<hr>" + body + "<br>" + "To view all form responses, " + "<a href='" + Common.Web.Url.ToAbsoluteUrl(module.GetEditUrl()) + "'>click here</a>." + "</font>"; email.Subject = string.Format("{0}: {1}", Website.Current.Resource.Name, module.Webpage.Title); email.IsBodyHtml = true; new SmtpClient().Send(email); } } catch (Exception ex) { string strMessage = "Failed sending contact us notification message"; BayshoreSolutions.WebModules.WebModulesAuditEvent.Raise(strMessage, this, ex); } }