static void SendEmail(HttpException exception, string appName, MailAddress from, MailAddress to) { Trace.TraceInformation("[RazorRenderExceptionHelper]: Preparing to send email to developer"); string body = exception.GetHtmlErrorMessage(); bool html = true; if (string.IsNullOrWhiteSpace(body)) { body = exception.ToString(); html = false; } string subject = string.Format("Exception for app: {0}, at {1}", appName, DateTime.Now); EmailExtensions.SendEmail(from, to, subject, body, !html, (message, ex) => { if (ex == null) { Trace.TraceInformation("[RazorRenderExceptionHelper]: Email was sent to {0}", to); } else { Trace.TraceError("[RazorRenderExceptionHelper]: Failed to send email. {0}", ex.Message); LogEvent.Raise(exception.Message, exception.GetBaseException()); } }); }
public ActionResult SendEmail(CustomerEmailModel model) { if (!ModelState.IsValid) { return(View(model)); } var customer = db.Patients.Where(o => o.Email == model.Email).FirstOrDefault(); //EmailExtensions.SendMail(model.Email, model.Subject, model.Body); EmailExtensions.SendSms(customer.ContactNumber, model.Body); return(RedirectToAction("Index")); }
public async override void Execute() { if (Config.IsInDebugMode) { return; } using (DisposableTimer.StartNew("PingHost Task ...")) { var url = string.Format("{0}?source={1}", RequestCheck.HostUrl, Guid.NewGuid().ToString("N")); Trace.TraceInformation("Making a request to {0}", url); var webRequest = WebRequest.Create(url); webRequest.Method = "HEAD"; using (var webResponse = await webRequest.GetResponseAsync()) { var httpResponse = (HttpWebResponse)webResponse; Trace.TraceInformation("[Task]: Status = {0}", httpResponse.StatusCode); if (httpResponse.StatusCode != HttpStatusCode.OK) { //todo: melhorar HTML/ conteúdo var headers = httpResponse.Headers; var sb = new StringBuilder(); sb.AppendFormat("Status: {0}", httpResponse.StatusCode).AppendLine(); sb.AppendFormat("Description: {0}", httpResponse.StatusDescription).AppendLine(); sb.AppendFormat("Server: {0}", httpResponse.Server).AppendLine(); sb.AppendFormat("ContentLength: {0}", httpResponse.ContentLength).AppendLine(); sb.AppendFormat("ContentType: {0}", httpResponse.ContentType).AppendLine(); string html = sb.ToString(); foreach (var header in headers) { html += header + Environment.NewLine; } Trace.TraceInformation("Send task info email"); await EmailExtensions.SendEmailAsync(new MailAddress(BootstrapperSection.Instance.Mail.MailAdmin), new MailAddress(BootstrapperSection.Instance.Mail.MailDeveloper), "Task Execution: " + BootstrapperSection.Instance.AppName, html, false, (message, exception) => { }); } } } }
public async Task <IActionResult> ConfirmEmail(string userId, string code) { if (userId == null || code == null) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } var user = await _userManager.FindByIdAsync(userId); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{userId}'."); } // var id = Int32.Parse(userId); var result = await _userManager.ConfirmEmailAsync(user, code); if (result.Succeeded) { var url = Request.Host.Value; var link = Url.Action( "Login", "Account", values: new { email = user.Email }, protocol: Request.Scheme ); //var link = $"https://{url}/Account/ConfirmEmail?userId={user.Id}&code={code}"; var htmlString = await razorViewToStringRenderer.RenderViewToStringAsync("EmailTemplate", new EmailTemplate { Title = "Congratulation", Body = $"<a target=\"_blank\" href=\"{HtmlEncoder.Default.Encode(link)}\">ScoreExec</a>", Message = " <p>Assalam-o-Alaikum</p> <p>Dear User</p> <p>You are approved by the admin</p> <p>User Name: </P>" + user.UserName + "<p>Email: </p>" + user.Email }); string subject = "Email Confirmation"; await _signInManager.SignInAsync(user, isPersistent : false); await EmailExtensions.Execute(user.Email, user.UserName, htmlString, subject); } return(RedirectToAction("ApprovedUser", "Account")); }
public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (ModelState.IsValid) { var user = await _userManager.FindByEmailAsync(model.Email); if (user == null || !(await _userManager.IsEmailConfirmedAsync(user))) { // Don't reveal that the user does not exist or is not confirmed return(RedirectToAction(nameof(ForgotPasswordConfirmation))); } // For more information on how to enable account confirmation and password reset please // visit https://go.microsoft.com/fwlink/?LinkID=532713 var code = await _userManager.GeneratePasswordResetTokenAsync(user); var url = Request.Host.Value; string adminEmail = model.Email; string subject = "Reset Password"; var link = $"https://{url}/Account/ResetPassword?userId={user.Id}&code={code}"; var htmlString = await razorViewToStringRenderer.RenderViewToStringAsync("EmailTemplate", new EmailTemplate { Title = "Reset Password", Body = $"<a target=\"_blank\" href=\"{link}\">Click here</a>", Message = "<p>Asslam-o-Alaikum</p> <p>Dear User</p> <p>Click the below link to change or reset your passowrd</p>" }); await EmailExtensions.Execute(adminEmail, null, htmlString, subject); //var callbackUrl = Url.ResetPasswordCallbackLink(user.Id, code, Request.Scheme); //await _emailSender.SendEmailAsync(model.Email, "Reset Password", //$"Please reset your password by clicking here: <a href='{callbackUrl}'>link</a>"); return(RedirectToAction(nameof(PendingResertPasswordRequest))); } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult ChangeOrderStatus(int orderId, int statusId) { var order = db.CustomerOrders.Find(orderId); var status = db.OrderStatuses.Find(statusId); order.OrderStatusId = statusId; order.OrderStatus = status; db.Entry(order).State = System.Data.Entity.EntityState.Modified; db.Notifications.PushNotificaiton(string.Format("You changed Customer Order #{0} status", orderId)); db.SaveChanges(); //EmailExtensions.SendMail(order.Email, "Doctor J Govender: Order #" + order.Id, // "Order Status changed to " + status.Name); EmailExtensions.SendSms(order.PhoneNumber, "Doctor J Govender: Order #" + order.Id + "Order Status changed to " + status.Name); return(RedirectToAction("Index")); }
public ActionResult Complete(int?id) { var orderId = Convert.ToInt32(Session["CustomerOrderId"]); var orderId1 = customerOrderRepository.GetOrderId(this.HttpContext); var patientId = Convert.ToInt32(Session["id"]); var order = db.CustomerOrders.Find(orderId1); var patient = db.Patients.Find(patientId); string status = "Unknown"; switch (id.ToString()) { case "-2": status = "Unable to reconsile transaction"; break; case "-1": status = "Checksum Error. The values have been altered"; break; case "0": status = "Not Done"; break; case "1": //status = "Approved"; status = customerOrderRepository.PaymentApproved(this.HttpContext); break; case "2": //status = "Declined"; status = customerOrderRepository.PaymentDeclined(this.HttpContext); break; case "3": status = "Cancelled"; break; case "4": status = "User Cancelled"; break; default: status = $"Unknown Status({ id })"; break; } TempData["Status"] = status; if (status == "Approved") { var callbackUrl = Url.Action("view-order", "order", new { area = "store", id = order.Id }, protocol: Request.Url.Scheme); var loyaltyLink = Url.Action("Subscribe", "Loyalties", new { patientId = order.Customer.UserID }); //EmailExtensions.SendMail(order.Email, "Doctor J Govender Pharmacy: Thank you for you Purchase!", // string.Format("<h1><strong>Hello {0}</strong></h1> <br><br>" + // "Thank you for your recent transaction on our Pharmacy." + // "If you are new to our store and not a loyalty member, you can sign up for free for rewards.<br><br>" + // "Your order has being successfully approved and is being processed.<br>" + // "<a href=\"" + callbackUrl + "\">View Order Here</a></strong>", order.Customer.FirstName)); //EmailExtensions.SendSms(order.Email, "Doctor J Govender Pharmacy: Thank you for you Purchase! Your order has being successfully approved and is being processed." + callbackUrl); EmailExtensions.SendSms(order.PhoneNumber, "Doctor J Govender Pharmacy: Thank you for your purchase! Total R" + order.TotalCost); //var client = new Client(creds: new Nexmo.Api.Request.Credentials //{ // ApiKey = "0f48d10b", // ApiSecret = "R0hfbIdGjgNcG9Aa" //}); //var results = client.SMS.Send(request: new SMS.SMSRequest //{ // from = "Dr J Govender", // to = order.PhoneNumber, // text = "Doctor J Govender Pharmacy: Thank you for you Purchase!" //}); db.Notifications.PushNotificaiton(string.Format("A Customer placed an order: #{0}", order.Id)); if (patient.isLoyal) { var loyalty = db.Loyalties.Where(l => l.PatientId == patientId).FirstOrDefault(); var prefs = db.LoyaltyPreferences.FirstOrDefault(); loyalty.Loyalty_Points += 25; if (loyalty.Loyalty_Points >= prefs.PointsLimit) { db.Coupons.Add(new PharmacyEntities.Coupon { isLoyaltyCoupon = true, Code = string.Format("{0}-{1}-{2}", prefs.CouponCode, patient.UserID, order.Id), Description = "Loyalty Coupon", EndDate = DateTime.Now.AddMonths(prefs.MonthsToExpiry), StartDate = DateTime.Today, DiscountRate = prefs.CouponDiscountRate, Active = true, Display = false }); db.SaveChanges(); var coup = db.Coupons.OrderByDescending(c => c.Id).FirstOrDefault(); //EmailExtensions.SendMail(patient.Email, prefs.Subject, // string.Format("<h1 class='text-center'>Code: {0}-{1}-{2}</h1> <br><br>" + // "Valid until {3}<br>" + // "Discount Rate: {4}%" + // "{5}", prefs.CouponCode, patient.UserID, order.Id, coup.EndDate.ToLongDateString(), coup.DiscountRate, prefs.Body)); EmailExtensions.SendSms(patient.ContactNumber, string.Format(prefs.Subject + "Code: {0}-{1}-{2} . Valid until {3}. Discount Rate: {4}%", prefs.CouponCode, patient.UserID, order.Id, coup.EndDate.ToLongDateString(), coup.DiscountRate)); loyalty.Loyalty_Points = 0; } db.Entry(loyalty).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); } return(View()); }
public async Task <ActionResult> CreateOrder(NewPurchaseVM model) { if (ModelState.IsValid) { Supplier supplier = db.Suppliers.Find(model.SupplierId); // Change order status OrderStatus defaultOrderStatus = await db.OrderStatuses.Where(os => os.ProcessNumber == 2) .FirstOrDefaultAsync(); // Cant buy stock if theres no items in the cart if (!db.StockCarts.Any(c => c.SupplierId == model.SupplierId)) { TempData["Error"] = "There is no items in the cart to place order."; return(Redirect("/Pharmacist/StockOrders/NewPurchase?supplierId=" + model.SupplierId)); } db.StockOrders.Add(new StockOrder { SupplierId = model.SupplierId, PaymentPeriod = model.PaymentPeriod, StockOrderDate = DateTime.Now, TotalCost = model.TotalPrice, Notes = model.Notes, SubTotal = model.SubTotal, TotalTax = model.TaxTotal, Supplier = supplier, OrderStatusId = defaultOrderStatus.Id, OrderStatus = defaultOrderStatus }); await db.SaveChangesAsync(); // Assign orderid to stockcart items var stockCart = await db.StockCarts.Where(c => c.StockOrderId.Equals(null)).ToListAsync(); var latestOrder = await db.StockOrders.OrderByDescending(o => o.Id).FirstAsync(); stockCart.ForEach(c => c.StockOrderId = latestOrder.Id); // Order Id Should Equal to the latest order // Add notification db.Notifications.Add(new Notification { CreatedDate = DateTime.Now, Message = "You have placed an order of R" + latestOrder.TotalCost, isRead = false, Icon = "fa-file-alt", BackgroundColorIcon = "bg-info" }); await db.SaveChangesAsync(); var callbackUrl = Url.Action("InvoiceToPdf", "StockOrders", new { area = "pharmacist", id = latestOrder.Id }, protocol: Request.Url.Scheme); //EmailExtensions.SendMail(supplier.Email, "Request For A Stock Order", // string.Format("Good day. <br><br>I would like to request a stock order of R{0}.<br><br>" + // "<a href=\"" + callbackUrl + "\">Review Order Details Here</a><br><br>" + // "<strong>Order Notes: <strong><br>" + // "{2}", latestOrder.TotalCost, latestOrder.Id, latestOrder.Notes)); EmailExtensions.SendSms(supplier.ContactNumber, string.Format("From Dr J Govender Practice: Good day. I would like to request a stock order of R{0}. " + "Order Notes: {1}", latestOrder.TotalCost, latestOrder.Notes)); return(RedirectToAction("Index")); } return(View(model)); }
public static void PostStart() { if (_initialized) { return; } _initialized = true; var cfg = BootstrapperSection.Instance; using (DisposableTimer.StartNew("Frankstein POST_START...")) { Trace.TraceInformation("[Bootstrapper]:Debugging Enabled: {0}", HttpContext.Current.IsDebuggingEnabled); Trace.TraceInformation("[Bootstrapper]:CustomErrors Enabled: {0}", HttpContext.Current.IsCustomErrorEnabled); var commitId = Config.ValueOrDefault("appharbor.commit_id", ""); Trace.TraceInformation("[Bootstrapper]:Commit Id: {0}", commitId); Trace.TraceInformation("[Bootstrapper]:cfg.MvcTrace.Enabled = {0}", cfg.MvcTrace.Enabled); if (cfg.MvcTrace.Enabled) { GlobalFilters.Filters.Add(new MvcTracerFilter()); } Trace.TraceInformation("[Bootstrapper]:cfg.InsertRoutes = {0}", cfg.InsertRoutes); if (cfg.InsertRoutes) { var routes = RouteTable.Routes; routes.RouteExistingFiles = false; routes.LowercaseUrls = true; routes.AppendTrailingSlash = true; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); //routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(css|js|txt|png|gif|jpg|jpeg|bmp)(/.*)?" }); routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(?i)(css|js|xml|txt|png|gif|jpg|jpeg|bmp|ico|woff|svg|ttf|eot)(/.*)?" }); routes.IgnoreRoute("Content/{*pathInfo}"); routes.IgnoreRoute("Scripts/{*pathInfo}"); routes.IgnoreRoute("Bundles/{*pathInfo}"); routes.MapMvcAttributeRoutes(); } Trace.TraceInformation("[Bootstrapper]:cfg.Verbose = {0}", cfg.Verbose); if (cfg.Verbose) { var application = HttpContext.Current.ApplicationInstance; var modules = application.Modules; Trace.Indent(); foreach (var module in modules) { Trace.TraceInformation("Module Loaded: {0}", module); } Trace.Unindent(); //dump routes var routes = RouteTable.Routes; var i = routes.Count; Trace.TraceInformation("[Bootstrapper]:Found {0} routes in RouteTable", i); Trace.Indent(); foreach (var routeBase in routes) { var route = routeBase as Route; if (route != null) { Trace.TraceInformation("Handler: {0} at URL: {1}", route.RouteHandler, route.Url); } else { //RouteCollectionRoute => mapped by AttributeRouting //it's internal, so it's elligible to access his methods and properties with ImpromptuInterface Trace.TraceInformation("route: {0}", routeBase); } } Trace.Unindent(); } //viewengine locations var mvcroot = cfg.DumpToLocal.Folder; var razorViewEngine = ViewEngines.Engines.OfType <RazorViewEngine>().FirstOrDefault(); if (razorViewEngine != null) { Trace.TraceInformation("[Bootstrapper]:Configuring RazorViewEngine Location Formats"); var vlf = new string[] { mvcroot + "/Views/{1}/{0}.cshtml", mvcroot + "/Views/Shared/{0}.cshtml", }; razorViewEngine.ViewLocationFormats = razorViewEngine.ViewLocationFormats.Extend(false, vlf); var mlf = new string[] { mvcroot + "/Views/{1}/{0}.cshtml", mvcroot + "/Views/Shared/{0}.cshtml", }; razorViewEngine.MasterLocationFormats = razorViewEngine.MasterLocationFormats.Extend(false, mlf); var plf = new string[] { mvcroot + "/Views/{1}/{0}.cshtml", mvcroot + "/Views/Shared/{0}.cshtml", }; razorViewEngine.PartialViewLocationFormats = razorViewEngine.PartialViewLocationFormats.Extend(false, plf); var avlf = new string[] { mvcroot + "/Areas/{2}/Views/{1}/{0}.cshtml", mvcroot + "/Areas/{2}/Views/Shared/{0}.cshtml", }; razorViewEngine.AreaViewLocationFormats = razorViewEngine.AreaViewLocationFormats.Extend(false, avlf); var amlf = new string[] { mvcroot + "/Areas/{2}/Views/{1}/{0}.cshtml", mvcroot + "/Areas/{2}/Views/Shared/{0}.cshtml", }; razorViewEngine.AreaMasterLocationFormats = razorViewEngine.AreaMasterLocationFormats.Extend(false, amlf); var apvlf = new string[] { mvcroot + "/Areas/{2}/Views/{1}/{0}.cshtml", mvcroot + "/Areas/{2}/Views/Shared/{0}.cshtml", }; razorViewEngine.AreaPartialViewLocationFormats = razorViewEngine.AreaPartialViewLocationFormats.Extend(false, apvlf); if (cfg.Verbose) { Trace.Indent(); foreach (var locationFormat in razorViewEngine.ViewLocationFormats) { Trace.TraceInformation(locationFormat); } Trace.Unindent(); } ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(razorViewEngine); } else { Trace.TraceInformation("[Bootstrapper]:Cannot Configure RazorViewEngine: View Engine not found"); } } Trace.Flush(); if (cfg.Verbose) { Trace.TraceInformation("Listing Attached TraceListeners..."); Trace.Indent(); var listeners = Trace.Listeners; foreach (var logger in listeners) { Trace.TraceInformation(logger.ToString()); } Trace.Unindent(); } var listener = Trace.Listeners["StartupListener"] as TextWriterTraceListener; if (listener != null) { listener.Flush(); listener.Close(); Trace.Listeners.Remove(listener); } //envia log de startup por email Trace.TraceInformation("[Bootstrapper]:cfg.Mail.SendStartupLog = {0}", cfg.Mail.SendStartupLog); if (cfg.Mail.SendStartupLog && !Config.IsInDebugMode) { if (!File.Exists(_traceFileName)) { return; } ThreadPool.QueueUserWorkItem(state => { var body = File.ReadAllText(_traceFileName); Trace.TraceInformation("[Bootstrapper]:Sending startup log email to {0}", cfg.Mail.MailDeveloper); EmailExtensions.SendEmail(new MailAddress(cfg.Mail.MailAdmin, "Admin"), new MailAddress(cfg.Mail.MailDeveloper, "Developer"), string.Format("App Startup Log: {0} at {1} ", cfg.AppName, DateTime.Now), body, true, (msg, ex) => { if (ex != null) { Trace.TraceError("[Bootstrapper]:Error sending startup log email: {0}", ex.Message); } else { Trace.TraceInformation("[Bootstrapper]:Startup log was sent successfully to {0}", msg.To[0]); } }); }); } }
public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.UserName, Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var url = Request.Host.Value; var link = Url.Action( "ConfirmEmail", "Account", values: new { userId = user.Id, code = code }, protocol: Request.Scheme ); //var link = $"https://{url}/Account/ConfirmEmail?userId={user.Id}&code={code}"; var htmlString = await razorViewToStringRenderer.RenderViewToStringAsync("EmailTemplate", new EmailTemplate { Title = "Email Confirmation", Body = $"<a target=\"_blank\" href=\"{HtmlEncoder.Default.Encode(link)}\">Yes it belongs to me</a>", Message = " <p>Assalam-o-Alaikum</p> <p>Hello Admin</p> <p>Please confirm, if this user " + model.UserName + " with the email " + model.Email + " belongs to you</P>" }); string adminEmail = "*****@*****.**"; string subject = "Email Confirmation"; //if (model.RoleName == "Club User") //{ // adminEmail = _context.ClubAdmins // .AsNoTracking() // .Where(i => i.TeamId == model.TeamId) // .Select(i => i.User.Email) // .Single(); //} //else //{ // adminEmail = "*****@*****.**"; //} await _signInManager.SignInAsync(user, isPersistent : false); _logger.LogInformation("User created a new account with password."); // await _userManager.AddToRoleAsync(user, model.RoleName); await EmailExtensions.Execute(adminEmail, model.UserName, htmlString, subject); return(RedirectToAction("PendingRequest", "Account")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void ConfigureAuth(IAppBuilder app) { // Configure the db context, user manager and signin manager to use a single instance per request app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext <ApplicationSignInManager>(ApplicationSignInManager.Create); // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider // Configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity <ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process. app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5)); // Enables the application to remember the second login verification factor such as phone or email. // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from. // This is similar to the RememberMe option when you log in. app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie); //datum en tijd weergeven van de moment dat de applicatie opstart DateTime vandaag = DateTime.Now; DateTime vorigeMaand = vandaag.AddMonths(-1); //als we de 6de van de maand zijn of indien dit in het weeken ligt we de 7de of 8ste zijn: if (vandaag.Day == 7 && vandaag.DayOfWeek == DayOfWeek.Monday || vandaag.Day == 8 && vandaag.DayOfWeek == DayOfWeek.Monday || vandaag.Day == 6) { //per lid in de database gaan we: foreach (Lid lid in ledenService.AlleLedenWeergeven()) { lid.Persoon = personenService.PersoonWeergeven(lid.PersoonId); //abonnement van lid opvragen Abonnement abonnement = abonnementsService.AbonnementWeergeven(lid.AbonnementId); //betaling aanmaken Betaling betaling = new Betaling() { Bedrag = abonnement.PrijsPerMaand, Datum = vandaag, Lidnummer = lid.LidNummer, Omschrijving = $"{abonnement.Naam} {vorigeMaand.Month}" }; betaling.BetalingsId = betalingenService.BetalingsIdBepalen(betaling.BetalingsId); //betaling toevoegen aan database betalingenService.BetalingToevoegen(betaling); //melding van deze te betalen betaling doorsturen naar e-mail IdentityMessage message = new IdentityMessage() { Body = "Er is een nieuwe factuur voor uw abonnement van vorige maand in Eagle Fit", Destination = lid.Persoon.Email, Subject = "Factuur Eagle Fit" }; EmailExtensions.Send(message); //te wijzigen abonnement op 0 staat, zo niet gaan we het abonnement wijzigen naar dit id en zetten we het te wijzigen id op 0, staat dit al op 0 gebeurt er niks if (lid.TeWijzigenAbonnementId != 0) { lid.AbonnementId = lid.TeWijzigenAbonnementId; lid.TeWijzigenAbonnementId = 0; ledenService.LidWijzigen(lid); } } } }