private static bool SendConfirmationEmail(User user, Event ev, Place location, DateTime start, DateTime end) { var fromAddress = new MailAddress(Properties.Settings.Default.Email, "ICT4Events"); var toAddress = new MailAddress(user.Email, user.Username); var fromPassword = Properties.Settings.Default.EmailPassword; var message = new MailMessage(fromAddress, toAddress) { Subject = "Confirmation of your new reservation for "+ ev.Name, Body = "Hello " + user.Username + ",\r\n\r\n" + $"Your have been registered to participate in event {ev.Name}!\r\n" + $"The location you entered is {location.Name}.\r\n" + $"We will be expecting to see you on {start.Date.ToShortDateString()} until {end.Date.ToShortDateString()}.\r\n" + $"Your user ID is: {user.ID}. Make sure to remember this for your check-in!" + "\r\n\r\nHave a nice day!" }; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; try { smtp.Send(message); return true; } catch (SmtpException e) { throw new Exception(e.Message); } }
public bool ReservationMail(User user, Event ev, Place location, DateTime start, DateTime end) { return SendConfirmationEmail(user, ev, location, start, end); }
public bool UpdatePlace(Place place) { return _context.Update(place); }
public bool DeletePlace(Place place) { return _context.Delete(place); }
public bool InsertPlace(Place place) { return _context.Insert(place); }