public bool CheckLogin(string username, string password) { var userService = new UserService(); var user = userService.GetUserByUserName(username); string encryptPw = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Trim(), "sha1"); if (user != null && user.Password == encryptPw) return true; return false; }
public static void Login(string username) { var service = new UserService(); var user = service.GetUserByUserName(username); Session[Constant.UserLogined] = user; }
public ActionResult UpdateSaleStatus() { try { string name = Request["Name"]; string status = Request["Status"]; var uService = new UserService(); var user = uService.GetUserByUserName(name); if (user != null) { if (status == Status.ACTIVE.ToString()) user.Status = (int)Status.ACTIVE; else user.Status = (int)Status.DEACTIVE; uService.UpdateUser(user); } return Json(new { finish = true }); } catch (Exception) { return Json(new { finish = false }); } }