/// <summary> /// Phương thức đăng nhập /// </summary> /// <param name="empCode"></param> /// <param name="password"></param> /// <returns></returns> public int Login(string empCode, string password, bool check) { var authencationContext = new SMSDbContext(); authencationContext.UserID = empCode; authencationContext.Password = password; if (!check) { if (authencationContext.IsValid()) { //Neu OK return(1); } else { return(-1); } } else { var res = dbContext.Users.SingleOrDefault(x => x.EmpCode == empCode); if (res == null) { return(0); } else if (res.Password == password) { return(1); } else { return(-1); } } }