Ejemplo n.º 1
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (TextBox2.Text.ToString().Trim() == "" || TextBox1.Text.ToString().Trim() == "")
            {
                Response.Write("<script>javascript:alert('请输入完整');history.back();</script>");
                Response.End();
            }
            string sql;

            sql = "select * from 陈凯宇_admin where 姓名='" + TextBox1.Text.ToString().Trim().Replace(" ", "").Replace("'", "") + "'";

            DataTable dt = new DataTable();
            datamysql me = new datamysql();

            dt = me.getTable(sql);
            // result = new TestOnline.Class1().hsggetdata(sql);
            if (dt != null)
            {
                if (dt.Rows.Count > 0 && dt.Rows[0]["密码"].ToString() == TextBox2.Text)
                {
                    Session["username"] = TextBox1.Text.ToString().Trim();

                    Response.Redirect("index.aspx");
                }
                else
                {
                    Response.Write("<script>javascript:alert('对不起,用户名或密码不正确!');history.back();</script>");
                }
            }
            else
            {
                Response.Write("<script>javascript:alert('对不起,系统错误,请不要越权操作!');</script>");
            }
        }
Ejemplo n.º 2
0
        protected void del_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "delete from 陈凯宇_news3  where Id='" + ID.Text + "'";

            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 3
0
        protected void read_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "select * from 陈凯宇_trade";

            GridView1.DataSource = me.getTable(strsql);
            GridView1.DataBind();
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     me = new datamysql();
     if (!Page.IsPostBack)
     {
         readdata();
         readdata1();
     }
 }
Ejemplo n.º 5
0
        protected void read()
        {
            datamysql a      = new datamysql();
            DataTable dt     = new DataTable();
            string    strsql = "select  * from 陈凯宇_hot_product limit 0,4";

            dt = a.getTable(strsql);
            DataList3.DataSource = dt;
            DataList3.DataBind();
        }
Ejemplo n.º 6
0
        protected void readdata1()
        {
            datamysql me     = new datamysql();
            DataTable dt     = new DataTable();
            string    strsql = "select  * from 陈凯宇_business limit 0,4";

            dt = me.getTable(strsql);
            DataList1.DataSource = dt;
            DataList1.DataBind();
        }
Ejemplo n.º 7
0
        protected void yes_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "update 陈凯宇_admin set  ";

            strsql = strsql + " 姓名='" + name.Text + "'";
            strsql = strsql + ",密码='" + password.Text + "'";
            strsql = strsql + " where 姓名='" + name.Text + "'";
            me.ExecuteSql(strsql);
            Response.Write("<script>javascript:alert('修改成功');history.back();</script>");
        }
Ejemplo n.º 8
0
        protected void add_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "insert into 陈凯宇_news3(Id,标题,内容,时间) values('" + ID.Text + "'";

            strsql = strsql + ",'" + 标题.Text + "'";
            strsql = strsql + ",'" + 内容.Text + "'";
            strsql = strsql + ",'" + 时间.Text + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            me = new datamysql();
            DataTable dt     = new DataTable();
            string    strsql = "select * from 陈凯宇_ku";

            dt = me.getTable(strsql);
            if (!Page.IsPostBack)
            {
                readdata();
            }
        }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Session["username"] == null)
         {
             Response.Redirect("login.aspx");
         }
         else
         {
             user.Text = Session["username"].ToString();
         }
         name = Session["username"].ToString();
     }
     me = new datamysql();                  //
     if (Request.QueryString["Id"] != null) //从employee 表 中读数据
     {
         string    lei = "select 等级 from 陈凯宇_vip where 姓名 = name";
         string    price;
         string    price1;
         double    p;
         double    p1;
         string    xh     = Request.QueryString["Id"].ToString();
         string    strsql = "select * from 陈凯宇_cart where id=" + xh + "";
         DataTable dt     = new DataTable();
         dt = me.getTable(strsql);
         if (dt.Rows.Count > 0)
         {
             lblid.Text   = dt.Rows[0]["产品名"].ToString();
             lbl产品名称.Text = dt.Rows[0]["产品介绍"].ToString();
             if (lei == "普通顾客")
             {
                 lbl价格.Text = dt.Rows[0]["价格"].ToString();
             }
             else if (lei == "会员")
             {
                 price      = dt.Rows[0]["价格"].ToString();
                 p          = Convert.ToInt16(price);
                 p          = p * 0.8;
                 lbl价格.Text = p.ToString();
             }
             else
             {
                 price1     = dt.Rows[0]["价格"].ToString();
                 p1         = Convert.ToInt16(price1);
                 p1         = p1 * 0.6;
                 lbl价格.Text = p1.ToString();
             }
             imgShow.ImageUrl = dt.Rows[0]["图片"].ToString();
             imgShow.Width    = imgShow.Height;
         }
     }
 }
Ejemplo n.º 11
0
        protected void add_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "insert into 陈凯宇_trade(消费者,购买数量,产品名称,购买时间) values(";

            strsql = strsql + "'" + 消费者.Text + "'";
            strsql = strsql + ",'" + 购买数量.Text + "'";
            strsql = strsql + ",'" + 产品名称.Text + "'";
            strsql = strsql + ",'" + 购买时间.Text + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["Id"] != null)//从employee 表 中读数据
     {
         datamysql me     = new datamysql();
         string    myid   = Request.QueryString["Id"].ToString();
         string    strsql = "select * from 陈凯宇_ku where id=" + myid + "";
         DataTable dt     = new DataTable();
         dt = me.getTable(strsql);
         DataList1.DataSource = dt;
         DataList1.DataBind();
     }
 }
Ejemplo n.º 13
0
        protected void modi_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "update 陈凯宇_news3 set  ";

            strsql = strsql + ",标题='" + 标题.Text + "'";
            strsql = strsql + ",内容='" + 内容.Text + "'";
            strsql = strsql + ",时间='" + 时间.Text + "'";

            strsql = strsql + " where Id='" + ID.Text + "'";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 14
0
        protected void add_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "insert into 陈凯宇_vip(Id,姓名,密码,地址,联系方式) values('" + ID.Text + "'";

            strsql = strsql + ",'" + 姓名.Text + "'";
            strsql = strsql + ",'" + 密码.Text + "'";

            strsql = strsql + ",'" + 地址.Text + "'";
            strsql = strsql + ",'" + 联系方式.Text + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 15
0
        protected void add_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "insert into 陈凯宇_ku(产品名,价格,产品介绍,数量,图片) values(";

            strsql = strsql + "'" + 产品名称.Text + "'";
            strsql = strsql + ",'" + 价格.Text + "'";
            strsql = strsql + ",'" + 产品介绍.Text + "'";
            strsql = strsql + ",'" + 数量.Text + "'";
            strsql = strsql + ",'" + 图片.Text + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 16
0
        protected void modi_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "update 陈凯宇_ku set  ";

            strsql = strsql + " 价格='" + 价格.Text + "'";
            strsql = strsql + ",产品介绍='" + 产品介绍.Text + "'";
            strsql = strsql + ",数量='" + 数量.Text + "'";
            strsql = strsql + ",产品名称='" + 产品名称.Text + "'";
            strsql = strsql + ",图片='" + 图片.Text + "'";
            strsql = strsql + " where Id='" + ID.Text + "'";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 17
0
        protected void modi_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "update 陈凯宇_vip set  ";

            strsql = strsql + " 姓名='" + 姓名.Text + "'";
            strsql = strsql + ",密码='" + 密码.Text + "'";
            strsql = strsql + ",地址='" + 地址.Text + "'";
            strsql = strsql + ",联系方式='" + 联系方式.Text + "'";

            strsql = strsql + " where Id='" + ID.Text + "'";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 18
0
        protected void modi_Click1(object sender, EventArgs e)
        {
            datamysql me     = new datamysql();
            string    strsql = "update 陈凯宇_trade set  ";

            strsql = strsql + " 消费者='" + 消费者.Text + "'";
            strsql = strsql + ",购买数量='" + 购买数量.Text + "'";

            strsql = strsql + ",产品名称='" + 产品名称.Text + "'";
            strsql = strsql + ",购买时间='" + 购买时间.Text + "'";

            strsql = strsql + " where Id='" + ID.Text + "'";
            me.ExecuteSql(strsql);
            read_Click1(sender, e);
        }
Ejemplo n.º 19
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            string    guan    = "普通顾客";
            string    bianhao = System.DateTime.Now.ToString("yyyyMMddHHff");
            datamysql me      = new datamysql();
            string    strsql  = "insert into 陈凯宇_vip(姓名,密码,地址,联系方式) values(";

            strsql = strsql + "'" + user1.Text + "'";
            strsql = strsql + ",'" + password1.Text + "'";
            strsql = strsql + ",'" + address.Text + "'";
            strsql = strsql + ",'" + tel.Text + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            Response.Write("<script>javascript:alert('恭喜你注册成功!');</script>");
            Response.Redirect("login.aspx");
        }
Ejemplo n.º 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["newsId"] != null)//从employee 表 中读数据
     {
         datamysql me     = new datamysql();
         string    myid   = Request.QueryString["newsId"].ToString();
         string    newid  = Request.QueryString["id"].ToString();
         string    strsql = "select * from 陈凯宇_news" + newid + " where id=" + myid + "";
         DataTable dt     = new DataTable();
         dt = me.getTable(strsql);
         if (dt.Rows.Count > 0)
         {
             title.Text   = dt.Rows[0]["标题"].ToString();
             message.Text = dt.Rows[0]["内容"].ToString();
         }
     }
 }
Ejemplo n.º 21
0
        protected void buy_Click(object sender, EventArgs e)
        {
            string    time   = System.DateTime.Now.ToString();
            string    tai    = "已下单";
            datamysql me     = new datamysql();
            string    strsql = "insert into 陈凯宇_trade(消费者,产品名称,购买数量,购买时间,状态) values('" + user.Text + "'";

            strsql = strsql + ",'" + lblid.Text + "'";
            strsql = strsql + ",'" + txt购买数量.Text + "'";
            strsql = strsql + ",'" + time + "'";
            strsql = strsql + ",'" + tai + "'";
            strsql = strsql + ")";
            me.ExecuteSql(strsql);
            string strsq2 = "update 陈凯宇_ku set 数量= 数量-" + txt购买数量.Text + " where 产品名='" + lblid.Text + "';";

            me.ExecuteSql(strsq2);
            Response.Write("<script>javascript:alert('恭喜你购买成功!');</script>");
        }
Ejemplo n.º 22
0
        protected void txt购买数量_TextChanged(object sender, EventArgs e)
        {
            string num = txt购买数量.Text;

            me = new datamysql();                  //
            if (Request.QueryString["Id"] != null) //从employee 表 中读数据
            {
                string    lei = "select 等级 from 陈凯宇_vip where 姓名 = name";
                string    price;
                string    price1;
                double    p;
                double    p1;
                string    xh     = Request.QueryString["Id"].ToString();
                string    strsql = "select * from 陈凯宇_cart where id=" + xh + "";
                DataTable dt     = new DataTable();
                dt = me.getTable(strsql);
                if (dt.Rows.Count > 0)
                {
                    lblid.Text   = dt.Rows[0]["产品名"].ToString();
                    lbl产品名称.Text = dt.Rows[0]["产品介绍"].ToString();
                    if (lei == "普通")
                    {
                        price      = dt.Rows[0]["价格"].ToString();
                        p          = Convert.ToInt16(price);
                        lbl价格.Text = (p * int.Parse(num)).ToString();
                    }
                    else if (lei == "会员")
                    {
                        price      = dt.Rows[0]["价格"].ToString();
                        p          = Convert.ToInt16(price);
                        p          = p * 0.8;
                        lbl价格.Text = (p * int.Parse(num)).ToString();
                    }
                    else
                    {
                        price1     = dt.Rows[0]["价格"].ToString();
                        p1         = Convert.ToInt16(price1);
                        lbl价格.Text = (p1 * int.Parse(num)).ToString();
                    }
                    imgShow.ImageUrl = dt.Rows[0]["图片"].ToString();
                    imgShow.Width    = imgShow.Height;
                }
            }
        }
Ejemplo n.º 23
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            hu = user1.Text.ToString().Trim();
            mi = password1.Text.ToString().Trim();
            if (hu == "" || mi == "")
            {
                Response.Write("<script>javascript:alert('请输入完整');history.back();</script>");
                Response.End();
            }
            string sql;

            sql = "select * from 陈凯宇_vip where 姓名='" + hu.Replace(" ", "").Replace("'", "") + "'";

            DataTable dt = new DataTable();
            datamysql me = new datamysql();

            dt = me.getTable(sql);
            // result = new TestOnline.Class1().hsggetdata(sql);
            if (dt != null)
            {
                if (dt.Rows.Count > 0 && dt.Rows[0]["密码"].ToString() == password1.Text)
                {
                    Session["username"] = hu;

                    Response.Redirect("shop.aspx");
                }
                else
                {
                    Response.Write("<script>javascript:alert('对不起,用户名或密码不正确!');history.back();</script>");
                }
            }
            else
            {
                Response.Write("<script>javascript:alert('对不起,系统错误,请不要越权操作!');</script>");
            }
            //is_second_load = false;
        }