예제 #1
0
        protected void btnModify_Click(object sender, EventArgs e)
        {
            Bll.AdminTable   bAdmin   = new Bll.AdminTable();
            Model.AdminTable mAdmin   = new Model.AdminTable();
            string           strWhere = "ID='" + txtID.Text + "' and AdminPwd='" + txtOldpwd.Text + "'";
            DataTable        dt       = bAdmin.select(strWhere);

            if (dt.Rows.Count > 0)
            {
                if (txtNewpwd.Text == txtPwd.Text)
                {
                    mAdmin.AdminPwd     = txtPwd.Text;
                    mAdmin.AdminName    = txtName.Text;
                    mAdmin.ID           = Convert.ToInt32(txtID.Text);
                    mAdmin.AdminTrouble = dt.Rows[0]["AdminTrouble"].ToString().Trim();
                    mAdmin.AdminAnswer  = dt.Rows[0]["AdminAnserwer"].ToString().Trim();
                    if (bAdmin.update(mAdmin, Convert.ToInt32(txtID.Text)))
                    {
                        Response.Write("<script>alert('修改成功!')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('修改失败!')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('两次密码不一致!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('密码错误!')</script>");
            }
        }
        protected void ibtn_Click(object sender, ImageClickEventArgs e)
        {
            Bll.AdminTable adm = new Bll.AdminTable();
            DataTable      da  = adm.select("ID='" + txtID.Text + "'");

            try
            {
                if (txtID.Text == (da.Rows[0]["ID"].ToString()))
                {
                    if (txtPwd.Text == (da.Rows[0]["AdminPwd"].ToString()))
                    {
                        HttpContext.Current.Session["adminUserId"] = txtID.Text;
                        Response.Redirect("AdminAdmin.aspx");
                        lableyz.Text = "";
                    }
                    else
                    {
                        lableyz.Text = "密码错误";
                    }
                }
                else
                {
                    lableyz.Text = "账号错误";
                }
            }
            catch
            {
                lableyz.Text = "账号错误";
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Bll.AdminTable   bAdmin   = new Bll.AdminTable();
            Model.AdminTable mAdmin   = new Model.AdminTable();
            string           strWhere = "ID='" + txtID.Text + "' and AdminTrouble='" + txtTrouble.Text + "' and AdminAnserwer='" + txtAnserwer.Text + "'";
            DataTable        dt       = bAdmin.select(strWhere);

            if (dt.Rows.Count > 0)
            {
                Response.Redirect("PrssWordWed.aspx?ID=" + txtID.Text + "&txtTrouble=" + txtTrouble.Text + "&txtAnserwer=" + txtAnserwer.Text);
            }
            else
            {
                Response.Write("<script>alert('输入错误!')</script>");
            }
        }
예제 #4
0
 private void BindData()
 {
     Bll.AdminTable bAdmin = new Bll.AdminTable();
     GridView1.DataSource = bAdmin.select(string.Empty);
     GridView1.DataBind();
 }