예제 #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);
        }
예제 #2
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));
        }