コード例 #1
0
    protected void xoaghkh()
    {
        Gio_Hang_KH ghkh = new Gio_Hang_KH();

        try
        {
            ghkh.delete(ghkh);
        }
        catch
        {
        }
    }
コード例 #2
0
    public void delete(Gio_Hang_KH ghkh)
    {
        string cn = "Server=ltp1305.mssql.somee.com;Database=ltp1305;User Id=TheMadKitten_SQLLogin_1;Password=66rbhow211;";

        con = new SqlConnection(cn);
        con.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = con;
        cmd.CommandType = System.Data.CommandType.StoredProcedure;
        cmd.CommandText = "st_xoaghkh";
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        con.Close();
    }
コード例 #3
0
    private void writegiohangkhsession()
    {
        Gio_Hang_KH ghkh1 = new Gio_Hang_KH();

        try
        {
            ghkh1.tendn   = Session["username"].ToString();
            ghkh1.masach  = int.Parse(Session["masach"].ToString());
            ghkh1.ngaymua = DateTime.Now.ToString();
            ghkh1.insert(ghkh1);
        }
        catch
        {
            lblthongbao.Text = "Rất Tiếc, Đã Có Lỗi Xảy Ra Khi Ghi dữ Liệu vào Giỏ Hàng!";
        }
    }
コード例 #4
0
    public void insert(Gio_Hang_KH ghkh)
    {
        string cn = "Server=ltp1305.mssql.somee.com;Database=ltp1305;User Id=TheMadKitten_SQLLogin_1;Password=66rbhow211;";

        con = new SqlConnection(cn);
        con.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = con;
        cmd.CommandType = System.Data.CommandType.StoredProcedure;
        cmd.CommandText = "st_themghkh";
        cmd.Parameters.Add("@tendn", System.Data.SqlDbType.NVarChar, 50).Value    = ghkh.tendn;
        cmd.Parameters.Add("@masach", System.Data.SqlDbType.Int, 100).Value       = ghkh.masach;
        cmd.Parameters.Add("@ngaymua", System.Data.SqlDbType.SmallDateTime).Value = ghkh.ngaymua;
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        con.Close();
    }
コード例 #5
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Gio_Hang_KH ghkh2 = new Gio_Hang_KH();
        AccessData  ac    = new AccessData();

        if (e.CommandName == "del")
        {
            int    tongtientt;
            int    index = int.Parse(e.CommandArgument.ToString());
            string sqltt = "select dongia from sach where masach = " + int.Parse(GridView1.Rows[index].Cells[0].Text);
            tongtientt          = ac.ExecuteScalarInt(sqltt);
            Session["tongtien"] = (Int64.Parse(Session["tongtien"].ToString()) - tongtientt).ToString();
            Session["xoagh"]    = "deleted";
            ghkh2.masach        = int.Parse(GridView1.Rows[index].Cells[0].Text);
            ghkh2.deletesach(ghkh2);
            Response.Redirect("~/Gio_Hang.aspx");
        }
    }