Пример #1
0
        public async Task <ActionResult> ResetPassword(int id)
        {
            BL.UserInfo empBL = new BL.UserInfo();
            if (empBL.GetItemByIdForDelete(id) != null)
            {
                return(Redirect(Url.Action("HttpError", "Error", new { area = "" })));
            }
            IPasswordPolicy Password        = new RandomPassword();
            string          orginalPassword = Password.GeneratePassword();

            orginalPassword = "******";
            string md5Password = HashEncrypt.MD5(orginalPassword);

            VM.UserInfoItem model = new VM.UserInfoItem();
            model = empBL.GetItemById(id);
            //IdentityModel user = await UserManager.FindByNameAsync(model.LogonName);
            //string password = UserManager.PasswordHasher.HashPassword(md5Password);
            //UserStore store = new UserStore(UserHelper.GetCurrentUser().LogonName);
            //var set = store.SetPasswordHashAsync(user, password);
            //var result = store.UpdateAsync(user);

            model.Password = md5Password;
            empBL.UpdatePasswordDb(model);
            if (model != null)
            {
                // empBL.SendEmail(model, orginalPassword, "User_ResetPassword");
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult GetDetail(int id)
        {
            BL.UserInfo empBL = new BL.UserInfo();
            if (empBL.GetItemByIdForDelete(id) != null)
            {
                return(Redirect(Url.Action("HttpError", "Error", new { area = "" })));
            }
            var model = empBL.GetItemById(id);

            return(PartialView("_Detail", model));
        }
Пример #3
0
        //
        // GET: /SystemMaint/UserInfo/Edit/5
        public ActionResult Edit(int id)
        {
            ViewBag.ShowSubmit = true;
            BL.UserInfo empBL = new BL.UserInfo();
            if (empBL.GetItemByIdForDelete(id) != null)
            {
                return(Redirect(Url.Action("HttpError", "Error", new { area = "" })));
            }
            var model = empBL.GetItemById(id);

            model.RoleSelectList = GetRoleSelectList(model.RoleSelectList);
            //model.CompanySelectList = GetCompanySelectList(model.CompanySelectList);
            return(View(model));
        }
Пример #4
0
        public ActionResult Delete(int id)
        {
            BL.UserInfo empBL = new BL.UserInfo();
            if (empBL.GetItemByIdForDelete(id) != null)
            {
                return(Redirect(Url.Action("HttpError", "Error", new { area = "" })));
            }
            //if (id.ToString() == UserHelper.GetCurrentUser().Id)
            //{
            //    return Json("own", JsonRequestBehavior.AllowGet);
            //}
            //else
            //{
            bool result = empBL.Delete(id, "sysAdmin");    //UserHelper.GetCurrentUser().LogonName);

            return(Json(result, JsonRequestBehavior.AllowGet));
            //}
        }