public ActionResult Forbid(int id = 0)
        {
            Response _resp = new Response();

            if (id < 1)
            {
                _resp.Status  = 0;
                _resp.Message = "错误!参数不正确.";
                return(Json(_resp));
            }
            BxAccount _bxaccount = _bxaccountmanager.Find(id);

            if (_bxaccount == null)
            {
                _resp.Status  = 0;
                _resp.Message = "错误!保险公司账号不存在.";
                return(Json(_resp));
            }
            _bxaccount.active = !_bxaccount.active;
            _resp             = _bxaccountmanager.Update(_bxaccount);
            if (_resp.Status == 1)
            {
                _resp.Message = "恭喜!更改保险公司账号状态已成功";
            }


            return(Json(_resp));
        }
        public ActionResult Edit(FormCollection fcs, int id = 0)
        {
            Response _resp = new Response();



            BxAccount _bxaccount = _bxaccountmanager.Find(id);

            if (_bxaccount == null)
            {
                _resp.Status  = 0;
                _resp.Message = "错误!保险公司账号不存在";
                return(Json(_resp));
            }
            TryUpdateModel(_bxaccount, new string[] { "Contacts", "Email", "Address", "Phone" });


            if (!ModelState.IsValid)
            {
                _resp.Status  = 0;
                _resp.Message = General.GetModelErrorString(ModelState);
                return(Json(_resp));
            }
            _resp = _bxaccountmanager.Update(_bxaccount);
            if (_resp.Status == 1)
            {
                _resp.Message = "恭喜!修改保险公司账号数据成功";
            }


            return(Json(_resp));
        }
        public ActionResult Add(BxAccountViewModel newbxaccount)
        {
            Response _resp = new Response();

            if (ModelState.IsValid)
            {
                if (_bxaccountmanager.HasAccounts(newbxaccount.username))
                {
                    _resp.Status  = 0;
                    _resp.Message = "保险公司帐号已存在";
                }
                else if (_bxaccountmanager.HasPhone(newbxaccount.Phone))
                {
                    _resp.Status  = 0;
                    _resp.Message = "保险公司手机号码已存在";
                }
                else
                {
                    BxAccount _newbxaccount = new BxAccount();
                    _newbxaccount.username      = newbxaccount.username;
                    _newbxaccount.active        = true;
                    _newbxaccount.Address       = newbxaccount.Address;
                    _newbxaccount.Contacts      = newbxaccount.Contacts;
                    _newbxaccount.CorporateName = newbxaccount.CorporateName;
                    _newbxaccount.CreateTime    = DateTime.Now;
                    _newbxaccount.Email         = newbxaccount.Email;
                    _newbxaccount.LoginIP       = "";
                    _newbxaccount.LoginTime     = DateTime.Now;
                    _newbxaccount.LoginCount    = 0;
                    //_cust.parent_id = 0;
                    _newbxaccount.password = Security.SHA256(newbxaccount.password);
                    _newbxaccount.Phone    = newbxaccount.Phone;

                    _resp = _bxaccountmanager.Add(_newbxaccount);
                    if (_resp.Status == 0)
                    {
                    }
                    else
                    {
                        _resp.Message = "恭喜您!账号添加成功!";
                    }

                    return(Json(_resp));
                    //_resp.Url = Url.Action("login");
                }
            }
            else
            {
                _resp.Status  = 0;
                _resp.Message = General.GetModelErrorString(ModelState);
            }
            return(Json(_resp));
        }
        public ActionResult Detail(int id = 0)
        {
            BxAccount _bxaccount = _bxaccountmanager.Find(id);

            if (_bxaccount == null)
            { //id的终端不存在
                Prompt _prm = new Prompt();
                _prm.Title   = "查询详情出错!";
                _prm.Message = "出错啦!不存在对应该ID的保险公司账号";
                return(View("ErrorPop", _prm));
            }
            return(View(_bxaccount));
        }
        public ActionResult Changepwd(int id = 0)
        {
            //查找是否有存在
            Response  _resp      = new Response();
            BxAccount _bxaccount = _bxaccountmanager.Find(id);

            if (_bxaccount == null)
            {
                _resp.Status  = 0;
                _resp.Message = "ID 出错,不存在相应的保险公司账号";
                return(Json(_resp, JsonRequestBehavior.AllowGet));
            }
            return(View());
        }
        public ActionResult Edit()
        {
            //查找是否有存在
            Response  _resp      = new Response();
            BxAccount _bxaccount = _bxaccountmanager.FindByAccount(Session["username"].ToString());

            if (_bxaccount == null)
            {
                _resp.Status  = 0;
                _resp.Message = "ID 出错,不存在相应的保险公司账号";
                return(Json(_resp, JsonRequestBehavior.AllowGet));
            }
            return(View(_bxaccount));
        }
        public ActionResult Info(string search, int limit, string sortname, int pageNumber, string order)
        {
            BxAccount _bxaccount = _bxaccountmanager.FindByAccount(Session["username"].ToString());

            if (_bxaccount == null)
            {
                return(Json(new { total = 0, rows = "" }));
            }
            else
            {
                //Paging<BxAccount> _pagingCustomer = new Paging<BxAccount>();

                var           item = new  { _bxaccount.Address, _bxaccount.BxAccountId, _bxaccount.Contacts, _bxaccount.CorporateName, _bxaccount.CreateTime, _bxaccount.Email, _bxaccount.Phone, _bxaccount.username };
                List <object> io   = new List <object>();
                io.Add(item);

                return(Json(new { total = 1, rows = io }));
            }
        }
        public ActionResult Changepwd(BxAccountChangePassWordViewModel newchangepwd, int id = 0)
        {
            Response _resp = new Response();

            if (!ModelState.IsValid)
            {
                _resp.Status  = 0;
                _resp.Message = General.GetModelErrorString(ModelState);
                return(Json(_resp));
            }
            BxAccount _bxaccount = _bxaccountmanager.FindByAccount(Session["username"].ToString());

            _resp = _bxaccountmanager.ChangePassword(_bxaccount.BxAccountId, Security.SHA256(newchangepwd.Newpwd));
            if (_resp.Status == 1)
            {
                Session.Clear();
                _resp.Url     = Url.Action("login", "account", new { area = "bx" });
                _resp.Message = "恭喜,修改密码成功!";
            }
            return(Json(_resp));
        }