Exemplo n.º 1
0
 private JsonResult IsLogin()
 {
     var result = new JsonResult();
     if (CustomerHelper.CustomerId > 0 || UserHelper.CurrentUserId() > 0)
     {
         result.IsSuccess = true;
     }
     else
     {
         result.IsSuccess = false;
     }
     return result;
 }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            this.Request = context.Request;
            this.Response = context.Response;
            this.Session = context.Session;

            var result = new JsonResult();
            var method = Request.QueryString["method"];
            if (method == "IsLogin")
                result = this.IsLogin();
            if (method == "OnLogin")
                result = this.OnLogin();

            Response.ContentType = "text/plain";
            var json = JsonConvert.SerializeObject(result);
            Response.Write(json);
        }
Exemplo n.º 3
0
 private JsonResult OnLogin()
 {
     var userName = Request.Params["username"];
     var password = Request.Params["password"];
     var md5pwd = Common.Md5.GetMd5Hash(password);
     using (var db = new Model.ZLzucheEntities())
     {
         var entity =
             db.Customer.FirstOrDefault(
                 model =>
                 (model.LoginID == userName || model.Phone == userName || model.Email == userName ||
                  model.PapersNumber == userName) && model.Password == md5pwd);
         var result = new JsonResult();
         if (entity != null && entity.ID > 0)
         {
             Session["CustomerId"] = entity.ID;
             Session["LoginId"] = entity.LoginID;
             result.IsSuccess = true;
             result.Result = entity.CustomerName;
         }
         return result;
     }
 }