/// <summary> /// LẤY DANH SÁCH TẤT CẢ CÁC PHÒNG /// </summary> /// <returns></returns> public List <PHONG> Laydanhsachphong() { List <PHONG> dsphong = new List <PHONG>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = System.Data.CommandType.Text; command.CommandText = "Select * from PHONG"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string IDPhong = reader.GetString(0); string Tenphong = reader.GetString(1); string IDLoaiphong = reader.GetString(2); string IDTinhtrangphong = reader.GetString(3); PHONG pHONG = new PHONG(); pHONG.MAPHONG = IDPhong; pHONG.TENPHONG = Tenphong; pHONG.MALOAI = IDLoaiphong; pHONG.MATINHTRANG = IDTinhtrangphong; dsphong.Add(pHONG); } return(dsphong); }
public bool themPhong(string maPhong, string loaiPhong, int khuvuc, int tinhTrang) { PHONG ph = new PHONG(); ph.MAPH = maPhong; ph.KHUVUC = khuvuc; ph.MALOAIPH = loaiPhong; ph.TINHTRANG = tinhTrang; db.PHONGs.InsertOnSubmit(ph); db.SubmitChanges(); return(true); }
//Thêm public bool them_Phong(PHONG p) { try { data.PHONGs.InsertOnSubmit(p); data.SubmitChanges(); return(true); } catch { return(false); } }
//Xóa public bool xoa_Phong(string pMaP) { try { PHONG p = data.PHONGs.Where(t => t.MAPHONG == pMaP).FirstOrDefault(); data.PHONGs.DeleteOnSubmit(p); data.SubmitChanges(); return(true); } catch { return(false); } }
public void ThemP(string MP, string TP, string DT, string DG, string MT, string TT, string HA) { QLKhachSanEntities chung = new QLKhachSanEntities(); PHONG td = new PHONG(); td.MAPHONG = MP; td.TENPHONG = TP; td.DIENTICH = DT; td.DONGIA = int.Parse(DG); td.MAKV = MT; td.TRANGTHAI = TT; td.HINHANH = HA; chung.PHONG.Add(td); chung.SaveChanges(); }
public bool XoaPhong(string maph) { try { PHONG phong = (from ph in db.PHONGs where ph.MAPH == maph select ph).First(); db.PHONGs.DeleteOnSubmit(phong); db.SubmitChanges(); return(true); } catch { return(false); } }
public bool suaSLH(PHONG pma) { try { PHONG phong = data.PHONGs.Where(t => t.MAPHONG == pma.MAPHONG).FirstOrDefault(); if (phong != null) { phong.SOLUONG_HT = pma.SOLUONG_HT; data.SubmitChanges(); } return(true); } catch { return(false); } }
public bool SuaPhong(string maPhong, string loaiPhong, int khuvuc, int tinhTrang) { try { PHONG ph = (from phong in db.PHONGs where phong.MAPH == maPhong select phong).First(); ph.MAPH = maPhong; ph.KHUVUC = khuvuc; ph.MALOAIPH = loaiPhong; ph.TINHTRANG = tinhTrang; db.SubmitChanges(); return(true); } catch { return(false); } }
public bool suaPhong(PHONG phong) { try { PHONG p = data.PHONGs.Where(t => t.MAPHONG == phong.MAPHONG).FirstOrDefault(); if (p != null) { p.TENPHONG = phong.TENPHONG; p.TINHTRANG = phong.TINHTRANG; p.SOLUONG_HT = phong.SOLUONG_HT; p.SOLUONG_TD = phong.SOLUONG_TD; p.TRANGTHAIPHONG = phong.TRANGTHAIPHONG; data.SubmitChanges(); } return(true); } catch { return(false); } }