Exemple #1
0
    /// <summary>
    /// 检查密码是否正确
    /// </summary>
    private void GetModelByCodeAndPwd()
    {
        string userCode = txtID.Value.Trim();
        string userPwd  = security.Encrypt(txtPwd.Value.Trim(), security.se_yaoshi);

        if (userBll.CheckUserCodeAndPwd(userCode, userPwd) > 0)
        {
            UserInfo info = userBll.GetModelOfUserByUserCodeAndPwd(userCode, userPwd);
            Session["UserID"]   = info.UserID;
            Session["UserCode"] = info.UserCode;
            Session["UserName"] = info.UserName;
            Session["UserPwd"]  = info.UserPwd;
            URrelation relation = urRelationBll.GetModelOfURrelationByUserID(info.UserID.Trim());
            if (relation != null)
            {
                Session["RoleID"] = relation.RoleID;
            }
            //if (info1.RoleCode == 4 || info1.RoleCode == 6)
            //{
            //    Session["SaleHallCode"] = Convert.ToString(info1.SaleHallCode);
            //}
            //else
            //{
            //    Session["SaleHallCode"] = 0;
            //}
            Response.Redirect("frmMain.htm");
        }
        else
        {
            //连续输入错误密码时
            //if (Session["User"] == null)
            //{
            //    Session["User"] = txtUserName.Text;
            //}
            //else
            //{
            //    if (Session["User"].ToString() == txtUserName.Text)
            //    {
            //        int Lock = Convert.ToInt32(Session["LoginCount"].ToString());
            //        Lock += 1;
            //        if (Lock == 3)
            //        {
            //            int affect = lockBLL.ModifyLockCodeByUserName(txtUserName.Text);
            //            Response.Write(CommonClass.MessageBox("你已经连续输入三次错误密码!"));
            //            Session["LoginCount"] = "1";
            //            return;
            //        }

            //        Session["LoginCount"] = Convert.ToString(Lock);
            //    }
            //    else
            //    {
            //        Session["User"] = txtUserName.Text;
            //        Session["LoginCount"] = "1";
            //    }
            //}
            Response.Write("<script>alert('你输入的秘密错误!')</script>");
        }
    }
Exemple #2
0
    /// <summary>
    /// 检验输入的老密码是否正确
    /// </summary>
    /// <returns></returns>
    private bool CheckOldPwd(string userCode, string userPwd)
    {
        int count = userBll.CheckUserCodeAndPwd(userCode, userPwd);

        if (count > 0)
        {
            return(true);
        }
        return(false);
    }