public virtual void ForgotPassword(User user) { if (user != null) { var mail = user.UserMail; var link = "http://" + CurrentHttpContext.Request.Url.Authority + "/Account/Index"; if (!string.IsNullOrEmpty(user.AccessToken)) { link = "http://" + CurrentHttpContext.Request.Url.Authority + "/Account/DetailRegister?token=" + CurrentHttpContext.Server.UrlEncode(user.AccessToken); } ViewBag.Mail = mail; ViewBag.Link = link; var mailObj = Populate(x => { x.Subject = "OATS Reset Forgot Password"; x.ViewName = "ForgotPassword"; x.To.Add(user.UserMail); }); var client = new SmtpClientWrapperOATS(); client.OnSendingError += (ex) => { if (OnForgotPasswordCallback != null) { OnForgotPasswordCallback.Invoke(false); } }; client.SendCompleted += (sender, e) => { if (OnForgotPasswordCallback != null) { OnForgotPasswordCallback.Invoke(true); } }; mailObj.SendAsync("oats", client); } }
public JsonResult UpdateProfile(User profile) { var common = new CommonService(); common.UpdateProfile(profile); return Json(new { common.message, common.success }); }
public virtual void NofityNewUser(User user, User invitor) { if (user != null) { var mail = user.UserMail; var link = "http://" + CurrentHttpContext.Request.Url.Authority + "/Account/Index"; var invitorName = string.Empty; if (invitor != null) { if (string.IsNullOrEmpty(invitor.Name)) { invitorName = invitor.UserMail; } else { invitorName = invitor.Name + " (Email: "+invitor.UserMail+" )"; } } if (!string.IsNullOrEmpty(user.AccessToken)) { link = "http://" + CurrentHttpContext.Request.Url.Authority + "/Account/DetailRegister?token=" + CurrentHttpContext.Server.UrlEncode(user.AccessToken); } ViewBag.Invitor = invitorName; ViewBag.Mail = mail; ViewBag.Link = link; var mailObj = Populate(x => { x.Subject = "OATS Notify for New User"; x.ViewName = "NotifyNewUser"; x.To.Add(user.UserMail); }); var client = new SmtpClientWrapperOATS(); client.OnSendingError += (ex) => { if (OnNotifyNewUserCallback != null) { OnNotifyNewUserCallback.Invoke(false); } }; client.SendCompleted += (sender, e) => { if (OnNotifyNewUserCallback != null) { OnNotifyNewUserCallback.Invoke(true); } }; mailObj.SendAsync("oats", client); } }
private void Initialize(User user) { UserID = user.UserID; UserDecimalPercent = null; User = user; UserLabel = !string.IsNullOrEmpty(user.Name) ? user.Name : user.UserMail; UserPercent = "N/A"; }
public ScoreUserItem(User user) { Initialize(user); }
public ScoreUserItem(User user, Test test) { var inTest = test.UserInTests.FilterInTestsOnAttempSetting().FirstOrDefault(i => i.UserID == user.UserID); if (inTest != null) { var totalScoreOfTest = inTest.Test.Questions.TotalRealScore(); UserID = inTest.User.UserID; User = inTest.User; UserLabel = !string.IsNullOrEmpty(inTest.User.Name) ? inTest.User.Name : inTest.User.UserMail; decimal? percent = 0; if (totalScoreOfTest != 0 && totalScoreOfTest.HasValue) { percent = (decimal)inTest.Score / totalScoreOfTest; } if (inTest.Score == 0) { UserDecimalPercent = null; } else { UserDecimalPercent = percent; } UserPercent = (percent).ToPercent(); Test = inTest.Test; } else { Initialize(user); } }