protected void btnAnnuler_Click(object sender, EventArgs e) { //Annuler le RDV Appointement appointement = apf.GetByUserId(user.userId); Availability availability = af.GetById(appointement.availabilityId); apf.DeleteAndFreeAvail(appointement.appointementId); //Envoyer le email d'annulation a jmGuay EmailController ec = new EmailController(); string body = string.Empty; using (StreamReader reader = new StreamReader(Server.MapPath("~/Email/AnnulationRDV.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{date}", availability.strdt.ToString("D", CultureInfo.CreateSpecificCulture("fr-FR"))); body = body.Replace("{prenom}", user.firstname); body = body.Replace("{nom}", user.lastname); body = body.Replace("{email}", user.email); ec.SendMail(emailAddress, "Annulation du rendez-vous de " + user.firstname + " " + user.lastname, body); Response.Redirect("RendezVous.aspx"); }
private void Refuse(int id) { Appointement app = af.Get(id); User user = uf.Get(app.userId); Availability avail = avf.GetById(app.availabilityId); af.DeleteAndFreeAvail(id); //On envoie un mail de refus EmailController ec = new EmailController(); string body = string.Empty; using (StreamReader reader2 = new StreamReader(Server.MapPath("~/Email/RefusRDV.html"))) { body = reader2.ReadToEnd(); } body = body.Replace("{user}", user.firstname); body = body.Replace("{date}", avail.strdt.ToString("f", CultureInfo.CreateSpecificCulture("fr-FR"))); ec.SendMail(user.email, "JMGuay.ca - Annulation du rendez-vous [Message automatique]", body); }