public void loaddata() { try { string nd = Session["TimKiemSP"].ToString(); string sql = "select LOAISANPHAM.TenLoaiSP, SANPHAM.TenSP, SANPHAM.HinhAnh, SANPHAM.TienSP, SANPHAM.MaSP, LOAISANPHAM.MaLoaiSP,dbo.ufn_removeMark(TenSP) as tensp_khongdau FROM LOAISANPHAM INNER JOIN SANPHAM ON LOAISANPHAM.MaLoaiSP = SANPHAM.MaLoaiSP where dbo.ufn_removeMark(tensp) like N'%" + nd + "%' or sanpham.tensp like N'%" + nd + "%'"; DataTable dt = XLDL.GetData(sql); string tenspcd = dt.Rows[0]["TenSP"].ToString(); if (dt.Rows.Count > 0) { lbThongBao.Text = "<p style='font-weight:bold;padding:10px'>Kết quả tìm kiếm: " + nd + "</p>"; themdiv.DataSource = XLDL.GetData(sql); themdiv.DataBind(); } else { lbThongBao.Text = "<p style='font-weight:bold;padding:10px'>Kết quả tìm kiếm: " + nd + "</p><br>Không tìm thấy sản phẩm."; } } catch { lbThongBao.Text = "<p style='font-weight:bold;padding:10px'>Kết quả tìm kiếm:</p><br>Không tìm thấy sản phẩm."; } }
protected void btnDN_Click(object sender, EventArgs e) { try { DataTable dt = XLDL.GetData("SELECT [MaTK], [TenTK], [TenDN], [MatKhau], [LoaiTK] FROM [TaiKhoan] where TenDN='" + tbTK.Text + "' and MatKhau='" + tbMK.Text + "'"); if (dt.Rows.Count > 0) { int LTK = int.Parse(dt.Rows[0]["LoaiTK"].ToString()); if (LTK == 1) { Session["TenDNAdmin"] = tbTK.Text; Response.Redirect("~/QuanTri.aspx"); } else if (LTK == 2) { Session["TenDN"] = tbTK.Text; Session["MaTK"] = dt.Rows[0]["MaTK"]; Response.Redirect("Default.aspx"); } } else { lbThongBao.Text = "Tên đăng nhập hoặc mật khẩu khoặc chính xác!!!"; } } catch { lbThongBao.Text = "Thất Bại"; } }
private void loaddata() { if (Request.QueryString["MaBlog"] != null) { string MaBlog = Request.QueryString["MaBlog"].ToString(); string sql = "SELECT [MaBlog], [HinhAnh], [TieuDe], [TTND], [NoiDung], [SoLanXem], [NgayDang], [MaTK] FROM [Blog] Where MaBlog=" + MaBlog; DataTable dt = XLDL.GetData(sql); tbMaBlog.Text = dt.Rows[0]["MaBlog"].ToString(); tbTieuDe.Text = dt.Rows[0]["TieuDe"].ToString(); lbnd.Visible = true; string nd = dt.Rows[0]["NoiDung"].ToString(); lbnd.Text = nd; tbNguoiDang.Text = dt.Rows[0]["MaTK"].ToString(); tbSoLanXem.Text = dt.Rows[0]["SoLanXem"].ToString(); string filename = dt.Rows[0]["HinhAnh"].ToString(); tbTTND.Text = dt.Rows[0]["TTND"].ToString(); string matk = dt.Rows[0]["MaTK"].ToString(); } }
public void loaddata() { string sql = "SELECT [HinhAnh], [TieuDe], [TTND], [NgayDang], [NguoiDang], [MaBlog], [NoiDung] FROM [BLOG]"; DataList2.DataSource = XLDL.GetData(sql); DataList2.DataBind(); }
protected void btnDN_Click(object sender, EventArgs e) { try { string ktr = @"select 1 from taikhoan where tendn=N'" + tbTK.Text + "'"; if (XLDL.GetData(ktr).Rows.Count > 0) { lbThongBao.Text = "Tên tài khoản đã tồn tại!!!"; tbTK.Focus(); } else { string tentk = tbTenTK.Text; string email = tbEmail.Text; string dc = tbDiaChi.Text; string sdt = tbSDT.Text; string tendn = tbTK.Text; string mk = tbMK.Text; string sql = "insert into Taikhoan values (N'" + tentk + "','" + email + "',N'" + dc + "','" + sdt + "','" + tendn + "','" + mk + "',2)"; XLDL.Excute(sql); Response.Redirect("DangNhap.aspx"); } } catch { lbThongBao.Text = "Thất bại"; } }
protected void btnLuu_Click(object sender, EventArgs e) { string mblog = Request.QueryString["MaBlog"].ToString(); DateTime datetime = DateTime.Now; string ngaycapnhat = datetime.ToString("MM/dd/yyyy"); string tieude = tbTieuDe.Text; string nd = tbND.Text; string ngdang = tbNguoiDang.Text; int slx = int.Parse(tbSoLanXem.Text); string savePath = MapPath("~/Anh/Blog/"); if (FileUpload1.HasFile) { savePath += FileUpload1.FileName; FileUpload1.SaveAs(savePath); lbThongBao.Text = "Upload ảnh thành công."; } else { lbThongBao.Text = "Ảnh chưa được upload."; } string ha = FileUpload1.FileName; string tbnd = tbTTND.Text; string sql = "update Blog set hinhanh=N'" + ha + "',Tieude=N'" + tieude + "',TTND=N'" + tbnd + "',NoiDung=N'" + nd + "',SoLanXem=" + slx + ",NgayDang='" + ngaycapnhat + "',NguoiDang=N'" + ngdang + "' where MaBlog=" + mblog; XLDL.Excute(sql); Response.Redirect("DanhSachBlog.Aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["TenDN"] == null) { Response.Write("<script>alert('Bạn chưa đăng nhập');</script>"); Server.Transfer("Default.aspx", true); } else { string matk = Session["MaTk"].ToString(); string ktra = Request.QueryString["MaDH"]; string sql1 = "sELECT matk FROM DonHang where EXISTS( select matk from taikhoan where DonHang.matk = taikhoan.matk and donhang.madh= " + ktra + "); "; DataTable dt = XLDL.GetData(sql1); if (dt.Rows[0]["matk"].ToString() == matk) { loaddata(); } else { Response.Redirect("QuanLiThongTin.aspx"); } } }
protected void Button1_Click(object sender, EventArgs e) { if (Session["TenDN"] == null) { lbThongBao.Text = "Vui lòng đăng nhập trước khi bình luận!!!"; } else { string nd = HttpUtility.HtmlEncode(Request.Form["tbND"]); if (nd == "") { lbThongBao.Text = "Chưa nhập nội dung!!!"; } else { string tendn = Session["TenDN"].ToString(); string sql = "SELECT [MaTK], [TenDN] FROM [TaiKhoan] where TenDN=N'" + tendn + "'"; DataTable dt = XLDL.GetData(sql); string matk = dt.Rows[0]["MaTK"].ToString(); string mablog = Request.QueryString["MaSP"].ToString(); DateTime dateTime = DateTime.Now; string ngay = dateTime.ToString("dd/MM/yyyy HH:mm:ss"); string sql1 = "Insert into BinhLuanSP values (" + mablog + "," + matk + ",'" + ngay + "',N'" + nd + "')"; XLDL.Excute(sql1); Response.Redirect("~/ChiTietSanPham.aspx?MaSP=" + mablog); } } }
public void loaddata() { string sql = "SELECT BLOG.MaBlog, BLOG.HinhAnh, BLOG.TieuDe, BLOG.TTND, BLOG.NgayDang, TaiKhoan.TenTK FROM BLOG INNER JOIN TaiKhoan ON BLOG.MaTK = TaiKhoan.MaTK"; DataList2.DataSource = XLDL.GetData(sql); DataList2.DataBind(); }
protected void btnLuu_Click(object sender, EventArgs e) { try { string MaBlog = Request.QueryString["Ma"].ToString(); string tendn = tbDN.Text; string tentk = tbTenKH.Text; string dc = tbDiaChi.Text; string sdt = tbSDT.Text; string email = tbEmail.Text; string mk = tbMK.Text; string sql = "update TaiKhoan set tendn='" + tendn + "',tentk=N'" + tentk + "',DiaChi=N'" + dc + "',sdt='" + sdt + "',email='" + email + "',matkhau='" + mk + "' where MaTK=" + MaBlog; XLDL.Excute(sql); Response.Redirect("QuanTriTaiKhoan.Aspx"); } catch { Response.Redirect("QuanTriTaiKhoan.Aspx"); } }
protected void btnLuu_Click(object sender, EventArgs e) { try { string MaBlog = Session["MaTK"].ToString(); string mkc = tbMK.Text; string mkm = tbMKM.Text; string str = @"Select Matkhau from taikhoan where matk=" + MaBlog; if (XLDL.GetData(str).Rows[0]["MatKhau"].ToString() == mkc) { string sql = "update TaiKhoan set matkhau='" + mkm + "' where MaTK=" + MaBlog; XLDL.Excute(sql); Response.Redirect("DoiMatKhau.Aspx"); } else { lbThongBao.Text = "Mật khẩu cũ không chính xác."; } } catch { Response.Redirect("Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { string sql = "Select MaSP,TenSP,TienSP,NgayCapNhat,SoLuongBan,SoLanXem from sanpham"; DataTable dt = XLDL.GetData(sql); gvSP.DataSource = dt; gvSP.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string sql = "Select MaTK,TenTK,Email,DiaChi,SDT,TenDN,MatKhau from TaiKhoan where LoaiTK=2"; DataTable dt = XLDL.GetData(sql); gvSP.DataSource = dt; gvSP.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string sql = "select MaBlog,TieuDe,TTND,NoiDung,NgayDang,SoLanXem,NguoiDang from BLOG"; DataTable dt = XLDL.GetData(sql); gvBlog.DataSource = dt; gvBlog.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string sql = "select MaDH,MaTK,NgayLapDH,TenKH,DiaChi,SDT,PTTT,ThanhTien from DonHang"; DataTable dt = XLDL.GetData(sql); gvBlog.DataSource = dt; gvBlog.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string sql = "SELECT BLOG.MaBlog, BLOG.HinhAnh, BLOG.TieuDe, BLOG.TTND, BLOG.NoiDung, BLOG.SoLanXem, BLOG.NgayDang, TaiKhoan.TenTK FROM BLOG INNER JOIN TaiKhoan ON BLOG.MaTK = TaiKhoan.MaTK"; DataTable dt = XLDL.GetData(sql); gvBlog.DataSource = dt; gvBlog.DataBind(); }
public void loaddata() { string matk = Session["MaTK"].ToString(); string sql = "SELECT [MaTK], [TenTK], [Email], [DiaChi], [SDT] FROM [TaiKhoan] where MaTK=" + matk; DataTable dt = XLDL.GetData(sql); txtTenNguoiNhan.Text = dt.Rows[0]["TenTK"].ToString(); txtDienThoaiNhan.Text = dt.Rows[0]["SDT"].ToString(); txtDiaChiNhan.Text = dt.Rows[0]["DiaChi"].ToString(); }
public void loaddata() { string sql = "SELECT LOAISANPHAM.TenLoaiSP, SANPHAM.TenSP, SANPHAM.HinhAnh, SANPHAM.TienSP, SANPHAM.MaSP, LOAISANPHAM.MaLoaiSP FROM LOAISANPHAM INNER JOIN SANPHAM ON LOAISANPHAM.MaLoaiSP = SANPHAM.MaLoaiSP order by Sanpham.MaSP asc"; DataList3.DataSource = XLDL.GetData(sql); DataList3.DataBind(); string sql1 = "SELECT TOP (4) LOAISANPHAM.TenLoaiSP, SANPHAM.TenSP, SANPHAM.HinhAnh, SANPHAM.TienSP, SANPHAM.MaSP, LOAISANPHAM.MaLoaiSP, SANPHAM.SoLuongBan FROM LOAISANPHAM INNER JOIN SANPHAM ON LOAISANPHAM.MaLoaiSP = SANPHAM.MaLoaiSP ORDER BY SANPHAM.SoLuongBan desc"; DataList2.DataSource = XLDL.GetData(sql1); DataList2.DataBind(); }
public void loaddata() { try { string masp = Request.QueryString["MaSP"].ToString(); string sql = "SELECT SANPHAM.MaSP, SANPHAM.MaLoaiSP, SANPHAM.TenSP, SANPHAM.SoLuongSP, SANPHAM.HinhAnh, SANPHAM.NhaCC, SANPHAM.TienSP, SANPHAM.Mota, LOAISANPHAM.TenLoaiSP FROM SANPHAM INNER JOIN LOAISANPHAM ON SANPHAM.MaLoaiSP = LOAISANPHAM.MaLoaiSP WHERE SANPHAM.MaSP = " + masp; DataList7.DataSource = XLDL.GetData(sql); DataList7.DataBind(); } catch { } }
public void loaddata() { try { string mablog = Request.QueryString["MaBlog"].ToString(); string sql = "SELECT [MaBlog], [HinhAnh], [TieuDe], [NoiDung], [NgayDang], [MaTK] FROM [BLOG] Where MaBlog=" + mablog; DataList5.DataSource = XLDL.GetData(sql); DataList5.DataBind(); } catch { } }
public void loaddata() { string sql = "SELECT [MaLoaiSP],[TenLoaiSP] FROM[LOAISANPHAM]"; Danhmuc.DataSource = XLDL.GetData(sql); Danhmuc.DataBind(); DataList1.DataSource = XLDL.GetData(sql); DataList1.DataBind(); string sql1 = "SELECT top(2) [MaBlog], [HinhAnh], [NgayDang],[TieuDe], [TTND] FROM [BLOG] order by [NgayDang] desc"; DataList2.DataSource = XLDL.GetData(sql1); DataList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["TenDN"] == null) { Response.Write("<script>alert('Bạn chưa đăng nhập');</script>"); Server.Transfer("Default.aspx", true); } else { string matk = Session["MaTK"].ToString(); string sql = "SELECT BLOG.MaBlog, BLOG.HinhAnh, BLOG.TieuDe, BLOG.TTND, BLOG.NoiDung, BLOG.SoLanXem, BLOG.NgayDang, TaiKhoan.TenTK FROM BLOG INNER JOIN TaiKhoan ON BLOG.MaTK = TaiKhoan.MaTK where taikhoan.matk=" + matk; DataTable dt = XLDL.GetData(sql); gvBlog.DataSource = dt; gvBlog.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = XLDL.GetData("Select MaLoaiSP,TenLoaiSP from LOAISANPHAM"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { rdLSP.Items.Add("i"); rdLSP.Items[i].Text = dt.Rows[i][1].ToString(); rdLSP.Items[i].Value = dt.Rows[i][0].ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["TenDN"] == null) { Response.Write("<script>alert('Bạn chưa đăng nhập');</script>"); Server.Transfer("Default.aspx", true); } else { string matk = Session["MaTK"].ToString(); string sql = "select MaDH,MaTK,NgayLapDH,TenKH,DiaChi,SDT,PTTT,ThanhTien from DonHang where MaTK=' " + matk + "'"; DataTable dt = XLDL.GetData(sql); gvBlog.DataSource = dt; gvBlog.DataBind(); } }
private void loaddata() { if (Session["MaTK"].ToString() != null) { string MaBlog = Session["MaTK"].ToString(); string sql = "Select MaTK, TenTK, Email, DiaChi, SDT, TenDN, MatKhau from TaiKhoan Where MaTK=" + MaBlog; DataTable dt = XLDL.GetData(sql); tbMaTK.Text = dt.Rows[0]["MaTK"].ToString(); tbTenKH.Text = dt.Rows[0]["TenTK"].ToString(); tbDiaChi.Text = dt.Rows[0]["DiaCHi"].ToString(); tbSDT.Text = dt.Rows[0]["SDT"].ToString(); tbEmail.Text = dt.Rows[0]["Email"].ToString(); } }
private void loaddata() { if (Request.QueryString["MaDH"] != null) { string MaBlog = Request.QueryString["MaDH"].ToString(); string sql = "select MaDH,NgayLapDH,TenKH,DiaChi,SDT,PTTT,ThanhTien from DonHang Where MaDH=" + MaBlog; DataTable dt = XLDL.GetData(sql); string sql1 = "SELECT SANPHAM.MaSP, SANPHAM.TenSP, SANPHAM.TienSP, ChiTietDonHang.SL, ChiTietDonHang.MaDH , SANPHAM.TienSP* ChiTietDonHang.SL AS ThanhTien FROM SANPHAM INNER JOIN ChiTietDonHang ON SANPHAM.MaSP = ChiTietDonHang.MaSP WHERE ChiTietDonHang.MaDH = " + MaBlog; DataTable dt1 = XLDL.GetData(sql1); gvGioHang.DataSource = dt1; gvGioHang.DataBind(); } }
public void loaddata() { try { string maloai = Request.QueryString["MaLoaiSP"].ToString(); string sql = "SELECT LOAISANPHAM.TenLoaiSP, SANPHAM.TenSP, SANPHAM.HinhAnh, SANPHAM.TienSP, SANPHAM.MaSP, LOAISANPHAM.MaLoaiSP FROM LOAISANPHAM INNER JOIN SANPHAM ON LOAISANPHAM.MaLoaiSP = SANPHAM.MaLoaiSP where sanpham.maloaisp=" + maloai + " order by Sanpham.MaSP asc"; DataList3.DataSource = XLDL.GetData(sql); DataList3.DataBind(); string sql1 = "select TenLoaiSP from loaisanpham where MaLoaiSP=" + maloai; DataList4.DataSource = XLDL.GetData(sql1); DataList4.DataBind(); } catch { } }
protected void Button1_Click(object sender, EventArgs e) { if (tbTenNgBL.Text == "" || tbNoiDung.Text == "") { lbThongBao.Text = "Bạn chưa nhập tên hoặc nội dung!!!"; } else { string mablog = Request.QueryString["MaBlog"].ToString(); string ten = tbTenNgBL.Text; string nd = tbNoiDung.Text; DateTime dateTime = DateTime.Now; string ngay = dateTime.ToString("dd/MM/yyyy HH:mm:ss"); string sql1 = "Insert into BinhLuanBLog values (" + mablog + ",N'" + ten + "','" + ngay + "',N'" + nd + "')"; XLDL.Excute(sql1); Response.Redirect("ChiTietTinTuc.aspx?MaBlog=" + mablog); } }
protected void btnLuu_Click(object sender, EventArgs e) { string MaBlog = Request.QueryString["MaDH"].ToString(); string ngay = DateTime.Now.ToString("MM/dd/yyyy"); string ten = tbTenKH.Text; string dc = tbDiaChi.Text; string sdt = tbSDT.Text; string pttt = tbPTTT.Text; int tt = int.Parse(tbThanhTien.Text); string sql = "update DonHang set NgayLapDH='" + ngay + "',TenKH=N'" + ten + "',DiaChi=N'" + dc + "',SDT='" + sdt + "',PTTT=N'" + pttt + "',ThanhTien=" + tt + " where MaDH=" + MaBlog; XLDL.Excute(sql); Response.Redirect("DonHang.Aspx"); }
protected void btnLuu_Click(object sender, EventArgs e) { try { string mblog = Request.QueryString["MaBlog"].ToString(); DateTime datetime = DateTime.Now; string ngaycapnhat = datetime.ToString("MM/dd/yyyy hh:mm:ss"); string tieude = tbTieuDe.Text; string nd = HttpUtility.HtmlEncode(Request.Form["tbND"]); string ngdang = tbNguoiDang.Text; int slx = int.Parse(tbSoLanXem.Text); string savePath = MapPath("~/Anh/Blog/"); if (FileUpload1.HasFile) { savePath += FileUpload1.FileName; FileUpload1.SaveAs(savePath); lbThongBao.Text = "Upload ảnh thành công."; } else { lbThongBao.Text = "Ảnh chưa được upload."; } string ha = FileUpload1.FileName; string tbnd = tbTTND.Text; string matk = Session["MaTK"].ToString(); string sql = "update Blog set hinhanh=N'" + ha + "',Tieude=N'" + tieude + "',TTND=N'" + tbnd + "',NoiDung=N'" + nd + "',SoLanXem=" + slx + ",NgayDang='" + ngaycapnhat + "',MaTK=" + matk + " where MaBlog=" + mblog; XLDL.Excute(sql); Response.Redirect("Quanlibaiviet.Aspx"); } catch { Response.Write("<script>alert('Sửa Thất Bại !!!');</script>"); } }