protected void btnSubmit_Click(object sender, EventArgs e) { try { var userLogic = new UserManager(); var newPass = userLogic.ResetPassword(txtEmail.Text); if (newPass == null) { lblMessage.Text = "This Email Address wasn't found in our system!"; return; } var emailer = EmailerFactory.NewDefaultInstance(); emailer.SendHtmlEmail(ConfigurationManager.AppSettings["FromEmail"], txtEmail.Text, "The Rolling Rides Team - Password Reset", "Hello," + "<br/>Your new password is " + newPass + "<br/>Thank you,<br/>The Rolling Rides Team"); lblMessage.Text = "Your new temporary password was emailed to your email address provided"; } catch (Exception ex) { lblMessage.Text = ex.Message; } }
/// <summary> /// Notifies the users that are blocking the specified checkin/space. /// At the moment it sends IM and Email regardless of the users' preferences /// </summary> /// <param name="baseCheckin"></param> /// <param name="checkins"></param> private static void NotifyBlockingUsers(Checkin baseCheckin, List <Checkin> checkins) { List <UserInfo> userInfos = new List <UserInfo>(); List <User> users = new List <User>(); List <int> userIds = checkins.Select(c => c.UserId).ToList(); UserInfo requestingUser; using (EntityContext ctx = new EntityContext()) { requestingUser = ctx.UserInfos.Where(ui => ui.UserId == baseCheckin.UserId).FirstOrDefault(); userInfos = ctx.UserInfos.Where(ui => userIds.Contains(ui.UserId)).ToList(); users = ctx.Users.Where(ui => userIds.Contains(ui.UserId)).ToList(); } Pubnub pub = PubnubFactory.GetInstance(); users.ForEach(user => { // Notify via email EmailerFactory.SendMail(user.Email, i18n.Notification_EmailTitle, string.Format(i18n.Notification_EmailMessage, requestingUser.FullName)); // Notify via UI (if the user has it open) pub.Publish(PubnubFactory.Channels.GeneralNotification, new { Class = "BlockNotification", UserId = user.UserId, RequestingUser = requestingUser.UserId }); }); userInfos.ForEach(ui => { if (!string.IsNullOrEmpty(ui.ContactEmail)) { // Notify via IM MessageQueue.Save(new MessageQueue() { To = ui.ContactEmail, Text = string.Format(i18n.Notification_IMMessage, requestingUser.FullName) }); } }); TropoFactory.CreateSession(); }
protected void EmailCustomer(object sender, EventArgs e) { var user = _userManager.GetById(int.Parse(((Button)sender).CommandArgument)); var emailer = EmailerFactory.NewDefaultInstance(); var days = "Past Due!"; if (DateTime.Now <= user.Expires.Value) { var timespan = DateTime.Now.Subtract(user.Expires.Value); days = "due in " + timespan.Days; } var name = !string.IsNullOrEmpty(user.CompanyName) ? user.CompanyName : !string.IsNullOrEmpty(user.LastName) && !string.IsNullOrEmpty(user.FirstName) ? user.FirstName + " " + user.LastName : user.Username; var body = "Hello " + name + ", <br/>This email is to let you know your bill for your coporate account is " + days + "<br/>Please Visit Us At www.RollingRides.com/Contact.aspx and Contact Us to make a payment.<br/>Thank you<br/>Sincerely,<br/>The Rolling Rides Team!"; var subject = "The Rolling Rides Team - Your bill is " + days; emailer.SendHtmlEmail(ConfigurationManager.AppSettings["FromEmail"], user.Email, subject, body); }