public virtual ActionResult ChangeBillingInformation(Member model) { var id = WebHelper.GetIdentityId(User.Identity); if (id == 0) return View(MVC.Shared.Views.Error); var context = ModelFactory.GetUnitOfWork(); var mRepo = ModelFactory.GetRepository<IMemberRepository>(context); var member = mRepo.Get(id); if (member == null) return View(MVC.Shared.Views.Error); if (ModelState.IsValid) { try { TryUpdateModel(member); context.Commit(); TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.BackOffice.BackOfficeString.PaymentInfoModified; return RedirectToAction(MVC.Backoffice.Home.Index()); } catch (Exception ex) { _Logger.Error("ChangeBillingInformation", ex); context.Complete(); } } return View(model); }
public Invoice GetInvoiceModel(Localisation localisation, Member member) { Invoice.Localisation = localisation; Invoice.Member = member; return Invoice; }
public PaymentInfoModel(Member member) { PaymentAddress = member.MemberMainData != null ? member.MemberMainData.PaymentAddress : string.Empty; }
public void ChangePaymentInformation(Member member) { member.MemberMainData.PaymentAddress = PaymentAddress; }
/// <summary> /// Converts a Member object into a MembershipUser object using its assigned settings /// </summary> private MembershipUser GetUserFromMember(Member m) { return new MembershipUser(this.ProviderName, m.Username, m.MemberId, m.Email, m.PasswordQuestion, m.Comment, m.IsApproved, m.IsLockedOut, m.CreatedDate, m.LastLoginDate, m.LastLoginDate, m.LastPasswordChangedDate, m.LastLockoutDate); }
/// <summary> /// Upon a successful login or password reset, this changes all the previous failure markers to defaults. /// </summary> private static void ResetAuthenticationFailures(ref Member m, DateTime dt) { m.LastPasswordChangedDate = dt; m.FailedPasswordAttemptCount = 0; m.FailedPasswordAttemptWindowStart = dt; m.FailedPasswordAnswerAttemptCount = 0; m.FailedPasswordAnswerAttemptWindowStart = dt; }
/************************************************************************* * User related methods : create, update, unlock, delete methods. *************************************************************************/ /// <summary> /// Creates a new user with a given set of default values /// </summary> public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && !string.IsNullOrEmpty(GetUserNameByEmail(email))) { status = MembershipCreateStatus.DuplicateEmail; return null; } // If no user with this name already exists if (GetUser(username, false) == null) { DateTime createdDate = DateTime.UtcNow; string salt = ""; if (PasswordFormat == MembershipPasswordFormat.Hashed) { salt = GenerateSalt(); password = password + salt; } Member m = new Member(); m.Username = username; m.Password = EncodePassword(password); m.PasswordSalt = salt; m.Email = email; // Set the password retrieval question and answer if they are required if (RequiresQuestionAndAnswer) { m.PasswordQuestion = passwordQuestion; m.PasswordAnswer = EncodePassword(passwordAnswer); } m.IsApproved = isApproved; m.IsLockedOut = false; m.Comment = ""; m.CreatedDate = createdDate; m.LastLockoutDate = createdDate; m.LastLoginDate = createdDate; m.LastActivityDate = createdDate; m.LastPasswordChangedDate = createdDate; m.FailedPasswordAttemptCount = 0; m.FailedPasswordAttemptWindowStart = createdDate; m.FailedPasswordAnswerAttemptCount = 0; m.FailedPasswordAnswerAttemptWindowStart = createdDate; m.EmailKey = Member.GenerateKey(); var context = ModelFactory.GetUnitOfWork(); var mRepo = ModelFactory.GetRepository<IMemberRepository>(context); try { mRepo.Add(m); // User creation was a success status = MembershipCreateStatus.Success; context.Commit(); // Return the newly craeted user return GetUserFromMember(m); } catch(Exception ex) { context.Complete(); // Something was wrong and the user was rejected status = MembershipCreateStatus.UserRejected; Logger.Error("CreateUser", ex); } } else { // There is already a user with this name status = MembershipCreateStatus.DuplicateUserName; } // Something went wrong if we got this far without some sort of status or retun if (status != MembershipCreateStatus.UserRejected && status != MembershipCreateStatus.DuplicateUserName) status = MembershipCreateStatus.ProviderError; return null; }