Ejemplo n.º 1
0
        /// <summary>
        ///  保存用户实名认证信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static CustomerAuthenticationInfo SaveCustomerAuthenticationInfo(CustomerAuthenticationInfo info)
        {
            if (!info.CustomerSysNo.HasValue || info.CustomerSysNo.Value <= 0)
            {
                throw new BusinessException("此用户不存在");
            }
            if (string.IsNullOrWhiteSpace(info.Name))
            {
                throw new BusinessException("实名认证信息姓名不能为空");
            }
            if (!info.IDCardType.HasValue)
            {
                throw new BusinessException("实名认证信息必须选择一种证件类型");
            }
            if (string.IsNullOrWhiteSpace(info.IDCardNumber))
            {
                throw new BusinessException("实名认证信息证件号不能为空");
            }
            if (!info.Birthday.HasValue)
            {
                throw new BusinessException("实名认证信息出生日期不能为空");
            }
            if (info.IDCardType.Value == IDCardType.IdentityCard)
            {
                string errorMsg;
                bool   checkResult = CheckIDCard(info.IDCardNumber, info.Birthday.Value, out errorMsg);
                if (!checkResult)
                {
                    throw new BusinessException(errorMsg);
                }
            }

            var authInfo = CustomerDA.GetCustomerAuthenticationInfo(info.CustomerSysNo.Value);

            if (authInfo == null)
            {
                return(CustomerDA.InsertCustomerAuthenticationInfo(info));
            }
            else
            {
                info.SysNo = authInfo.SysNo;
                return(CustomerDA.UpdateCustomerAuthenticationInfo(info));
            }
        }
Ejemplo n.º 2
0
        public ActionResult AjaxEditCustomerAuthentication(CustomerAuthenticationInfo model)
        {
            if (model == null)
            {
                throw new BusinessException("无效的请求");
            }
            var customer = CustomerFacade.GetCustomerInfo(CurrUser.UserSysNo);

            if (customer != null)
            {
                model.CustomerSysNo = customer.SysNo;
                var info = CustomerFacade.SaveCustomerAuthenticationInfo(model);
                return(Json(info));
            }
            else
            {
                throw new BusinessException("此用户不存在");
            }
        }