Exemplo n.º 1
0
        public static HOADONTHUEPHONG truyVanHoaDonDangThue(string phongID)
        {
            HOADONTHUEPHONG res = new HOADONTHUEPHONG();

            res = DataProvider.ISCreated.DB.Database.SqlQuery <HOADONTHUEPHONG>("SELECT * FROM HOADONTHUEPHONG  WHERE Phong = @id and ThoiGianTra IS NULL", new SqlParameter("@id", phongID)).FirstOrDefault();
            return(res);
        }
Exemplo n.º 2
0
        public static double TinhTongThanhToan(HOADONTHUEPHONG HD, DateTime ThoiGianTra, double DonGiaPhong)
        {
            double TienDichVu = TinhTienDichVuHoaDon(HD.MaHoaDon);
            double TienPhong  = TinhTienThuePhong(HD.ThoiGianThue, ThoiGianTra, DonGiaPhong);

            return(TienPhong + TienDichVu);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Hóa đơn có các trường: THời gian thuê, nhân viên tạo, phòng, mã khách hàng, trả về hóa đơn vừa thêm để lấy mã hóa đơn
        /// </summary>
        /// <param name="HD"></param>
        public static HOADONTHUEPHONG themHoaDonThuePhong(HOADONTHUEPHONG HD)
        {
            HD.NgayTao = DateTime.Now;
            HOADONTHUEPHONG res = DataProvider.ISCreated.DB.HOADONTHUEPHONGs.Add(HD);

            DataProvider.ISCreated.DB.SaveChanges();
            return(res);
        }
Exemplo n.º 4
0
        public static HOADONTHUEPHONG checkOutHoaDon(HOADONTHUEPHONG HD, DateTime GioRa)
        {
            HOADONTHUEPHONG res = DataProvider.ISCreated.DB.HOADONTHUEPHONGs.Where(x => x.MaHoaDon == HD.MaHoaDon).SingleOrDefault();

            res.ThoiGianTra = GioRa;
            //TÍnh tiền thanh toán
            res.TongTien = TinhTongThanhToan(res, GioRa, res.PHONG1.DonGia);

            //Cập nhật lại tình trạng phòng
            res.PHONG1.TinhTrangThue = false;
            capNhatCSDL();
            return(res);
        }