Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //if (Request.Cookies["CheckCode"] == null)
            //{
            //    sm.ShowLocation("您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统。");
            //}

            //    if (String.Compare(Request.Cookies["CheckCode"].Value, TextBox3.Text.ToString().Trim(), true) != 0)
            //   {
            //       sm.ShowLocation("验证码输入有误。");
            //   }
            //    else
            {
                GustBook.Model.Admin mo = new GustBook.Model.Admin();
                mo.AdminName = TextBox1.Text.Trim();
                mo.PassWord  = TextBox2.Text.Trim();

                GustBook.BLL.Admin bll = new GustBook.BLL.Admin();
                if (bll.ulogin(mo))
                {
                    Panel1.Visible = false;
                    //Session.Add("nName", mo.AdminName);
                    Session["nName"] = mo.AdminName;
                    Response.Redirect("default.aspx");
                }
                else
                {
                    GustBook.DBUtility.ShowMessagae sm = new GustBook.DBUtility.ShowMessagae();
                    sm.ShowLocation("请检查用户名和密码是否正确!!");
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Response.Cookies.Add(new HttpCookie("CheckCode",""));
                AspNetPager1.RecordCount = (int)myData.ExecuteScalar("Select Count(*) from Content");
                GetList();
            }
            if (Session["nName"] != null)
            {
                Panel1.Visible = false;
            }

            if (Request.QueryString["action"] == "loginout")
            {
                Session["nName"] = null;
                Panel1.Visible   = true;
                GustBook.DBUtility.ShowMessagae sm = new GustBook.DBUtility.ShowMessagae();
                sm.ShowRedirect("已退出管理模式!", "default.aspx");
            }

            if (Request.QueryString["action"] == "del")
            {
                //GustBook.Model.Admin mo = new GustBook.Model.Admin();
                //mo.Id =int.Parse( Request.QueryString["id"]);
                int nId = int.Parse(Request.QueryString["id"]);
                GustBook.BLL.Admin bll = new GustBook.BLL.Admin();
                if (bll.uDel(nId))
                {
                    sm.ShowRedirect("删除成功!", "default.aspx");
                }
                else
                {
                    sm.ShowRedirect("出现异常!", "default.aspx");
                }
            }
        }