Exemplo n.º 1
0
        public int DatPhong(DTO_HoaDon thongtin)
        {
            int    result = -1;
            string sql    = "INSERT INTO HoaDon VALUES(@TenDichVu,@SoLuong,@ThanhTien,@MaHD,@STT,@MaChiNhanh,@MaPhong,@SDT,@NgayDat,@NgayTra,@MaDV,@DapUng,@DatCoc,@ThoiGianThucHienHoaDon)";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@TenDichVu", thongtin.TenDichVu),
                new SqlParameter("@SoLuong", thongtin.SoLuong),
                new SqlParameter("@ThanhTien", thongtin.ThanhTien),
                new SqlParameter("@MaHD", thongtin.MaHD),
                new SqlParameter("@STT", thongtin.STT),
                new SqlParameter("@MaChiNhanh", thongtin.MaChiNhanh),
                new SqlParameter("@MaPhong", thongtin.MaPhong),
                new SqlParameter("@SDT", thongtin.SoDienThoai),
                new SqlParameter("@NgayDat", thongtin.NgayDatPhong),
                new SqlParameter("@NgayTra", thongtin.NgayTraPhong),
                new SqlParameter("@MaDV", thongtin.MaDV),
                new SqlParameter("@DapUng", thongtin.DapUng),
                new SqlParameter("@DatCoc", thongtin.DatCoc),
                new SqlParameter("ThoiGianThucHienHoaDon", thongtin.ThoiGianThucHienHoaDon),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 2
0
        public DataSet HienThiYeuCau(DTO_HoaDon dto)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE MaChiNhanh = @MaChiNhanh AND DapUng = 'No'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaChiNhanh", dto.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 3
0
        public int SetHoaDon(DTO_HoaDon dto)
        {
            int    result = -1;
            string sql    = "UPDATE HoaDon SET DapUng = 'Done' WHERE MaHD = @MaHD";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", dto.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 4
0
        public DataSet HienThiPhongChuaDatCoc(DTO_HoaDon hoadon)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE MaChiNhanh =@MaChiNhanh AND DatCoc ='No' AND TenDichVu LIKE 'Thuê Phòng%'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaChiNhanh", hoadon.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 5
0
        public int DatCoc(DTO_HoaDon hoadon)
        {
            int    result = -1;
            string sql    = "UPDATE HoaDon SET DatCoc = 'Yes' WHERE MaHD =@MaHD";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", hoadon.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 6
0
        public DataSet TongTien(DTO_HoaDon hoadon)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT ThanhTien FROM HoaDon WHERE SoDienThoai = @SDT AND DapUng != 'Done' AND DatCoc = 'Yes'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@SDT", hoadon.SoDienThoai),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 7
0
        public int HuyHoaDon(DTO_HoaDon hoadon)
        {
            int    result = -1;
            string sql    = "DELETE FROM HoaDon WHERE MaHD =@MaHD ";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", hoadon.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 8
0
        public DataSet KiemTraMaHD(DTO_HoaDon hoadon)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT TOP 1 (MaHD) FROM HoaDon WHERE MaHD LIKE @MaHD + '%' ORDER BY MaHD DESC ";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", hoadon.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 9
0
        public DataSet showall(DTO_HoaDon phong)
        {
            DataSet result;
            string  sql = "SELECT * FROM Phong WHERE  MaChiNhanh LIKE @MaChiNhanh +'%'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaChiNhanh", phong.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 10
0
        public DataSet DSPhong(DTO_HoaDon phong)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE SoDienThoai =@SDT AND DatCoc ='Yes' AND DapUng != 'Done' AND TenDichVu LIKE 'Thuê Phòng%'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@SDT", phong.SoDienThoai),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 11
0
        public DataSet HienThiDSPhongDaDatCuaKhachHang(DTO_HoaDon phong)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE MaChiNhanh = @MaChiNhanh AND DapUng != 'Done' AND DatCoc ='Yes' AND TenDichVu LIKE 'Thuê Phòng%' ";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaChiNhanh", phong.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 12
0
        public DataSet HienThi(DTO_HoaDon hoadon)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE MaHD = @MaHD ";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", hoadon.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 13
0
        public int TichLuyDiem(DTO_HoaDon hoadon)
        {
            int    result = -1;
            string sql    = "UPDATE KhachHang SET TichLuy = @Tong WHERE SoDienThoai = @SDT";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@Tong", hoadon.ThanhTien / 1000),
                new SqlParameter("@SDT", hoadon.SoDienThoai),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 14
0
        public DataSet KiemTraNgayPhongDangDuocSuDung(DTO_HoaDon dto)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM HoaDon WHERE MaPhong = @MaPhong AND MaChiNhanh = @MaChiNhanh AND TenDichVu LIKE 'Thuê Phòng%' AND DapUng != 'Done'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaPhong", dto.MaPhong),
                new SqlParameter("@MaChiNhanh", dto.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 15
0
        public DataSet ChonPhong(DTO_HoaDon dto)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT * FROM Phong WHERE LoaiPhong = @LoaiPhong AND SoNguoi = @SoNguoi AND MaChiNhanh LIKE @MaChiNhanh +'%'";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@LoaiPhong", dto.LoaiPhong),
                new SqlParameter("@MaChiNhanh", dto.MaChiNhanh),
                new SqlParameter("@SoNguoi", dto.SoNguoi),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 16
0
        public DataSet LayMaHD(DTO_HoaDon hoadon)
        {
            DataSet result = new DataSet();
            string  sql    = "SELECT MaHD FROM HoaDon WHERE SoDienThoai = @SDT AND MaPhong = @MaPhong AND MaChiNhanh = @MaChiNhanh AND DapUng != 'Done' ";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@SDT", hoadon.SoDienThoai),
                new SqlParameter("@MaPhong", hoadon.MaPhong),
                new SqlParameter("@MaChiNhanh", hoadon.MaChiNhanh),
            };
            DataAccess data = new DataAccess();

            result = data.getdataset(sql, para);
            return(result);
        }
Exemplo n.º 17
0
        public int ThucHienYeuCau(DTO_HoaDon dto)
        {
            int    result = -1;
            string sql    = "UPDATE HoaDon SET DapUng = 'Yes' WHERE MaHD = @MaHD AND MaPhong = @MaPhong AND MaChiNhanh = @MaChiNhanh AND STT = @STT";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaPhong", dto.MaPhong),
                new SqlParameter("@MaChiNhanh", dto.MaChiNhanh),
                new SqlParameter("@STT", dto.STT),
                new SqlParameter("@MaHD", dto.MaHD),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }
Exemplo n.º 18
0
        public int XoaYeuCau(DTO_HoaDon hoadon)
        {
            int    result = -1;
            string sql    = "DELETE FROM HoaDon WHERE MaHD = @MaHD AND MaPhong = @MaPhong AND MaChiNhanh = @MaChiNhanh AND STT = @STT";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaHD", hoadon.MaHD),
                new SqlParameter("@MaChiNhanh", hoadon.MaChiNhanh),
                new SqlParameter("@MaPhong", hoadon.MaPhong),
                new SqlParameter("@STT", hoadon.STT),
            };
            DataAccess data = new DataAccess();

            result = data.Execute(sql, para);
            return(result);
        }