Ejemplo n.º 1
0
 public Order GetMyOrder(string sessionId, MembershipUser user, bool expireShoppingCart = true)
 {
     var shoppingCart = string.IsNullOrEmpty(sessionId) ? null : _shoppingCartService.GetBySessionId(sessionId);
     if (shoppingCart != null)
     {
         var order = _orderService.GetByShoppingCartId(shoppingCart.Id);
         if (order == null)
             order = _orderService.CreateOrderFromShoppingCart(shoppingCart, user, expireShoppingCart);
         return order;
     }
     return null;
 }
Ejemplo n.º 2
0
        public EditMembershipUserModel(MembershipUser membershipUser)
        {
            this.UserName = membershipUser.UserName;
            this.Email = membershipUser.Email;
            this.IsApproved = membershipUser.IsApproved;
            this.IsLockedOut = membershipUser.IsLockedOut;
            this.PasswordQuestion = membershipUser.PasswordQuestion;
            this.PasswordAnswer = membershipUser.PasswordAnswer;
            this.Culture = membershipUser.Culture;
            this.TimeZoneId = membershipUser.TimeZoneId;
            this.Comment = membershipUser.Comment;
            this.Profiles = membershipUser.Profiles;
            this.MembershipGroups = membershipUser.MembershipGroups;

            this.ProviderType = membershipUser.ProviderType;
            this.ProviderUserId = membershipUser.ProviderUserId;
            this.ProviderExtraData = membershipUser.ProviderExtraData;
        }
Ejemplo n.º 3
0
        protected virtual void SendActivateMail(ControllerContext controllerContext, Site site, MembershipUser memberUser, RegisterMemberModel registerMemberModel, string activateCode)
        {
            var activateUrl = registerMemberModel.ActivateUrl;
            if (string.IsNullOrEmpty(activateUrl))
            {
                throw new ArgumentNullException("ActivateUrl is required.");
            }

            activateUrl = string.Format(MemberPluginHelper.ResolveSiteUrl(controllerContext, activateUrl)
                , memberUser.UserName, activateCode);
            activateUrl = UrlUtility.ToHttpAbsolute(activateUrl);

            var subject = registerMemberModel.EmailSubject;
            var body = string.Format(registerMemberModel.EmailBody, activateUrl);

            site.SendMailToCustomer(registerMemberModel.Email, subject, body, true, null);
        }
Ejemplo n.º 4
0
        protected virtual void SendMail(ControllerContext controllerContext, Site site, MembershipUser membershipUser, ForgotPasswordModel forgotPasswordModel)
        {
            var resetPasswordUrl = forgotPasswordModel.ResetPasswordUrl;
            if (string.IsNullOrEmpty(resetPasswordUrl))
            {
                throw new ArgumentNullException("ResetPasswordUrl is required.");
            }

            resetPasswordUrl = string.Format(MemberPluginHelper.ResolveSiteUrl(controllerContext, resetPasswordUrl)
                , forgotPasswordModel.UserName, membershipUser.ActivateCode);
            resetPasswordUrl = UrlUtility.ToHttpAbsolute(resetPasswordUrl);

            var subject = forgotPasswordModel.EmailSubject;
            var body = string.Format(forgotPasswordModel.EmailBody, membershipUser.UserName, resetPasswordUrl);

            site.SendMailToCustomer(membershipUser.Email, subject, body, true, null);
        }
Ejemplo n.º 5
0
        public virtual ActionResult Delete(MembershipUser[] model)
        {
            ModelState.Clear();
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                if (model != null)
                {
                    foreach (var o in model)
                    {
                        o.Membership = Membership;
                        _manager.Delete(o);
                    }
                }

                data.ReloadPage = true;
            });

            return Json(data);
        }
Ejemplo n.º 6
0
 public virtual ActionResult IsUserNameAvailable(string userName)
 {
     var membershipUser = new MembershipUser() { Membership = Membership, UserName = userName }.AsActual();
     if (membershipUser != null)
     {
         return Json("The user name is duplicate.".Localize(), JsonRequestBehavior.AllowGet);
     }
     return Json(true, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 7
0
 public virtual ActionResult Edit(string uuid)
 {
     var membershipUser = new MembershipUser() { Membership = Membership, UUID = uuid }.AsActual();
     var editModel = new EditMembershipUserModel(membershipUser);
     return View(editModel);
 }
Ejemplo n.º 8
0
 public Order GetMyOrder(string sessionId, MembershipUser user, bool expireShoppingCart = true)
 {
     QueryParameters.Add("sessionId", sessionId);
     QueryParameters.Add("expireShoppingCart", expireShoppingCart.ToString());
     return Post<Order>(null, user);
 }