protected void SendEmailNotification(PlanningPrepUser user) { String messageBody = AppUtil.ReadEmailTemplate(AppConstants.EmailTemplate.GENERAL_EMAIL_TEMPLATE); StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"<b>Your registration to Planning Prep was successful.</b> If you have paid through Paypal and allowed Paypal to redirect you back to our site, your account may be active. If you have not paid for your account, your account will not be activated until receipt of payment. For payment instructions please visit <a href=""http://www.planningprep.com/joinoutcome.asp"">http://www.planningprep.com/planning/joinoutcome.asp</a></p> <br/><br/>Accounts not instantly activated through Paypal are activated within 1-2 business days. Once it is activated, you can login in using the following information: <br/><br/> Username: {0}<br/>Password: {1}<br/><br/> Please remember you cannot share this account. Please make a record of this information for future use." , user.Username, user.Password); ; //If strReferredBy<>"" Then // strBody=strBody + chr(13) & chr(13) & "Your friend, " & strReferredBy & " may be eligible for a $15 bonus provided they meet the requirements of our Refer-A-Friend Bonus Terms of Agreement." //End If String toEmail = user.Author_email; String toName = String.Format("{0} {1}", user.FirstName, user.LastName); //String senderName = "Planning Prep Memberships"; String sender = ConfigReader.AdminEmail; String subject = "Your Planning Prep Membership"; messageBody = messageBody.Replace(AppConstants.ETConstants.MESSAGE, sb.ToString()); try { MailManager.SendMail(toEmail, String.Empty, String.Empty, sender, subject, messageBody); } catch //(Exception ex) { //App.Core.Logging.AppLogger.HandleException(ex); } }
protected void LoginUser(PlanningPrepUser user, String userName, bool rememberMe) { if (user != null) { if (!user.Active) { String message = @"Your login information is valid, however if your account has been disabled. If you have recently submitted a payment, your account may not yet be active. Accounts processed through Paypal are activated within 24 hours. Accounts processed by check are activated upon receipt of check. If you believe this is in error, please <a href='/Pages/Public/ContactUs.aspx'>contact us</a>."; divMessage.Style["height"] = "70px;"; AppUtil.ShowMessageBox(divMessage, message, true); SessionCache.FailedLoginAttemptCount = SessionCache.FailedLoginAttemptCount + 1; SessionCache.AttemptedUserName = userName; return; } ///Set the Login Hit Counter user.LastLogin = DateTime.Now; user.LoginNumber = user.LoginNumber + 1; userManager.SaveOrUpdate(user); if (string.IsNullOrEmpty(user.Rights)) { user.Rights = AppConstants.UserRoles.MEMBER; } SessionCache.CurrentUser = user; ///Track the Login Data //String IP = Request.ServerVariables["REMOTE_ADDR"]; //IP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; userManager.TrackLoginData(user.Author_ID, AppUtil.GetRemoteIPAddress(), DateTime.Now); ///TODO: Promo Stuff Is Not Implemented. Because it uses a static user name "dburnham". ///But we have taken it in the watch list. ///Check for Terms of Use if (!user.YesTermsofAgreement) { SessionCache.CurrentUser = null; SessionCache.AttemptedUserName = userName; SessionCache.FailedLoginAttemptCount = SessionCache.FailedLoginAttemptCount + 1; Response.Redirect(AppConstants.Pages.TERMS_OF_USE, false); return; } ///After Successfull Login Redirect to the Requested Page FormsAuthenticationUtil.RedirectFromLoginPage(user.Username, user.Rights, rememberMe); } else //Failed { SessionCache.AttemptedUserName = userName; SessionCache.FailedLoginAttemptCount = SessionCache.FailedLoginAttemptCount + 1; AppUtil.ShowMessageBox(divMessage, "Login Failed. Your login was unsuccessful. Please check your Username, Password and try again.", true); } }
protected void rptCommentList_ItemDataBound(object sender, RepeaterItemEventArgs e) { Comment comment = e.Item.DataItem as Comment; PlanningPrepUser user = null; if (comment.UserID == 0) { user = new PlanningPrepUser(); user.Author_ID = 0; user.Username = "******"; user.FirstName = "Anonymous"; user.LastName = String.Empty; } else user = _UserManager.Get(comment.UserID); if (user != null) { Literal ltrUserInfo = e.Item.FindControl("ltrUserInfo") as Literal; ltrUserInfo.Text = String.Format("{0}<br /><span class='minutesago'>{1}</span>", AppUtil.Encode(string.Format("{0} {1}",user.FirstName,user.LastName)), GetDifference(comment.Created)); } Literal ltrComment = e.Item.FindControl("ltrComment") as Literal; if(comment.LinkID > 0) ltrComment.Text = String.Format("\"{0}\"", comment.CommentText); else ltrComment.Text = String.Format("\"{0}\"", AppUtil.FormatText(comment.CommentText)); Literal ltrThumbs = e.Item.FindControl("ltrThumbs") as Literal; String thumbsText = thumbsText = String.Format("+{0} Thumbs", comment.Rank); if (_LoggedInUser.Author_ID == 0 || comment.UserID == _LoggedInUser.Author_ID || _ThumbInfoManager.HasThumbed(_LoggedInUser.Author_ID, _QuestionID, comment.ID)) ltrThumbs.Text = String.Format("<div class='thumbText'>{0} </div><div class='thumbImage'><img src='/Images/ThumbsDown_Disabled.png' alt='Thumbs Down Disabled' title='Thumbs Down Disabled'/> <img src='/Images/ThumbsUp_Disabled.png' alt='Thumbs Up Disabled' title='Thumbs Up Disabled'/></div><div class='clearfloating'></div>", GetLogicalText(comment.Rank - comment.NegativeRank, "Thumb")); else ltrThumbs.Text = String.Format("<div class='thumbText'>{0} </div><div class='thumbImage'><img src='/Images/ThumbsDown.png' onclick='ThumbsDown({1}, this);' alt='Thumbs Down this Comment' title='Thumbs Down this Comment' class='clickableimage'/> <img src='/Images/ThumbsUp.png' onclick='ThumbsUp({1}, this);' alt='Thumbs Up this Comment' title='Thumbs Up this Comment' class='clickableimage'/></div><div class='clearfloating'></div>", GetLogicalText(comment.Rank - comment.NegativeRank, "Thumb"), comment.ID); HtmlGenericControl divCommentReplyes = e.Item.FindControl("divCommentReplyes") as HtmlGenericControl; divCommentReplyes.InnerHtml = GetCommentReplyHtml(comment, e.Item); }
protected void Page_Load(object sender, EventArgs e) { _UserManager = new UserManager(); _ThumbInfoManager = new CommentThumbInfoManager(); if (SessionCache.CurrentUser == null) { //_UserID = 0; //_UserFullName = "Anonymous"; //_UserName = "******"; _LoggedInUser = new PlanningPrepUser(); _LoggedInUser.Author_ID = 0; _LoggedInUser.Username = "******"; _LoggedInUser.FirstName = "Anonymous"; _LoggedInUser.LastName = String.Empty; } else { //_UserID = SessionCache.CurrentUser.Author_ID; //_UserName = AppUtil.Encode(SessionCache.CurrentUser.Username); //_UserFullName = String.Format("{0} {1}", AppUtil.Encode(_LoggedInUser.FirstName), AppUtil.Encode(_LoggedInUser.LastName)); _LoggedInUser = SessionCache.CurrentUser; } BindCommentList(); }
private void SaveRegistrationInfo() { App.Domain.Users.UserManager manager = new App.Domain.Users.UserManager(); ///Populate the Object PlanningPrepUser user = new PlanningPrepUser(); user.Username = txtUserName.Text.Trim(); user.FirstName = txtFirstName.Text.Trim(); user.LastName = txtLastName.Text.Trim(); user.Author_email = txtEmail.Text.Trim(); user.City = txtCity.Text.Trim(); user.State = txtState.Text.Trim(); user.ZIP = txtZip.Text.Trim(); user.Employer = txtEmployer.Text.Trim(); user.Address = txtAddress.Text.Trim(); user.Title = txtTitle.Text.Trim(); user.Password = txtPassword.Text; user.HowHear = ddlHowHear.SelectedValue; user.Active = false; user.Join_date = DateTime.Now; user.Mode = "Filtered"; user.Show_email = false; user.Status = 1; user.User_code = GenerateUserCode(user.Username, user.Password); ///Save the Object manager.SaveOrUpdate(user); SendEmailNotification(user); }