示例#1
0
        public static Dictionary <int, DatPhongDTO> LayCacDatPhongDangSapDuocDatVaDangDuocDat(int khoangThoiGian)
        {
            Dictionary <int, DatPhongDTO> res = new Dictionary <int, DatPhongDTO>();

            DataTable dt = DAL.DataProvider.ExecuseQuery("SELECT * FROM datphong WHERE MaTinhTrangDatPhong = '1'  AND ThoiGianDatPhong BETWEEN '" + DateTime.Now.AddMinutes(-ThamSoDAL.LayKhoangThoiGianToiThieuGiuaHaiLanThue()).ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + DateTime.Now.AddMinutes(khoangThoiGian).ToString("yyyy-MM-dd HH:mm:ss.fff") + "';");

            foreach (DataRow row in dt.Rows)
            {
                res.Add((int)row["MaDatPhong"], new DatPhongDTO((int)row["MaDatPhong"], DateTime.Parse(row["ThoiGianDatPhong"].ToString()), (double)row["SoTienDatTruoc"], (int)row["MaNhanVien"], (int)row["MaKH"], row["GhiChu"].ToString(), (int)row["MaTinhTrangDatPhong"], DateTime.Parse(row["NgayLapPhieuDat"].ToString())));
            }

            return(res);
        }
示例#2
0
        public static Dictionary <int, ChiTietDatPhongDTO> LayCacChiTietDatPhongDangSapDuocDatVaDangDuocDat(int khoangThoiGian)
        {
            Dictionary <int, ChiTietDatPhongDTO> res = new Dictionary <int, ChiTietDatPhongDTO>();

            DataTable dt = DAL.DataProvider.ExecuseQuery("SELECT * FROM datphong, chitietdatphong WHERE datphong.MaDatPhong = chitietdatphong.MaDatPhong AND MaTinhTrangDatPhong = '1'  AND ThoiGianDatPhong BETWEEN '" + DateTime.Now.AddMinutes(-ThamSoDAL.LayKhoangThoiGianToiThieuGiuaHaiLanThue()).ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + DateTime.Now.AddMinutes(khoangThoiGian).ToString("yyyy-MM-dd HH:mm:ss.fff") + "';");

            foreach (DataRow row in dt.Rows)
            {
                res.Add((int)row["MaChiTietDatPhong"], new ChiTietDatPhongDTO((int)row["MaChiTietDatPhong"], (int)row["MaPhong"], (int)row["MaDatPhong"]));
            }

            return(res);
        }
示例#3
0
        public static DatPhongDTO LayThongTinThuePhongCuaPhongDangDat(int maPhong, DateTime now)
        {
            DataTable dt = DAL.DataProvider.ExecuseQuery("SELECT * FROM datphong, chitietdatphong WHERE datphong.MaDatPhong = chitietdatphong.MaDatPhong AND MaPhong = '" + maPhong + "' AND MaTinhTrangDatPhong = '1'  AND ThoiGianDatPhong BETWEEN '" + now.AddMinutes(-ThamSoDAL.LayKhoangThoiGianToiThieuGiuaHaiLanThue()).ToString("yyyy-MM-dd HH:mm:ss.fff") + "' AND '" + now.AddMinutes(ThamSoDAL.LayKhoangThoiGianToiThieuGiuaHaiLanThue()).ToString("yyyy-MM-dd HH:mm:ss.fff") + "';");

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(new DatPhongDTO((int)dt.Rows[0]["MaDatPhong"], DateTime.Parse(dt.Rows[0]["ThoiGianDatPhong"].ToString()), (double)dt.Rows[0]["SoTienDatTruoc"], (int)dt.Rows[0]["MaNhanVien"], (int)dt.Rows[0]["MaKH"], dt.Rows[0]["GhiChu"].ToString(), (int)dt.Rows[0]["MaTinhTrangDatPhong"], DateTime.Parse(dt.Rows[0]["NgayLapPhieuDat"].ToString())));
            }
        }