protected void Session_Start(object sender, EventArgs e) { // Write entry when user starts application var donorMessages = new DonorMessages() { MessageId = 100, MessageText = "Session Started", MessageDescription = "User started new session with application", User_Added = User.Identity.Name }; donorMessages.AddNew(); }
public void SendEmail() { try { var msg = new StringBuilder(); var getUrl = ""; if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate)) { switch (_DEL.Attending) { case true: getUrl = _URL + @"/templates/wait_yes.html"; break; case false: getUrl = _URL + @"/templates/rsvp_no.html"; break; } } else { switch (_DEL.Attending) { case true: getUrl = _URL + @"/templates/rsvp_yes.html"; break; case false: getUrl = _URL + @"/templates/rsvp_yes.html"; break; } } var request = (HttpWebRequest)WebRequest.Create(getUrl); request.Method = "GET"; var response = request.GetResponse(); var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); msg.Append(reader.ReadToEnd()); reader.Close(); response.Close(); var eventList = new EventList(_user, _DEL.fk_Event); if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate)) { switch (_DEL.Attending) { case true: msg = msg.Replace("@{TEXT}", eventList.HTML_Wait); break; case false: msg = msg.Replace("@{TEXT}", eventList.HTML_No); break; } } else { switch (_DEL.Attending) { case true: msg = msg.Replace("@{TEXT}", eventList.HTML_Yes); break; case false: msg = msg.Replace("@{TEXT}", eventList.HTML_No); break; } } msg = ParseText(msg, eventList, _DL); var smtpClient = new SmtpClient {EnableSsl = false}; var mail = new MailMessage { BodyEncoding = Encoding.GetEncoding("utf-8"), IsBodyHtml = true, //TODO: Uncomment this after event Subject = "SPLC Event Confirmation", // Subject = "Julian Bond Memorial Service Confirmation", Body = msg.ToString() }; mail.To.Add(new MailAddress(_DL.EmailAddress)); smtpClient.Send(mail); } catch (Exception ex) { var donorMessages = new DonorMessages() { MessageId = 2200, MessageText = "ERROR: DonorEmail.SendEmail()", MessageDescription = ex.Message, User_Added = _user }; donorMessages.AddNew(); } }
public void SendEmail() { try { var msg = new StringBuilder(); var getUrl = ""; if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate)) { switch (_DEL.Attending) { case true: getUrl = _URL + @"/templates/wait_yes.html"; break; case false: getUrl = _URL + @"/templates/rsvp_no.html"; break; } } else { switch (_DEL.Attending) { case true: getUrl = _URL + @"/templates/rsvp_yes.html"; break; case false: getUrl = _URL + @"/templates/rsvp_yes.html"; break; } } var request = (HttpWebRequest)WebRequest.Create(getUrl); request.Method = "GET"; var response = request.GetResponse(); var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); msg.Append(reader.ReadToEnd()); reader.Close(); response.Close(); var eventList = new EventList(_user, _DEL.fk_Event); if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate)) { switch (_DEL.Attending) { case true: msg = msg.Replace("@{TEXT}", eventList.HTML_Wait); break; case false: msg = msg.Replace("@{TEXT}", eventList.HTML_No); break; } } else { switch (_DEL.Attending) { case true: msg = msg.Replace("@{TEXT}", eventList.HTML_Yes); break; case false: msg = msg.Replace("@{TEXT}", eventList.HTML_No); break; } } msg = ParseText(msg, eventList, _DL); var smtpClient = new SmtpClient { EnableSsl = false }; var mail = new MailMessage { BodyEncoding = Encoding.GetEncoding("utf-8"), IsBodyHtml = true, //TODO: Uncomment this after event Subject = "SPLC Event Confirmation", // Subject = "Julian Bond Memorial Service Confirmation", Body = msg.ToString() }; mail.To.Add(new MailAddress(_DL.EmailAddress)); smtpClient.Send(mail); } catch (Exception ex) { var donorMessages = new DonorMessages() { MessageId = 2200, MessageText = "ERROR: DonorEmail.SendEmail()", MessageDescription = ex.Message, User_Added = _user }; donorMessages.AddNew(); } }