public List <Tin> LayMaTin(string MaTin) { string sql = "select * from Tin where MaTin='" + MaTin + "'"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <Tin> ds = new List <Tin>(); foreach (DataRow dr in dt.Rows) { Tin t = new Tin(); t.MaTin = dr[0].ToString(); t.TieuDe = dr[1].ToString(); t.TomTat = dr[2].ToString(); t.NgayDang = dr[3].ToString(); t.NoiDung = dr[4].ToString(); t.HinhAnh = dr[5].ToString(); t.SoLanXem = dr[6].ToString(); t.TrangThai = dr[7].ToString(); t.MaLoaiTin = dr[8].ToString(); ds.Add(t); } this.DanhSachTin = ds; return(ds); }
public List <NguoiDung1> AllNguoiDung() { string sql = "select * from NguoiDung"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <NguoiDung1> ds = new List <NguoiDung1>(); foreach (DataRow dr in dt.Rows) { NguoiDung1 nd = new NguoiDung1(); nd.MaNguoiDung = dr[0].ToString(); nd.HoTen = dr[1].ToString(); nd.TaiKhoan = dr[2].ToString(); nd.MatKhau = dr[3].ToString(); nd.DiaChi = dr[4].ToString(); nd.Email = dr[5].ToString(); nd.GioiTinh = dr[6].ToString(); nd.NgaySinh = dr[7].ToString(); nd.NgayDangKy = dr[8].ToString(); nd.VaiTro = int.Parse(dr[9].ToString()); ds.Add(nd); } this.DanhSachNguoiDung = ds; return(ds); }
public void SuaQuangCao(QuangCao qc) { string sql = "update QuangCao set TenQC=N'" + qc.TenQC + "',HinhAnh='" + qc.HinhAnh + "' where MaQC='" + qc.MaQC + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemQuangCao(QuangCao qc) { string sql = "insert into QuangCao values('" + qc.MaQC + "',N'" + qc.TenQC + "','" + qc.HinhAnh + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void XoaBinhLuan(string MaBinhLuan) { string sql = "delete BinhLuan where MaBinhLuan='" + MaBinhLuan + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void SuaBinhLuan(BinhLuan bl) { string sql = "update BinhLuan set NoiDung=N'" + bl.NoiDung + "',Ngay='" + bl.Ngay + "',MaTin='" + bl.MaTin + "',MaNguoiDung='" + bl.MaNguoiDung + "' where MaBinhLuan='" + bl.MaBinhLuan + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemBinhLuan(BinhLuan bl) { string sql = "insert into BinhLuan values('" + bl.MaBinhLuan + "',N'" + bl.NoiDung + "','" + bl.Ngay + "','" + bl.MaTin + "','" + bl.MaNguoiDung + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void XoaTheLoai(string MaTheLoai) { string sql = "delete TheLoai where MaTheLoai='" + MaTheLoai + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void XoaQuangCao(string MaQC) { string sql = "delete QuangCao where MaQuangCao='" + MaQC + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemTin(Tin t) { string sql = "insert into Tin values('" + t.MaTin + "',N'" + t.TieuDe + "',N'" + t.TomTat + "','" + t.NgayDang + "',N'" + t.NoiDung + "','" + t.HinhAnh + "','" + t.SoLanXem + "','" + t.TrangThai + "','" + t.MaLoaiTin + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemTheLoai(TheLoai tl) { string sql = "insert into TheLoai values('" + tl.MaTheLoai + "',N'" + tl.TenTheLoai + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void XoaLoaiTin(string MaLoaiTin) { string sql = "delete LoaiTin where MaLoaiTin='" + MaLoaiTin + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemLoaiTin(LoaiTin lt) { string sql = "insert into LoaiTin values('" + lt.MaLoaiTin + "',N'" + lt.TenLoaiTin + "','" + lt.MaTheLoai + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void SuaLoaiTin(LoaiTin lt) { string sql = "update LoaiTin set TenLoaiTin=N'" + lt.TenLoaiTin + "',MaTheLoai='" + lt.MaTheLoai + "' where MaLoaiTin='" + lt.MaLoaiTin + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void XoaNguoiDung(string MaNguoiDung) { string sql = "delete NguoiDung where MaNguoiDung='" + MaNguoiDung + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void ThemNguoiDung(NguoiDung1 nd) { string sql = "insert into NguoiDung values(N'" + nd.HoTen + "','" + nd.TaiKhoan + "','" + nd.MatKhau + "',N'" + nd.DiaChi + "',N'" + nd.Email + "','" + nd.GioiTinh + "','" + nd.NgaySinh + "','" + nd.NgayDangKy + "','" + nd.VaiTro + "')"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void SuaNguoiDung(NguoiDung1 nd) { string sql = "update NguoiDung set HoTen=N'" + nd.HoTen + "','" + nd.TaiKhoan + "','" + nd.MatKhau + "',N'" + nd.DiaChi + "',N'" + nd.Email + "','" + nd.GioiTinh + "','" + nd.NgaySinh + "','" + nd.NgayDangKy + "' where MaNguoiDung='" + nd.MaNguoiDung + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void SuaTin(Tin t) { string sql = "update Tin set TieuDe=N'" + t.TieuDe + "',TomTat=N'" + t.TomTat + "',NgayDang='" + t.NgayDang + "',NoiDung=N'" + t.NoiDung + "',HinhAnh='" + t.HinhAnh + "',SoLanXem='" + t.SoLanXem + "',TrangThai='" + t.TrangThai + "',MaLoaiTin='" + t.MaLoaiTin + "' where MaTin='" + t.MaTin + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public void SuaTheLoai(TheLoai tl) { string sql = "update TheLoai set TenTheLoai=N'" + tl.TenTheLoai + "' where MaTheLoai='" + tl.MaTheLoai + "'"; db = new DBACCESS(); db.open(); db.ExcuteQuery(sql); db.close(); }
public int DangNhap(string taiKhoan, string matKhau) { string sql = "select * from NguoiDung Where TaiKhoan='" + taiKhoan + "' And MatKhau='" + matKhau + "'"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); if (dt.Rows.Count > 0) { return(int.Parse(dt.Rows[0][9].ToString())); } return(-1); }
public List <TheLoai> AllTheLoai() { string sql = "select * from TheLoai"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <TheLoai> ds = new List <TheLoai>(); foreach (DataRow dr in dt.Rows) { TheLoai tl = new TheLoai(); tl.MaTheLoai = dr[0].ToString(); tl.TenTheLoai = dr[1].ToString(); ds.Add(tl); } this.DanhSachTheLoai = ds; return(ds); }
public List <LoaiTin> AllLoaiTin() { string sql = "select * from LoaiTin"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <LoaiTin> ds = new List <LoaiTin>(); foreach (DataRow dr in dt.Rows) { LoaiTin lt = new LoaiTin(); lt.MaLoaiTin = dr[0].ToString(); lt.MaTheLoai = dr[1].ToString(); lt.TenLoaiTin = dr[2].ToString(); ds.Add(lt); } this.DanhSachLoaiTin = ds; return(ds); }
public List <QuangCao> AllQuangCao() { string sql = "select * from QuangCao"; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <QuangCao> ds = new List <QuangCao>(); foreach (DataRow dr in dt.Rows) { QuangCao qc = new QuangCao(); qc.MaQC = dr[0].ToString(); qc.MaQC = dr[1].ToString(); qc.HinhAnh = dr[2].ToString(); ds.Add(qc); } this.DanhSachLoaiTin = ds; return(ds); }
public List <BinhLuan> LaySoBinhLuanTheoTin(string MaTin) { string sql = "select * from BinhLuan where MaTin=" + MaTin + ""; db = new DBACCESS(); db.open(); DataTable dt = db.getTable(sql); db.close(); List <BinhLuan> ds = new List <BinhLuan>(); foreach (DataRow dr in dt.Rows) { BinhLuan bl = new BinhLuan(); bl.MaBinhLuan = dr[0].ToString(); bl.NoiDung = dr[1].ToString(); bl.Ngay = dr[2].ToString(); bl.MaTin = dr[3].ToString(); bl.MaNguoiDung = dr[4].ToString(); ds.Add(bl); } this.DanhSachBinhLuan = ds; return(ds); }