Ejemplo n.º 1
0
        public ActionResult ChargeAccount(AdminChargeAccountModel model)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            if (!agentAdminMgt.CurrentLoginUser.Permission.UPDATE_USER)
            {
                ViewBag.Message = "您没有充值代理商账户的权限";
                return View("Error");
            }
            //if(!ModelState.IsValid)
            //{
            //    ViewBag.Message = "输入信息错误";
            //    return View("Error");
            //}
            if(ModelState.IsValid)
            {
                try
                {
                    bool result = agentAdminMgt.ChargeAgencyAccount(model.UserId, model.Amount);
                    if (!result)
                    {
                        ViewBag.Message = "您没有充值代理商账户的权限";
                        return View("Error");
                    }
                    return Redirect("/Admin/Agencies");
                }
                catch (KMBitException ex)
                {
                    ViewBag.Message = ex.Message;
                    return View("Error");
                }
            }

            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult ChargeAccount(int agencyId)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            if (!agentAdminMgt.CurrentLoginUser.Permission.UPDATE_USER)
            {
                ViewBag.Message = "您没有充值代理商账户的权限";
                return View("Error");
            }
            if (agencyId<=0)
            {
                ViewBag.Message = "参数错误";
                return View("Error");
            }

            BUser user = agentAdminMgt.GetUserInfo(agencyId);
            if(user==null)
            {
                ViewBag.Message = "代理商不存在";
                return View("Error");
            }
            AdminChargeAccountModel model = new AdminChargeAccountModel()
            {
                UserId = agencyId,
                Name=user.User.Name,
                Amount = 0,
                Remaining = user.User.Remaining_amount
            };
            return View(model);
        }