毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

基于.NET的网上商城系统的分析与设计 第9页

更新时间:2008-2-28:  来源:毕业论文

基于.NET的网上商城系统的分析与设计 第9页

  while (reader.Read())

        {

            Label2.Text += reader.GetString(0)+"<br>";

        }

        reader.Close();

        conn.Close();

    }

    protected void BindData()

    {

        conn = new SqlConnection(sets.ConnectionString);

        SqlDataAdapter da = new SqlDataAdapter("select * from Products", conn);

        DataSet ds = new DataSet();

        da.Fill(ds);

        productList.DataSource = ds;

        productList.DataBind();

    }

      protected void Button1_Click(object sender, EventArgs e)

    {

        BindData2();

    }

    protected void BindData2()

    {

        string spmc = prodtdesn.Text;

        conn = new SqlConnection(sets.ConnectionString);

        SqlDataAdapter da = new SqlDataAdapter("select * from Products where Description='" + spmc + "'", conn);

        DataSet ds = new DataSet();

        da.Fill(ds);

        productList.DataSource = ds;

        productList.DataBind();

    }

    protected void LinkButton2_Click(object sender, EventArgs e)

    {

        Response.Redirect("userupdate.aspx");

    }

    protected void productList_PageIndexChanging(object sender, GridViewPageEventArgs e)

    {

        productList.PageIndex = e.NewPageIndex;

        productList.DataBind();

    }

    protected void LinkButton1_Click(object sender, EventArgs e)

    {

        Response.Redirect("Default.aspx");

    }

}

收银台功能实现代码(CheckShopCart2.aspx.cs)

public partial class CheckShopCart2 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        Userorders dingdan = (Userorders)Session["userorder"];

        Label1.Text = dingdan.UserName;

        Label2.Text = dingdan.UserAddress;

        Label3.Text = dingdan.UserCity;

        Label4.Text = dingdan.UserPhone;

        ShoppingCarts cart;

        cart = (ShoppingCarts)Session["shoppingcart"];

        GridView1.DataSource = cart.Product;

        GridView1.DataBind();

        Label5.Text += cart.TotalPrice;

    }

    protected void Button2_Click(object sender, EventArgs e)

    {

        Response.Redirect("shopping.aspx");

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        ConnectionStringSettings sets = ConfigurationManager.ConnectionStrings["DBConnection"];

        SqlConnection conn = new SqlConnection(sets.ConnectionString);

        string username = Session["username"].ToString();

        int n = GridView1.Rows.Count;

        for (int i = 0; i < n; i++)

        {

            int id =Convert.ToInt32( GridView1.Rows[i].Cells[0].Text);

                int num = Convert.ToInt32(GridView1.Rows[i].Cells[4].Text);

            SqlCommand cmd = new SqlCommand("insert into ShopCarts(username,ProductID,ProductNum) values ('" + username+ "'," + id + "," + num+ ")", conn);

            conn.Open();

            cmd.ExecuteNonQuery();

            conn.Close();

        }

        SqlCommand cmd1 = new SqlCommand("insert into SHInformation(username,SHName,SHAddress,SHCity,SHPhone) values ('" + username + "','" + Label1.Text + "','" + Label2.Text + "','" + Label3.Text + "','" + Label4.Text + "')", conn);

        conn.Open();

        cmd1.ExecuteNonQuery();

        conn.Close();

        Response.Write("<script>if(window.confirm('谢谢您的购买!')) location.replace('zxhIndex.aspx');else location.replace('zxhIndex.aspx');</script>");

      }

}

冻结/解冻用户实现代码(fre-unfre-user.aspx.cs)

public partial class fre_unfre_user : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

            BindData();

    }

    ConnectionStringSettings sets = ConfigurationManager.ConnectionStrings["DBConnection"];

    SqlConnection conn;

    protected void BindData()

    {

        conn = new SqlConnection(sets.ConnectionString);

        SqlDataAdapter da = new SqlDataAdapter("select * from Users", conn);

        DataSet ds = new DataSet();

        da.Fill(ds);

        GridView1.DataSource = ds;

        GridView1.DataBind();

    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

    {

        int id = Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text);

        if (e.CommandName == "djyh")

        {

            conn = new SqlConnection(sets.ConnectionString);

            SqlCommand cmd = new SqlCommand("update Users set freeze='1' where userID=" + id,conn);

            conn.Open();

            cmd.ExecuteNonQuery();

            conn.Close();

        }

        else if (e.CommandName == "jdyh")

        {

            conn = new SqlConnection(sets.ConnectionString);

            SqlCommand cmd = new SqlCommand("update Users set freeze='0' where userID=" + id,conn);

            conn.Open();

            cmd.ExecuteNonQuery();

            conn.Close();

        }

        else

        { }

    }

      protected void Button1_Click(object sender, EventArgs e)

    {

               BindData2();

    }

    protected void BindData2()

    {

        string gkxm1 = gkxm.Text;

        conn = new SqlConnection(sets.ConnectionString);

        SqlDataAdapter da = new SqlDataAdapter("select * from Users where username='" + gkxm1 + "'", conn);

        DataSet ds = new DataSet();

        da.Fill(ds);

        GridView1.DataSource = ds;

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

基于.NET的网上商城系统的分析与设计 第9页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。