Ejemplo n.º 1
0
        public Boolean ThanhToan(string maKH, string maPhong, string ngayNhan)
        {
            string    sql = "UPDATE DatPhong SET TinhTrang = 1 WHERE MaKH = N'" + maKH + "' AND MaPhong = '" + maPhong + "' AND NgayNhan = '" + ngayNhan + "'";
            ExecuteDB exc = new ExecuteDB();

            exc.ExecuteData(sql);
            sql = "UPDATE Phong SET TrangThai = 0 WHERE IDPhong = '" + maPhong + "'";
            exc.ExecuteData(sql);

            return(true);
        }
Ejemplo n.º 2
0
        public Boolean GetDataDP_khongLP(string maPhong, DateTime start, DateTime finish)
        {
            ExecuteDB e   = new ExecuteDB();
            string    sql = "SELECT COUNT(*) FROM DatPhong WHERE MaPhong = N'" + maPhong
                            + "' AND(NgayNhan >= '" + finish.ToString("yyyy-MM-dd") + "' OR NgayTra <= '" + start.ToString("yyyy-MM-dd") + "')";
            int status = (int)e.ExecuteScalar(sql);

            if (status != 0)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public Boolean GetDataDP_coLP(string maPhong, DateTime start, DateTime finish, string tenLP)
        {
            ExecuteDB e   = new ExecuteDB();
            string    sql = "SELECT COUNT(*) FROM DatPhong WHERE MaPhong = N'" + maPhong
                            + "' AND(NgayNhan >= '" + finish.ToString("yyyy-MM-dd") + "' OR NgayTra <= '" + start.ToString("yyyy-MM-dd")
                            + "') AND MaPhong IN (SELECT MaPhong FROM Phong WHERE MaLP IN (SELECT IDLoaiPhong FROM LoaiPhong WHERE TenLP = N'" + tenLP + "'))";
            int status = (int)e.ExecuteScalar(sql);

            if (status != 0)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public Boolean ThemDP(DatPhong_DTO dp)
        {
            ExecuteDB e   = new ExecuteDB();
            string    sql = "SELECT COUNT(*) FROM DatPhong WHERE MaPhong = N'" + dp.MaPhong
                            + "' AND(NgayNhan >= '" + dp.NgayTra.ToString("yyyy-MM-dd") + "' OR NgayTra <= '" + dp.NgayNhan.ToString("yyyy-MM-dd") + "')";
            int status = (int)e.ExecuteScalar(sql);

            if (status != 0)
            {
                return(false);
            }
            sql = "INSERT INTO DatPhong VALUES(N'" + dp.IDDatPhong + "', N'" + dp.MaKH + " ', N'" + dp.MaNV + "', N'" + dp.MaPhong
                  + "', '" + dp.NgayDat.ToString("yyyy-MM-dd") + "', '" + dp.NgayNhan.ToString("yyyy-MM-dd") + "', '" + dp.NgayTra.ToString("yyyy-MM-dd")
                  + "', '" + dp.ThanhTien + "', '" + dp.TraTruoc + "', N'" + dp.GhiChu + "', 1)";
            return(e.ExecuteData(sql));
        }