Example #1
0
        private void Login()
        {
            if (!string.IsNullOrEmpty(Parameter.t.userId) && !string.IsNullOrEmpty(Parameter.t.userPassword))
            {
                Model.Table.User u = Parameter.t;
                u.lastLoginIp  = Request.UserHostAddress;
                u.userPassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Parameter.t.userPassword, "MD5");
                u = Biz.Login(u);
                if (u.State > 0)
                {
                    Session["User"] = u;
                }

                /*get
                 * Response.Write(us.State);
                 * switch (us.State)
                 * {
                 *  //case -2: EsunLog.Log("登陆", "用户不存在!", "信息", ip); break;
                 * // case -1: EsunLog.Log("登陆", "密码错误!", "信息", ip); break;
                 *  //case 0: $("#error").html("请输入帐号和密码!"); break;
                 *  // default: new EsunLog("登陆", "登陆成功!", "信息", ip); break;
                 * }
                 * if (us.State > 0)
                 * {
                 *  Session["User"] = us;
                 * //  EsunLog.Log("登陆", "登陆成功!", "信息", ip);
                 * }*/
                Response.Write(u.State);
                return;
            }
            Response.Write(0);
        }