/// <summary>
        /// Stuurt een bevestigingsmail van inschrijving naar de gebruiker.
        /// Hiervoor wordt de nieuwsbrief template gebruikt.
        /// </summary>
        /// <param name="model"></param>
        private void SendSubscriptionConfirmationMail(InschrijvingModel model)
        {
            NewsletterViewModel newsletter = new NewsletterViewModel();
            newsletter.IncludeLoginLink = true;
            newsletter.Items = new List<NewsletterItemViewModel>();

            if (!model.DoForceSendConfirmationOfChange) {
                newsletter.IntroText = string.Format("Proficiat! Je hebt je zojuist aangemeld voor Hét Rondje Eilanden! ");
                if (!model.IsBetaald.HasValue || !model.IsBetaald.Value) {
                    newsletter.IntroText += "Je aanmelding wordt omgezet naar een inschrijving na betaling van het inschrijfgeld.";
                } else {
                    newsletter.IntroText += "Je hebt betaald en bent nu ingeschreven.";
                }
            } else {
                if (model.EmailBeforeUpdateIfAny!=model.Email) {
                    newsletter.IntroText = string.Format("Je bent aangemeld voor Hét Rondje Eilanden! Je hebt je e-mail adres gewijzigd, of iemand anders heeft zijn inschrijving naar jouw e-mail overgezet. Bevestig je inschrijving en dit e-mail adres via onderstaande link. ");
                } else {
                    newsletter.IntroText = string.Format("Hier een Flessenpost achtige mail omdat je je inschrijfgegevens hebt gewijzigd.");
                }
            }
            newsletter.IntroText += "<br/>Hieronder ter bevestiging nogmaals je inschrijfgegevens. Als er iets niet klopt graag direct zelf wijzigen door op de website in te loggen via de persoonlijke link hiernaast.";

            NewsletterItemViewModel item1 = new NewsletterItemViewModel();
            if (!model.DoForceSendConfirmationOfChange) {
                item1.Title = "You're in!";
                item1.SubTitle = "voor Hét Rondje Eilanden";
            } else {
                item1.Title = "Thanks for the update!";
                item1.SubTitle = "...change is the only constant :)";
            }
            item1.HeadingHtmlColour = "208900";
            item1.ImagePath = "News_2013.png";
            item1.IconImagePath = "News_TileEB.png";

            item1.Text = string.Format("");
            item1.Text += string.Format("<table>");
                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Inschrijfgegevens</b></th></tr>");

                item1.Text += string.Format("<tr><td>Naam</td><td>{0}</span></td></tr>", model.VolledigeNaamMetAanhef);
                item1.Text += string.Format("<tr><td>Geboortedatum</td><td>{0}</span></td></tr>", model.GeboorteDatum.HasValue ? model.GeboorteDatum.Value.ToShortDateString() : "-");
                item1.Text += string.Format("<tr><td>NTB Licentie</td><td>{0}</span></td></tr>", string.IsNullOrEmpty(model.LicentieNummer) ? " - " : model.LicentieNummer);
                item1.Text += string.Format("<tr><td>Persoonlijke MyLaps Chip</td><td>{0}</span></td></tr>", string.IsNullOrEmpty(model.MyLapsChipNummer) ? " - " : model.MyLapsChipNummer);

                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Persoonsgegevens</b></th></tr>");

                item1.Text += string.Format("<tr><td>Geslacht</td><td>{0}</span></td></tr>", model.Geslacht ?? "-");
                item1.Text += string.Format("<tr><td>Straat</td><td>{0}</span></td></tr>", model.Straat ?? "-");
                item1.Text += string.Format("<tr><td>Huisnummer</td><td>{0}</span></td></tr>", model.Huisnummer ?? "-");
                item1.Text += string.Format("<tr><td>Toevoeging</td><td>{0}</span></td></tr>", model.HuisnummerToevoeging ?? "-");
                item1.Text += string.Format("<tr><td>Postcode</td><td>{0}</span></td></tr>", model.Postcode ?? "-");
                item1.Text += string.Format("<tr><td>Woonplaats</td><td>{0}</span></td></tr>", model.Woonplaats?? "-");
                item1.Text += string.Format("<tr><td>Land</td><td>{0}</span></td></tr>", model.Land ?? "-");
                item1.Text += string.Format("<tr><td>E-mail adres</td><td>{0}</span></td></tr>", model.Email ?? "-");
                item1.Text += string.Format("<tr><td>Telefoon</td><td>{0}</span></td></tr>", model.Telefoon ?? "-");

                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Extra's</b></th></tr>");

                item1.Text += string.Format("<tr><td>Meeeten?</td><td>{0}</span></td></tr>", model.Food ? "Ja" : "Nee");
                item1.Text += string.Format("<tr><td>Kamperen</td><td>{0}</span></td></tr>", model.Camp ? "Interesse" : "Geen interesse");
                item1.Text += string.Format("<tr><td>Fiets stallen</td><td>{0}</span></td></tr>", model.Bike ? "Interesse" : "Geen interesse");
                item1.Text += string.Format("<tr><td>Finale</td><td>{0}</span></td></tr>", model.Finale=="W" ? "Ik ga ervoor!" : "Ik zie wel" );

                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Opmerkingen</b></th></tr>");

                item1.Text += string.Format("<tr><td>Opmerkingen</td><td>{0}</span></td></tr>", model.HebJeErZinIn ?? "-");
                item1.Text += string.Format("<tr><td>Opmerkingen voor speaker</td><td>{0}</span></td></tr>", model.OpmerkingenTbvSpeaker?? "-");
                item1.Text += string.Format("<tr><td>Opmerkingen voor organisatie</td><td>{0}</span></td></tr>", model.OpmerkingenAanOrganisatie ?? "-");

                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Inschrijfkosten</b></th></tr>");
                item1.Text += string.Format("<tr><td>Inschrijfgeld</td><td>{0}</span></td></tr>", model.BasisKosten.AsAmount() );
                item1.Text += string.Format("<tr><td>NTB Licentie</td><td>{0}</span></td></tr>", model.KostenNtbDagLicentie.AsAmount() );
                item1.Text += string.Format("<tr><td>MyLaps Chip</td><td>{0}</span></td></tr>", model.KostenChip.AsAmount());
                if (model.IsEarlyBird.HasValue && model.IsEarlyBird.Value) {
                    item1.Text += string.Format("<tr><td>Early Bird™ korting</td><td>{0}</span></td></tr>", model.EarlyBirdKorting.AsAmount());
                }
                item1.Text += string.Format("<tr><td>Avondeten</td><td>{0}</span></td></tr>", model.KostenEten.AsAmount());
                item1.Text += string.Format("<tr><td><b></b></td><td><span class=\"quotable\">------</span></td></tr>");
                item1.Text += string.Format("<tr><td><b>Totaal</b></td><td><span class=\"quotable\">{0}</span></td></tr>", model.InschrijfGeld.AsAmount());

                item1.Text += string.Format("<tr><td>Betaalwijze</td><td>{0}</span></td></tr>", model.Betaalwijze.Value.ToString());
                item1.Text += string.Format("<tr><td>Betaald?</td><td>{0}</span></td></tr>", model.DatumBetaald.HasValue ? model.DatumBetaald.Value.ToShortDateString() : "Nog niet");
                item1.Text += string.Format("<tr><td><b></b></td><td><span class=\"quotable\">------</span></td></tr>");
                item1.Text += string.Format("<tr><td><b>Totaal</b></td><td><span class=\"quotable\">{0}</span></td></tr>", model.InschrijfGeld.AsAmount());

                /*
                item1.Text += string.Format("<tr><td></td></tr>");
                item1.Text += string.Format("<tr><th colspan=\"2\"><b>Overmaken naar</b></th></tr>");

                item1.Text += string.Format("<tr><td>Bank rek nr</td><td><span class=\"quotable\">'1684.92.059'</span> (Rabobank)</td></tr>");
                item1.Text += string.Format("<tr><td>Ten name van </td><td><span class=\"quotable\">'Stichting Woelig Water'</span> (te Vinkeveen)</td></tr>");
                item1.Text += string.Format("<tr><td>Onder vermelding van</td><td><span class=\"quotable\">'H2RE {0}'</span></td></tr>", model.VolledigeNaam);
                */

                item1.Text += string.Format("</table></td></tr>");
                item1.Text += string.Format("</table>");

            newsletter.Items.Add(item1);

            SendPersonalNewsletterViewModel spnvm = new SendPersonalNewsletterViewModel();
            spnvm.IsEmail = true;
            spnvm.Newsletter = newsletter;

            MailMessage mm = new MailMessage();
            mm.From = new MailAddress(HreSettings.ReplyToAddress);
            mm.To.Add(new MailAddress(model.Email));

            // Send the confirmation mail to an appsetting defined admin email address for backup purposes.
            mm.Bcc.Add(new MailAddress(HreSettings.ConfirmationsCCAddress));

            if (!string.IsNullOrEmpty(model.OpmerkingenAanOrganisatie)) {
                mm.Bcc.Add(new MailAddress(HreSettings.MailAddressSecretary));
            }

            mm.Subject = model.DoForceSendConfirmationOfChange ?
                "Wijziging in inschrijfgegevens Hét Rondje Eilanden " + model.VolledigeNaam
                : "Aanmeldbevestiging deelname Hét Rondje Eilanden " + model.VolledigeNaam;

            mm.IsBodyHtml = true;
            spnvm.UserId = model.UserId;
            mm.Body = this.RenderNewsletterViewToString("../Newsletter/NewsletterTemplates/NewsletterTemplate", spnvm);
            EmailSender.SendEmail(mm, EmailCategory.SubscriptionConfirmation, model.ParticipationId, model.UserId);

            model.DateConfirmationSend = DateTime.Now;

            // Sla de entry nog een keer op, om ook de dateConfirmationSend op te slaan.
            // TODO BW 2013-03-01: Doe dit wat netter dan alles geheel twee keer opslaan.
            InschrijvingenRepository.SaveEntry(model, model.ExternalEventIdentifier, false, true);
        }
示例#2
0
 // [AllowAnonymous]
 public ActionResult Display(int newsletterId)
 {
     NewsletterViewModel nvm = NewsletterRepository.GetByID(newsletterId);
     if (nvm != null) {
         SendPersonalNewsletterViewModel spnvm = new SendPersonalNewsletterViewModel();
         spnvm.NewsletterId = newsletterId;
         spnvm.UserId = LogonUserDal.GetByEmailAddress("*****@*****.**").Id;
         return View("NewsletterTemplates/NewsletterTemplate", spnvm);
     } else {
         return RedirectToAction("Index", "Home");
     }
 }
示例#3
0
        public ActionResult SendNewsletter(SendPersonalNewsletterViewModel spnvm)
        {
            // NewsletterViewModel nvm = NewsletterRepository.GetByID(snlvm.NewsletterId);
            spnvm.IsEmail=true;
            string Newsletter = this.RenderNewsletterViewToString("NewsletterTemplates/NewsletterTemplate", spnvm);

            MailMessage message = new MailMessage();
            message.From = new MailAddress(HreSettings.ReplyToAddress, HreSettings.ReplyToAddress);
            message.To.Add(new MailAddress(LogonUserDal.GetByID(spnvm.UserId).EmailAddress));
            message.Subject = spnvm.Newsletter.Title;
            message.IsBodyHtml = true;
            message.Body = Newsletter;
            if (!string.IsNullOrEmpty(spnvm.Newsletter.AttachmentFilePath)) {
                string filePath = Request.MapPath(spnvm.Newsletter.AttachmentFilePath);
                if (System.IO.File.Exists(filePath)) {
                    Attachment attachment = new Attachment(filePath);
                    message.Attachments.Add(attachment);
                }
            }
            EmailSender.SendEmail(message, EmailCategory.Newsletter, spnvm.NewsletterId, spnvm.UserId);

            return View(spnvm);
        }
示例#4
0
        public ActionResult Sent(int Id)
        {
            SendPersonalNewsletterViewModel spnvm = new SendPersonalNewsletterViewModel();
            spnvm.NewsletterId = Id;
            spnvm.IsEmail = true;

            if (spnvm.Newsletter.DateSent == null) {
                List<LogonUserDal> users = LogonUserDal.GetNewsletterReceivers(spnvm.Newsletter.SubscriptionStatus);
                MailMessage mm = new MailMessage();
                mm.From = new MailAddress(HreSettings.ReplyToAddress);
                mm.Subject = spnvm.Newsletter.Title;
                mm.IsBodyHtml = true;

                // TODO BW 2013-06-15: Below the SingleUserId and TestUserId are cleared to prevent using any selected test user and/or singleuser when sending newsletter to everyone. This occurred on 15-6-2013.
                // This is due to logic in the UserId property of SendPersonalNewsletterViewModel. Maybe this model should be made aware of if it's sending in test mode or actual or something, to make this more transparant.
                spnvm.SingleUserId=null;
                spnvm.TestUserId=null;
                // END TODO.

                foreach (LogonUserDal user in users) {
                    spnvm.UserId = user.Id;
                    mm.Body = this.RenderNewsletterViewToString("NewsletterTemplates/NewsletterTemplate", spnvm);
                    mm.To.Clear();
                    mm.To.Add(new MailAddress(user.EmailAddress));
                    EmailSender.SendEmail(mm, EmailCategory.Newsletter, spnvm.Newsletter.ID, spnvm.UserId);
                }
                spnvm.Newsletter.DateSent = DateTime.Now;
                NewsletterRepository.UpdateNewsletter(spnvm.Newsletter);
                ViewBag.message = "E-mails met succes verstuurd!";
            } else {
                ViewBag.message = "Deze nieuwsbrief is al eens verstuurd, neem contact op met de technische jongens.";
            }

            return View();
        }
示例#5
0
 public ActionResult SendNewsletter(int newsletterId)
 {
     SendPersonalNewsletterViewModel snl = new SendPersonalNewsletterViewModel() {
         NewsletterId = newsletterId
     };
     return View(snl);
 }