public static void xoaPhong(PHONG nv)
        {
            PHONG old = DataProvider.ISCreated.DB.PHONGs.Where(x => x.PhongID == nv.PhongID).SingleOrDefault();

            old.TinhTrangTonTai = true;
            capNhatCSDL();
        }
Пример #2
0
        public static PHONG truyVanPhong(string phongID)
        {
            PHONG res = new PHONG();

            res = DataProvider.ISCreated.DB.Database.SqlQuery <PHONG>("SELECT * FROM PHONG WHERE PhongID=@id and TinhTrangTonTai=0", new SqlParameter("@id", phongID)).FirstOrDefault();
            return(res);
        }
        // THEMMOI
        public static PHONG themMoiPhong(PHONG nv)
        {
            nv.NgayTao = DateTime.Now;
            PHONG res = new PHONG();

            res = DataProvider.ISCreated.DB.PHONGs.Add(nv);
            DataProvider.ISCreated.DB.SaveChanges();
            return(res);
        }
        public static void capNhatPhong(PHONG nv)
        {
            PHONG old = DataProvider.ISCreated.DB.PHONGs.Where(x => x.PhongID == nv.PhongID).SingleOrDefault();

            old.TenPhong        = nv.TenPhong;
            old.DonGia          = nv.DonGia;
            old.LoaiPhongID     = nv.LoaiPhongID;
            old.TinhTrangTonTai = false;
            old.TinhTrangThue   = true; // false --> chua thue
            try
            {
                old.TinhTrangTonTai = nv.TinhTrangTonTai;
                old.TinhTrangThue   = nv.TinhTrangThue;
            }
            catch (Exception)
            {
            }
            capNhatCSDL();
        }
Пример #5
0
        public static PHONG truyVanTenPhongMaHoaDon(int MaHoaDon)
        {
            PHONG res = DataProvider.ISCreated.DB.Database.SqlQuery <PHONG>("SELECT P.* FROM PHONG P JOIN HOADONTHUEPHONG LP ON   P.PhongID=LP.Phong WHERE LP.MaHoaDon=@id and P.TinhTrangTonTai=0", new SqlParameter("@id", MaHoaDon)).FirstOrDefault();

            return(res);
        }