protected void btnOK_Click(object sender, EventArgs e)
        {
            string id = this.userid.Text.ToString();
            string pwd = this.userpwd.Text.ToString();
            if (id == "" || pwd == "")
            {
                this.falseCause.Text = "*用户名与密码不能为空,请重新输入!";
                return;
            }

            BLL.userTb blluser = new BLL.userTb();
            List<Model.userTb> users = blluser.GetModelList("1=1");
            for (int i = 0; i < users.Count; i++)
            {
                if (Convert.ToString(users[i].userID) == this.userid.Text.ToString())
                {
                    Model.userTb userInfo = blluser.GetModel(Convert.ToInt32(id));
                    if (userInfo.userPwd == pwd) { Response.Redirect("LTsection.aspx"); }
                    else
                    {
                        this.falseCause.Text = "*密码错误,请重新输入!";
                        return;
                    }
                }
                else
                {
                    this.falseCause.Text = "*账号不存在,请重新输入!";

                }

            }
        }
        protected void loginBtn1_Click(object sender, EventArgs e)
        {
            string email = this.textEmailT.Text.ToString();
            string pwd = this.textPasswordT.Text.ToString();
            BLL.userTb blluser = new BLL.userTb();
            if (email == "" || pwd == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>alert('邮箱与密码不能为空,请重新输入!');</script>",false  );
                return;
            }

            List<Model.userTb> moduser = blluser.GetModelList("userEmail='" + email + "'");
            foreach (Model.userTb moduser1 in  moduser ){
                if (moduser1.state == "0")
                {

                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>alert('您的账号已经被封号!');</script>", false );
                }
                else
                {
                    if (moduser1.userPwd != pwd)
                    {

                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>alert('邮箱与密码不匹配,请重新输入!');</script>",false );
                        //this.textEmailT.Text = "";
                        this.textPasswordT.Text = "";
                        return;
                    }

                    Model.eventsTb modevent = new Model.eventsTb();
                    BLL.eventsTb bllevent = new BLL.eventsTb();
                    modevent.operatorID = moduser[0].userID;
                    modevent.operateAction = "用户登陆";
                    modevent.operateContent = "用户登陆成功";
                    modevent.operateTime = System.DateTime.Now.ToLocalTime();
                    bllevent.Add(modevent);

                    Session["no"] = email;
                    Session["pwd"] = pwd;

                    Response.Redirect("userHome.aspx");

                }
            }
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>alert('账号不存在,请重新输入!');</script>", false);
            this.textEmailT.Text = "";
            this.textPasswordT.Text = "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string myEmail = Session["no"].ToString();
            string myname;
            string fansnum;
            string noveltynum;
            string guanzhunum;
            string myImg;

            BLL.userTb bll_user = new BLL.userTb();
            Model.userTb me = new Model.userTb();
            List<Model.userTb> myspace = new List<Model.userTb>();
            myspace = bll_user.GetModelList("userEmail='" + myEmail + "'");
            me = myspace[0];
            MyID = me.userID;
            myname = me.userName;
            myImg = me.headImgUrl;

            BLL.fansTb bll_fans = new BLL.fansTb();
            List<Model.fansTb> fans = new List<Model.fansTb>();
            fans = bll_fans.GetModelList("ownedID='" + MyID.ToString() + "'");
            fansnum = fans.Count().ToString();

            BLL.noveltyTb bll_noveltyTb = new BLL.noveltyTb();
            List<Model.noveltyTb> novs = new List<Model.noveltyTb>();
            novs = bll_noveltyTb.GetModelList("senderID='" + MyID.ToString() + "'");
            noveltynum = novs.Count().ToString();

            BLL.fansTb bll_guanzhu = new BLL.fansTb();
            List<Model.fansTb> guanzhus = new List<Model.fansTb>();
            guanzhus = bll_guanzhu.GetModelList("ownID='" + MyID.ToString() + "'");
            guanzhunum = guanzhus.Count().ToString();

            this.myImg.Src = myImg;
            this.myname.InnerText = myname;
            this.noveltynum.InnerHtml = noveltynum;
            this.fansnum.InnerText = fansnum;
            this.guanzhunum.InnerText = guanzhunum;
        }
        public void bindData(int pageIn, string selectWhere)
        {
            BLL.userTb blluser = new BLL.userTb();
            List<Model.userTb> users = blluser.GetModelList(selectWhere);
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = users;
            pds.PageSize = 8;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = pageIn;
            this.gvSuperAdminSeeInfo.DataSource = pds;
            this.gvSuperAdminSeeInfo.DataBind();

            int pageCount = pds.PageCount;
            StringBuilder html = new StringBuilder("");
            html.Append("<a class='pageA pageStart pageA0' href='adminSeeUser.aspx?pageInd=0'>首页</a>");
            for (int i = 0; i < pageCount; i++)
            {
                html.Append("<a class='pageA pageNum pageA" + i.ToString() + "' href='adminSeeUser.aspx?pageInd=" + i.ToString() + "'>" + (i + 1).ToString() + "</a>");
            }
            html.Append("<a class='pageA pageStart pageA"+(pageCount-1).ToString()+"' href='adminSeeUser.aspx?pageInd=" + (pageCount - 1).ToString() + "'>尾页</a>");
            this.dgvpage.InnerHtml = html.ToString();
            ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "clickPage", "clickPage(" + pageIn.ToString() + ");", true);
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            /*         BLL.userTb bllutb = new BLL.userTb();
            List<Model.userTb> listmodelutb = bllutb.GetModelList("1=1");
            foreach (Model.userTb u in listmodelutb)
            {
                if (u.userEmail == loginemail)
                {
                    u.userPwd = this.txtpwd.Text;
                    bllutb.Update(u);
                }
            }     */

            if (this.txtpwd.Text == "" || this.txtpwdagain.Text == "")
            {
                this.lblmsg3.Visible = true;
                this.lblmsg4.Visible=false;
                this.lblmsg5.Visible = false;
            }
            if (this.txtpwd.Text != this.txtpwdagain.Text && this.txtpwd.Text != "" && this.txtpwdagain.Text != "")
            {
                this.lblmsg3.Visible = false;
                this.lblmsg4.Visible = true;
                this.lblmsg5.Visible = false;
            }
            if (this.txtpwd.Text == this.txtpwdagain.Text && this.txtpwd.Text != "" && this.txtpwdagain.Text != "")
            {
                BLL.userTb bllutb = new BLL.userTb();
                List<Model.userTb> listmodelutb = bllutb.GetModelList("1=1");
                listmodelutb[0].userPwd = this.txtpwd.Text;
                bllutb.Update(listmodelutb[0]);
                this.lblmsg3.Visible = false;
                this.lblmsg4.Visible = false;
                this.lblmsg5.Visible = true;
            }
        }
        protected void BtnSend_Email_Click(object sender, EventArgs e)
        {
            if (this.Txt_Email.Text == "")
            {
                this.Lblsryx.Visible = true;
                this.Lblwzc.Visible = false;

            }
            else
            {
                this.Lblsryx.Visible = false;
                BLL.userTb buser = new BLL.userTb();
                List<Model.userTb> lmuser = buser.GetModelList("1=1");
                    int i = 0;
                    for (; i < lmuser.Count; )
                    {

                        if (this.Txt_Email.Text != lmuser[i].userEmail)
                        {
                            i++;
                        }

                        else
                            break;
                    }
                    if (i >= lmuser.Count)
                    {
                        this.Lblwzc.Visible = true;
                    }
                    if (i < lmuser.Count && (Txtyzm.Text == "ym3w" || Txtyzm.Text == "ym3w"))
                    {
                        this.Lblwzc.Visible = false;
                        MailMessage m_message = new MailMessage();

                        m_message.From = new MailAddress("*****@*****.**");

                        m_message.To.Add(new MailAddress(this.Txt_Email.Text));

                        m_message.Subject = "LittleWorld";

                        m_message.Body = "邮箱验证信息:http://localhost:3448/userResetPwd.aspx 载入重置密码界面";

                        SmtpClient m_smtpClient = new SmtpClient();

                        m_smtpClient.Send(m_message);

                        Response.Write("<script>alert('验证信息已发送至您邮箱,请进入邮箱验证!');</script>");

                    }

            }

            if (this.Txtyzm.Text =="")
            {
                this.Lblsryzm.Visible = true;
            }
            else
            {
                this.Lblsryzm.Visible = false;
                if (Txtyzm.Text != "ym3w" || Txtyzm.Text != "ym3w")
                {
                    this.Lblyzm.Visible = true;
                }
                else
                    this.Lblyzm.Visible = false;
            ;
            }
        }
 protected void search_Click(object sender, EventArgs e)
 {
     string searchT = this.searchText.Text;
     if (searchT == "")
     {
         ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showErrorAlert", "showErrorAlert('请输入关键字!');", true);
         return;
     }
     try
     {
         BLL.userTb blluserTb = new BLL.userTb();
         List<Model.userTb> users = blluserTb.GetModelList("userID like '%" + searchT + "%'");
         if (users.Count == 0)
         {
             ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showNoticeAlert", "showNoticeAlert('没有您要找的用户!');", true);
             return;
         }
         bindData(0, "userID like '%" + searchT + "%'");
     }
     catch (Exception)
     {
         ScriptManager.RegisterStartupScript(searchBtn, this.GetType(), "showErrorAlert", "showErrorAlert('发生错误,请重新输入关键字!');", true);
     }
 }