protected void ButtonPreview_Click(object sender, EventArgs e) { Person currentPerson = Person.FromIdentity(Convert.ToInt32(HttpContext.Current.User.Identity.Name)); Organization org = Organization.FromIdentity(Convert.ToInt32(this.DropOrganizations.SelectedValue)); Geography geo = Geography.FromIdentity(Convert.ToInt32(this.DropGeographies.SelectedValue)); TypedMailTemplate template; if (this.DropRecipients.SelectedValue == "Members") { MemberMail membermail = new MemberMail(); template = membermail; membermail.pSubject = this.TextSubject.Text; membermail.pBodyContent = this.RadEditorBody.Content; membermail.pOrgName = org.MailPrefixInherited; membermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } else { OfficerMail officermail = new OfficerMail(); template = officermail; officermail.pSubject = this.TextSubject.Text; officermail.pBodyContent = this.RadEditorBody.Content; officermail.pOrgName = org.MailPrefixInherited; officermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } OutboundMail fake = template.CreateOutboundFake(currentPerson, org, geo); this.LiteralPreview.Text = fake.RenderHtml(currentPerson, org.DefaultCountry.Culture); this.RadEditorBody.Focus(); }
protected void ButtonSend_Click(object sender, EventArgs e) { if (this.TextBody.Text.Length > 1) { ClientScript.RegisterStartupScript(this.GetType(), "StartupMessage", "alert('Your mail has been placed on the outbound queue. You will receive status reports in e-mail as the transmission progresses.');", true); Person currentPerson = Person.FromIdentity(Convert.ToInt32(HttpContext.Current.User.Identity.Name)); Organization org = Organization.FromIdentity(Convert.ToInt32(this.DropOrganizations.SelectedValue)); if (this.DropGeographies.SelectedIndex < 0) { return; } Geography geo = Geography.FromIdentity(Convert.ToInt32(this.DropGeographies.SelectedValue)); TypedMailTemplate template; if (this.DropRecipients.SelectedValue == "Members") { MemberMail membermail = new MemberMail(); template = membermail; membermail.pSubject = this.TextSubject.Text; membermail.pBodyContent = this.TextBody.Text; membermail.pOrgName = org.MailPrefixInherited; membermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } else { OfficerMail officermail = new OfficerMail(); template = officermail; officermail.pSubject = this.TextSubject.Text; officermail.pBodyContent = this.TextBody.Text; officermail.pOrgName = org.MailPrefixInherited; officermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } OutboundMail mail = template.CreateOutboundMail(currentPerson, OutboundMail.PriorityNormal, org, geo); // We're not resolving recipients here, but deferring that to PirateBot after pickup mail.SetReadyForPickup(); } else { ClientScript.RegisterStartupScript(this.GetType(), "StartupMessage", "alert('Nothing to do, the mail is empty...');", true); } }
protected void ButtonSend_Click(object sender, EventArgs e) { if (this.RadEditorBody.Text.Length > 1) { ClientScript.RegisterStartupScript(this.GetType(), "StartupMessage", "alert('Your mail has been placed on the outbound queue. You will receive status reports in e-mail as the transmission progresses.');", true); Person currentPerson = Person.FromIdentity(Convert.ToInt32(HttpContext.Current.User.Identity.Name)); Organization org = Organization.FromIdentity(Convert.ToInt32(this.DropOrganizations.SelectedValue)); Geography geo = Geography.FromIdentity(Convert.ToInt32(this.DropGeographies.SelectedValue)); TypedMailTemplate template; if (this.DropRecipients.SelectedValue == "Members") { MemberMail membermail = new MemberMail(); template = membermail; membermail.pSubject = this.TextSubject.Text; membermail.pBodyContent = this.RadEditorBody.Content ; membermail.pOrgName = org.MailPrefixInherited; membermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } else { OfficerMail officermail = new OfficerMail(); template = officermail; officermail.pSubject = this.TextSubject.Text; officermail.pBodyContent = this.RadEditorBody.Content; officermail.pOrgName = org.MailPrefixInherited; officermail.pGeographyName = (geo.Identity == Geography.RootIdentity ? org.NameShort : geo.Name); } OutboundMail mail = template.CreateOutboundMail(currentPerson, OutboundMail.PriorityNormal, org, geo); // We're not resolving recipients here, but deferring that to PirateBot after pickup mail.SetReadyForPickup(); } else { ClientScript.RegisterStartupScript(this.GetType(), "StartupMessage", "alert('Nothing to do, the mail is empty...');", true); // Set error message - NEED BODY! } }