private UserModel CreateUserModel(User user)
        {
            AdminUser adminUser = user as AdminUser;

            if (adminUser != null)
            {
                return(new AdminUserModel(adminUser));
            }

            ShopUser shopUser = user as ShopUser;

            if (shopUser != null)
            {
                return(new ShopUserModel(shopUser, _shopService.GetById(shopUser.ShopId)));
            }

            AccountUser accountUser = user as AccountUser;

            if (accountUser != null)
            {
                return(new AccountUserModel(accountUser, _accountService.QueryByOwnerId(accountUser)));
            }

            DistributorUser distributorUser = user as DistributorUser;

            if (distributorUser != null)
            {
                return(new DistributorUserModel(distributorUser, _distributorService.GetByUserId(distributorUser.UserId)));
            }
            throw new NotSupportedException(user.GetType().FullName);
        }
Beispiel #2
0
 public DistributorModelBase()
 {
     _innerObject       = new Distributor();
     _innerObject.State = States.Normal;
     _owner             = new DistributorUser();
     Owner.State        = States.Normal;
 }
Beispiel #3
0
        public DistributorUserModel(DistributorUser distributorUser, Distributor distributor)
        {
            _distributorUser = distributorUser;
            _distributor     = distributor;

            Roles = distributorUser.Roles.Select(x => x.DisplayName).ToList();
        }
Beispiel #4
0
        /// <summary>
        /// 保存时短信验证绑定
        /// </summary>
        /// <param name="distributor"></param>
        /// <param name="owner"></param>
        protected void OnSave(Distributor distributor, DistributorUser owner)
        {
            if (!string.IsNullOrWhiteSpace(HostSite.MessageTemplateOfIdentity))
            {
                var code   = CodeHelper.GetObject <string>("sms", false);
                var mobile = CodeHelper.GetObject <string>("sms_mobile", false);
                // 校验成功
                if (!string.IsNullOrWhiteSpace(code) && code == Mobile.Code)
                {
                    // 校验成功,并且提交号码和校验号码相同,则为绑定
                    if (Mobile.Value1 == mobile)
                    {
                        owner.Mobile            = mobile;
                        owner.IsMobileAvailable = true;
                    }
                    else // 否则为取消绑定
                    {
                        owner.Mobile            = "";
                        owner.IsMobileAvailable = false;
                    }
                }
            }
            else
            {
                owner.Mobile            = Mobile.Value1;
                owner.IsMobileAvailable = !string.IsNullOrWhiteSpace(owner.Mobile);
            }

            owner.Mobile2               = Mobile.Value2;
            owner.PhoneNumber           = PhoneNumber.Value1;
            owner.PhoneNumber2          = PhoneNumber.Value2;
            distributor.Address         = Address;
            distributor.Bank            = HostSite.GetBank(this.Bank);
            distributor.BankAccountName = BankAccountName;
            distributor.BankPoint       = BankPoint;
            distributor.BankUserName    = BankUserName;
            distributor.DealWayId       = DealWay;
            distributor.Description     = Description;

            //----提成比例;
            //----
        }
 public DistributorUserUpdated(DistributorUser distributorUser)
 {
     DistributorUser = distributorUser;
 }
Beispiel #6
0
 protected void SetInnerObject(Distributor distributor, DistributorUser owner)
 {
     _owner       = owner;
     _innerObject = distributor;
 }
Beispiel #7
0
 public DistributorUserEmailConfirmed(DistributorUser distributorUser)
 {
     DistributorUser = distributorUser;
 }
Beispiel #8
0
 public DistributorUserDeleted(DistributorUser distributorUser)
 {
     DistributorUser = distributorUser;
 }
 public DistributorUserCreated(DistributorUser distributorUser)
 {
     DistributorUser = distributorUser;
 }