Beispiel #1
0
        public void UpdateBankCard(BankCardInfo bankCard, string userId)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new BankCardManager();
                var entity  = manager.BankCardById(userId);
                if (entity == null)
                {
                    throw new Exception("修改信息未被查询到");
                }
                entity.BankCardNumber = bankCard.BankCardNumber;
                entity.BankCode       = bankCard.BankCode;
                entity.BankName       = bankCard.BankName;
                entity.BankSubName    = bankCard.BankSubName;
                entity.CityName       = bankCard.CityName;
                entity.ProvinceName   = bankCard.ProvinceName;
                entity.RealName       = bankCard.RealName;
                entity.UpdateTime     = DateTime.Now;
                manager.UpdateBankCard(entity);

                biz.CommitTran();
            }
        }
        /// <summary>
        /// 增加银行卡信息
        /// </summary>
        /// <param name="bankCard"></param>
        /// <param name="userToken"></param>
        /// <returns></returns>
        public CommonActionResult AddBankCard(BankCardInfo bankCard, string userToken)
        {
            // 验证用户身份及权限
            var userId = GameBizAuthBusiness.ValidateUserAuthentication(userToken);

            try
            {
                var entity = new BankCardManager().BankCardByCode(bankCard.BankCardNumber);
                if (entity != null)
                {
                    throw new Exception("该银行卡号已经被其他用户绑定,请选择其它银行卡号");
                }
                if (string.IsNullOrEmpty(bankCard.UserId) || bankCard.UserId == null || bankCard.UserId.Length == 0)
                {
                    bankCard.UserId = userId;
                }

                var bankcarduser = new BankCardManager().BankCardById(userId);
                if (bankcarduser != null)
                {
                    throw new Exception("您已绑定了银行卡,请不要重复绑定!");
                }
                new BankCardBusiness().AddBankCard(bankCard);
                new CacheDataBusiness().ClearUserBindInfoCache(userId);
                //绑定银行卡之后实现接口
                BusinessHelper.ExecPlugin <IAddBankCard>(new object[] { bankCard.UserId, bankCard.BankCardNumber, bankCard.BankCode, bankCard.BankName, bankCard.BankSubName, bankCard.CityName, bankCard.ProvinceName, bankCard.RealName });
                return(new CommonActionResult(true, "添加银行卡信息成功"));
            }
            catch (Exception ex)
            {
                throw new Exception("添加银行卡信息出错 - " + ex.Message, ex);
            }
        }
Beispiel #3
0
        public void CancelBankCard(string userId)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();
                var manager = new BankCardManager();
                var entity  = manager.BankCardById(userId);
                if (entity == null)
                {
                    throw new Exception("未查到信息");
                }
                manager.DeleteBankCard(entity);

                biz.CommitTran();
            }
        }
Beispiel #4
0
        public void AddBankCard(BankCardInfo bankCard)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new BankCardManager();
                var entity  = new BankCard()
                {
                    UserId         = bankCard.UserId,
                    BankCardNumber = bankCard.BankCardNumber,
                    BankCode       = bankCard.BankCode,
                    BankName       = bankCard.BankName,
                    BankSubName    = bankCard.BankSubName,
                    CityName       = bankCard.CityName,
                    CreateTime     = DateTime.Now,
                    ProvinceName   = bankCard.ProvinceName,
                    RealName       = bankCard.RealName,
                    UpdateTime     = DateTime.Now
                };
                manager.AddBankCard(entity);


                //#region 发送站内消息:手机短信或站内信

                //var userManager = new UserBalanceManager();
                //var user = userManager.QueryUserRegister(bankCard.UserId);
                //var pList = new List<string>();
                //pList.Add(string.Format("{0}={1}", "[UserName]", user.DisplayName));
                //pList.Add(string.Format("{0}={1}", "[BankName]", bankCard.BankName));
                //pList.Add(string.Format("{0}={1}", "[BankCardNumber]", bankCard.BankCardNumber));
                ////发送短信
                //new SiteMessageControllBusiness().DoSendSiteMessage(user.UserId, "", "ON_User_Bind_BankCard", pList.ToArray());

                //#endregion

                biz.CommitTran();
            }
        }
Beispiel #5
0
        public BankCardInfo BankCardById(string userId)
        {
            var entity = new BankCardManager().BankCardById(userId);

            if (entity == null)
            {
                return(null);
            }
            //throw new LogicException(string.Format("查不到{0}的银行卡信息", userId));
            return(new BankCardInfo()
            {
                UserId = entity.UserId,
                BankCardNumber = entity.BankCardNumber,
                BankCode = entity.BankCode,
                BankName = entity.BankName,
                BankSubName = entity.BankSubName,
                BId = entity.BId,
                CityName = entity.CityName,
                CreateTime = entity.CreateTime,
                ProvinceName = entity.ProvinceName,
                RealName = entity.RealName,
                UpdateTime = entity.UpdateTime
            });
        }