//Tìm khách thuê theo mã khách thuê public DataTable TimKhachThueTheoMa(KhachThue khachthue) { String sql = "select * from KHACH_THUE where MaKhach like N'%" + khachthue.getMaKhach() + "%'"; rs = manager.executeQuery(sql); return(rs); }
//thêm khách thuê có đặt phòng trước /*public bool ThemKhachThueDatPhong(KhachThue khachthue) * { * SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); * SqlParameter p2 = new SqlParameter("@tenkhach", khachthue.getTenKhach()); * SqlParameter p3 = new SqlParameter("@phai", khachthue.getPhai()); * SqlParameter p4 = new SqlParameter("@cmnd", khachthue.getCmnd()); * SqlParameter p5 = new SqlParameter("@quequan", khachthue.getQuequan()); * SqlParameter p6 = new SqlParameter("@nghenghiep", khachthue.getNgheNghiep()); * * * * SqlParameter[] giatri = { p1, p2, p3, p4, p5, p6 }; * * return data.Update("ThemKhachThueDatPhong", giatri); * }*/ //Xóa khách thuê public void XoaKhach(KhachThue khachthue) { SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); SqlParameter[] giatri = { p1 }; String delete = "delete from CT_KHACH_THUE where MaKhach = @makhach; delete from KHACH_THUE where MaKhach = @makhach"; manager.Delete(delete, giatri); }
//Sửa khách thuê public bool SuaKhachthue(KhachThue khachthue) { SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); SqlParameter p2 = new SqlParameter("@tenkhach", khachthue.getTenKhach()); SqlParameter p3 = new SqlParameter("@phai", khachthue.getPhai()); SqlParameter p4 = new SqlParameter("@cmnd", khachthue.getCmnd()); SqlParameter p5 = new SqlParameter("@quequan", khachthue.getQuequan()); SqlParameter p6 = new SqlParameter("@nghenghiep", khachthue.getNgheNghiep()); SqlParameter[] giatri = { p1, p2, p3, p4, p5, p6 }; return(manager.Update(@"dbo.[SuaKhachThue]", giatri)); }
//thêm khách thuê public void ThemKhachthue(KhachThue khachthue) { SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); SqlParameter p2 = new SqlParameter("@tenkhach", khachthue.getTenKhach()); SqlParameter p3 = new SqlParameter("@phai", khachthue.getPhai()); SqlParameter p4 = new SqlParameter("@cmnd", khachthue.getCmnd()); SqlParameter p5 = new SqlParameter("@quequan", khachthue.getQuequan()); SqlParameter p6 = new SqlParameter("@nghenghiep", khachthue.getNgheNghiep()); //String insert = "insert into KHACH_THUE values (@makhach, @tenkhach, @phai, @cmnd, @quequan, @nghenghiep)"; SqlParameter[] giatri = { p1, p2, p3, p4, p5, p6 }; manager.Update(@"dbo.[ThemKhachThue]", giatri); }