Пример #1
0
 protected void btn_login_Click(object sender, EventArgs e)
 {
     string CheckCode = this.txtCheckCode.Value.Trim();  //验证码
     if (String.Compare(Request.Cookies["ValidateCode"].Value, CheckCode, true) != 0)
     {
         Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('验证码输入不正确,请重新输入!');</script>");
         return;
     }
     if (this.st_type.Value == "1")
     {
         personal personal = new personal();
         personal.loginId = this.txtUid.Value.Trim();
         personal.pwd = this.txtLogPwd.Value.Trim();
         personal.ifEnable = "1";
         if (personal.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = personal.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "1";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
     else if (this.st_type.Value == "2")
     {
         investor investor = new investor();
         investor.loginId = this.txtUid.Value.Trim();
         investor.pwd = this.txtLogPwd.Value.Trim();
         investor.ifEnable = "1";
         if (investor.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = investor.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "2";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
     else if (this.st_type.Value == "3")
     {
         company company = new company();
         company.loginId = this.txtUid.Value.Trim();
         company.pwd = this.txtLogPwd.Value.Trim();
         company.ifEnable = "1";
         if (company.userIfEnable())
         {
             Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('该用户没有认证,请查看邮箱认证用户!');</script>");
             return;
         }
         else
         {
             DataSet dtSet = company.userLogin();
             if (dtSet.Tables[0].Rows.Count > 0)
             {
                 Session["uid"] = dtSet.Tables[0].Rows[0]["id"].ToString();
                 Session["uname"] = dtSet.Tables[0].Rows[0]["name"].ToString();
                 Session["loginId"] = dtSet.Tables[0].Rows[0]["loginId"].ToString();
                 Session["utype"] = "3";
                 this.lb_showLogin.Text = "<a href=\"javascript:void(0)\" class=\"Logo\"  onclick=\"loginOut();\"  id=\"loginOut\">注销</a><a href=\"javascript:void(0)\" class=\"Rion\" id=\"User\"> 欢迎你," + dtSet.Tables[0].Rows[0]["name"].ToString() + "</a>";
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>tip('用户名或密码输入错,请重新输入!');</script>");
                 return;
             }
         }
     }
 }