示例#1
0
        public ActionResult ChangePassword(ChangePasswordModel model)
        {
            string currentPerson = GetCurrentPerson();
            ViewBag.PersonNamea = currentPerson;
            if (string.IsNullOrWhiteSpace(currentPerson))
            {
                ModelState.AddModelError("", "对不起,请重新登陆");
                return View();
            }
            if (ModelState.IsValid)
            {
                IAccountBLL accountBLL = new AccountBLL();

                if (null != (accountBLL.ValidateUser(currentPerson, EncryptAndDecrypte.EncryptString(model.OldPassword))))
                {
                    if (accountBLL.ChangePassword(currentPerson, EncryptAndDecrypte.EncryptString(model.OldPassword), EncryptAndDecrypte.EncryptString(model.NewPassword)))
                    {
                        ModelState.AddModelError("", "修改密码成功");
                        return View();
                    }
                }
            }
            ModelState.AddModelError("", "修改密码不成功,请核实数据");
            return View();
        }
示例#2
0
 public Response<string> DoWork(Request<string> request)
 {
     AccountBLL accountBl = new AccountBLL(SqlRepository);
     Response<string> response = new Response<string>();
     response.Item = accountBl.DoWork(request.Item);
     response.IsSuccess = true;
     return response;
 }
示例#3
0
 public Response<List<KeyValuePair<string, int>>> GetFilterCount(Request<FilterSearch> request)
 {
     AccountBLL accountBl = new AccountBLL(SqlRepository);
     accountBl.InitLanguagePriority(request.Language, request.Priority);
     Response<List<KeyValuePair<string, int>>> response = new Response<List<KeyValuePair<string, int>>>();
     //response.Item = accountBl.DoWork(request.Item);
     response.IsSuccess = true;
     return response;
 }
示例#4
0
        public static AccountBLL Create()
        {
            AccountBLL accountBLL = new AccountBLL();

            return(accountBLL);

            // TODO: Edit factory method of AccountBLL
            // This method should be able to configure the object in all possible ways.
            // Add as many parameters as needed,
            // and assign their values to each field by using the API.
        }
示例#5
0
        public ActionResult Index(LogOnModel model)
        {
            #region 验证码验证

            if (Session["__VCode"] == null || (Session["__VCode"] != null && model.ValidateCode != Session["__VCode"].ToString()))
            {
                ModelState.AddModelError("PersonName", "验证码错误!"); //return "";
                return View();
            }
            #endregion

            if (ModelState.IsValid)
            {
                AccountBLL accountBLL = new BLL.AccountBLL();
                SysPerson person = accountBLL.ValidateUser(model.PersonName, EncryptAndDecrypte.EncryptString(model.Password));
                if (person != null)
                {//登录成功
                    Account account = new Account();
                    account.Name = person.MyName;
                    account.PersonName = person.Name;
                    account.Id = person.Id.ToString();
                    Session["account"] = account;

                    return RedirectToAction("Index", "Home");
                }
            }

            ModelState.AddModelError("PersonName", "用户名或者密码出错。");
            return View();
        }