Ejemplo n.º 1
0
 public static bool CheckLogin(LoginModel lm)
 {
     string sql = "select count(*) from UserProfile where username='******' and password='******'";
     int reval =Convert.ToInt16( SqlHelper.ExecuteScalarText(sql, null));
     if (reval > 0)
     {
         return true;
     }
     else return false;
 }
Ejemplo n.º 2
0
 public static bool Login(LoginModel userInfo,out string errorMsg)
 {
     errorMsg = "";
     LoginModel loginInfo = new LoginModel()
     {
         UserName = userInfo.UserName,
         Password = SecurityHelper.Encrypt(userInfo.Password)
     };
     //验证登录信息
     bool loginstate;
     try
     {
         return loginstate = UserProfileData.CheckLogin(loginInfo);
     }
     catch (Exception ex)
     {
         errorMsg ="用户登录出错"+ex.ToString();
         return false;
     }
 }
Ejemplo n.º 3
0
        public ActionResult Login(LoginModel userInfo)
        {
            string errorMsg = "";

            bool success = UserHelper.Login(userInfo,out errorMsg);

            return Json(new { success = success, msg = errorMsg },
                JsonRequestBehavior.AllowGet);
        }