protected void btndangki_Click(object sender, EventArgs e) { string ten_khach_hang = txthoten.Text; int phai = int.Parse(txtphai.Text); string dia_chi = txtdiachi.Text; string dien_thoai = txtdienthoai.Text; string email = txtemail.Text; string ghi_chu = txtghichu.Text; string mat_khau = txtmatkhau.Text; int count = new cls_trangchu().insert_khachhang(ten_khach_hang, phai, dia_chi, dien_thoai, email, ghi_chu, mat_khau); if (count != 0) { hienthi.Text = "Đăng ký thành công!!"; txthoten.Text = ""; txtphai.Text = ""; txtdiachi.Text = ""; txtemail.Text = ""; txtdienthoai.Text = ""; txtghichu.Text = ""; txtmatkhau.Text = ""; } else { hienthi.Text = "Đăng ký bị lỗi!!"; } }
protected void gvkhachhang_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Them_moi_khachhang")) { string tenkhachang = ((TextBox)gvkhachhang.FooterRow.FindControl("txttenkhachhang")).Text; int phai = int.Parse(((TextBox)gvkhachhang.FooterRow.FindControl("txtphai")).Text); string diachi = ((TextBox)gvkhachhang.FooterRow.FindControl("txtdiachi")).Text; string dienthoai = ((TextBox)gvkhachhang.FooterRow.FindControl("txtdienthoai")).Text; string email = ((TextBox)gvkhachhang.FooterRow.FindControl("txtemail")).Text; string ghichu = ((TextBox)gvkhachhang.FooterRow.FindControl("txtghichu")).Text; string matkhau = ((TextBox)gvkhachhang.FooterRow.FindControl("txtmatkhau")).Text; int COUNT = new cls_trangchu().insert_khachhang(tenkhachang, phai, diachi, dienthoai, email, ghichu, matkhau); if (COUNT != 0) { GetALL(); lblerr.Text = ""; } else { lblerr.Text = "Lỗi rồi!"; } } else if (e.CommandName.Equals("Delete")) { } }
protected void gvsanpham_RowUpdating(object sender, GridViewUpdateEventArgs e) { int row = e.RowIndex; int id_san_pham = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEidsanpham")).Text); string ma_san_pham = ((TextBox)gvsanpham.Rows[row].FindControl("txtEmasanpham")).Text; string ten_san_pham = ((TextBox)gvsanpham.Rows[row].FindControl("txtEtensanpham")).Text; int ma_loai = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEmaloai")).Text); string mo_ta_chi_tiet = ((TextBox)gvsanpham.Rows[row].FindControl("txtEmotachitiet")).Text; int don_gia = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEdongia")).Text); string dvt = ((TextBox)gvsanpham.Rows[row].FindControl("txtEdvt")).Text; string tinh_trang = ((TextBox)gvsanpham.Rows[row].FindControl("txtEtinhtrang")).Text; string hinh = ((TextBox)gvsanpham.Rows[row].FindControl("txtEhinh")).Text; int san_pham_moi = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEsanphammoi")).Text); string tac_gia = ((TextBox)gvsanpham.Rows[row].FindControl("txtEtacgia")).Text; string nxb = ((TextBox)gvsanpham.Rows[row].FindControl("txtEnxb")).Text; DateTime ngay_xuat_ban = DateTime.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEngayxuatban")).Text); int so_trang = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEsotrang")).Text); int danh_muc = int.Parse(((TextBox)gvsanpham.Rows[row].FindControl("txtEdanhmuc")).Text); int result = new cls_trangchu().update_sanpham(id_san_pham, ma_san_pham, ten_san_pham, ma_loai, mo_ta_chi_tiet, don_gia, dvt, tinh_trang, hinh, san_pham_moi , tac_gia, nxb, ngay_xuat_ban, so_trang, danh_muc); if (result != 0) { gvsanpham.EditIndex = -1; GetALL(); } }
protected void cmdDathang_Click(object sender, EventArgs e) { DataTable cart = new DataTable(); if (Session["cart"] != null && Session["makhachhang"] != null) { cart = Session["cart"] as DataTable; foreach (DataRow dr in cart.Rows) { int ma_hoa_don = int.Parse(Session["makhachhang"].ToString()); DateTime ngay_dat = DateTime.Today; int so_luong = int.Parse(dr["Quantity"].ToString()); float tong_tien = float.Parse(dr["Price"].ToString()); int id_san_pham = int.Parse(dr["ID"].ToString()); int ma_khach_hang = int.Parse(Session["makhachhang"].ToString()); string ghi_chu = ""; int tinh_trang = 1; int count = new cls_trangchu().insert_hoadon(ma_hoa_don, ngay_dat, so_luong, tong_tien, id_san_pham, ma_khach_hang, ghi_chu, tinh_trang); if (count != 0) { } } Response.Redirect("dathang.aspx"); } else { Response.Write("<script>alert('Bạn chưa đăng nhập hoặc chưa có hàng trong giỏ!!!')</script>"); Response.Redirect("dangnhap.aspx"); } }
protected void btnSua_Click(object sender, EventArgs e) { int ma_khach_hang = int.Parse(Session["makhachhang"].ToString()); TextBox ten_khach_hang = datalist.Items[0].FindControl("txthoten") as TextBox; TextBox phai = datalist.Items[0].FindControl("txtphai") as TextBox; TextBox dia_chi = datalist.Items[0].FindControl("txtdiachi") as TextBox; TextBox dien_thoai = datalist.Items[0].FindControl("txtdienthoai") as TextBox; TextBox email = datalist.Items[0].FindControl("txtemail") as TextBox; TextBox ghi_chu = datalist.Items[0].FindControl("txtghichu") as TextBox; string ten_khach_hang2 = ten_khach_hang.Text; int phai2 = int.Parse(phai.Text); string dia_chi2 = dia_chi.Text; string dien_thoai2 = dien_thoai.Text; string email2 = email.Text; string ghi_chu2 = ghi_chu.Text; string mat_khau2 = Session["matkhau"].ToString(); int count = new cls_trangchu().update_khachang(ma_khach_hang, ten_khach_hang2, phai2, dia_chi2, dien_thoai2, email2, ghi_chu2, mat_khau2); if (count != 0) { hienthi.Text = "Update thành công!!"; } else { hienthi.Text = "Update bị lỗi!!"; } }
public void GetALL() { DataSet dsSanPham = new DataSet(); dsSanPham = new cls_trangchu().select_sanpham(); if (dsSanPham.Tables.Count > 0) { gvsanpham.DataSource = dsSanPham.Tables[0]; gvsanpham.DataBind(); } }
public void Getsalary() { DataSet kh = new DataSet(); kh = new cls_trangchu().select_khachhangtheoma(int.Parse(Session["makhachhang"].ToString())); if (kh.Tables.Count > 0) { datalist.DataSource = kh.Tables[0]; datalist.DataBind(); } }
public void GetALL() { DataSet dskhachhang = new DataSet(); dskhachhang = new cls_trangchu().select_khachhang(); if (dskhachhang.Tables.Count > 0) { gvkhachhang.DataSource = dskhachhang.Tables[0]; gvkhachhang.DataBind(); } }
public void GetALL() { DataSet dsSanPham = new DataSet(); dsSanPham = new cls_trangchu().select_sachtienganh(); if (dsSanPham.Tables.Count > 0) { //PagedDataSource pg = new PagedDataSource(); //pg.DataSource = dsSanPham.Tables; //pg.AllowPaging = true; //pg.PageSize = 1; //datalist.DataSource = pg; //datalist.DataBind(); datalist.DataSource = dsSanPham.Tables[0]; datalist.DataBind(); } }
public void GetALL() { DataSet sp = new DataSet(); int ID = int.Parse(Session["makhachhang"].ToString()); sp = new cls_trangchu().select_hoadontheoma(ID); if (sp.Tables.Count > 0) { //PagedDataSource pg = new PagedDataSource(); //pg.DataSource = dsSanPham.Tables; //pg.AllowPaging = true; //pg.PageSize = 1; //datalist.DataSource = pg; //datalist.DataBind(); datalist.DataSource = sp.Tables[0]; datalist.DataBind(); } }
public void GetALL() { DataSet sp = new DataSet(); int ID = int.Parse(Request.QueryString["ID"]); sp = new cls_trangchu().select_sachtheoID(ID); if (sp.Tables.Count > 0) { //PagedDataSource pg = new PagedDataSource(); //pg.DataSource = dsSanPham.Tables; //pg.AllowPaging = true; //pg.PageSize = 1; //datalist.DataSource = pg; //datalist.DataBind(); datalist.DataSource = sp.Tables[0]; datalist.DataBind(); } }
protected void gvsanpham_RowDeleting(object sender, GridViewDeleteEventArgs e) { int row = e.RowIndex; HtmlAnchor a = (HtmlAnchor)gvsanpham.Rows[row].FindControl("aIdsanpham"); int id = int.Parse(a.InnerText.Trim()); int count = new cls_trangchu().delete_sanpham(id); if (count != 0 ) { GetALL(); lblerr.Text = ""; } else { lblerr.Text = "Lỗi rồi!"; } }
protected void gvkhachhang_RowUpdating(object sender, GridViewUpdateEventArgs e) { int row = e.RowIndex; HtmlAnchor a = (HtmlAnchor)gvkhachhang.Rows[row].FindControl("aMakhachhang"); int id = int.Parse(a.InnerText); int makhachang = id; //int makhachang = int.Parse(((TextBox)gvkhachhang.FooterRow.FindControl("txtmakhachhang")).Text); string tenkhachang = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEtenkhachhang")).Text; int phai = int.Parse(((TextBox)gvkhachhang.Rows[row].FindControl("txtEphai")).Text); string diachi = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEdiachi")).Text; string dienthoai = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEdienthoai")).Text; string email = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEemail")).Text; string ghichu = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEghichu")).Text; string matkhau = ((TextBox)gvkhachhang.Rows[row].FindControl("txtEmatkhau")).Text; int result = new cls_trangchu().update_khachang(makhachang, tenkhachang, phai, diachi, dienthoai, email, ghichu, matkhau); if (result != 0) { gvkhachhang.EditIndex = -1; GetALL(); } }
protected void gvsanpham_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Them_moi_sanpham")) { int id_san_pham = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtidsanpham")).Text); string ma_san_pham = ((TextBox)gvsanpham.FooterRow.FindControl("txtmasanpham")).Text; string ten_san_pham = ((TextBox)gvsanpham.FooterRow.FindControl("txttensanpham")).Text; int ma_loai = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtmaloai")).Text); string mo_ta_chi_tiet = ((TextBox)gvsanpham.FooterRow.FindControl("txtmotachitiet")).Text; int don_gia = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtdongia")).Text); string dvt = ((TextBox)gvsanpham.FooterRow.FindControl("txtdvt")).Text; string tinh_trang = ((TextBox)gvsanpham.FooterRow.FindControl("txttinhtrang")).Text; string hinh = ((TextBox)gvsanpham.FooterRow.FindControl("txthinh")).Text; int san_pham_moi = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtsanphammoi")).Text); string tac_gia = ((TextBox)gvsanpham.FooterRow.FindControl("txttacgia")).Text; string nxb = ((TextBox)gvsanpham.FooterRow.FindControl("txtnxb")).Text; DateTime ngay_xuat_ban = DateTime.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtngayxuatban")).Text); int so_trang = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtsotrang")).Text); int danh_muc = int.Parse(((TextBox)gvsanpham.FooterRow.FindControl("txtdanhmuc")).Text); int COUNT = new cls_trangchu().insert_sanpham(id_san_pham, ma_san_pham, ten_san_pham, ma_loai, mo_ta_chi_tiet, don_gia, dvt, tinh_trang, hinh, san_pham_moi , tac_gia, nxb, ngay_xuat_ban, so_trang, danh_muc); if (COUNT != 0) { GetALL(); lblerr.Text = ""; } else { lblerr.Text = "Lỗi rồi!"; } } else if (e.CommandName.Equals("Delete")) { } }