internal void SetSelectedHouse(NHA selectedNha) { SelectedHouse = selectedNha; if (selectedNha != null) { using (QUANLYNHADATEntities db = new QUANLYNHADATEntities()) { SelectedHouseForRent = db.CHITIETNHATHUEs.FirstOrDefault(item => item.MANHA == selectedNha.MANHA); SelectedHouseForSale = db.CHITIETNHABANs.FirstOrDefault(item => item.MANHA == selectedNha.MANHA); } } else { SelectedHouseForRent = new CHITIETNHATHUE(); SelectedHouseForSale = new CHITIETNHABAN(); } if (SelectedHouseForRent != null) { HouseType = 0; } else if (SelectedHouseForSale != null) { HouseType = 1; } }
private HomeScreenViewModel() { using (QUANLYNHADATEntities db = new QUANLYNHADATEntities()) { Houses = new ObservableCollection <NHA>(db.NHAs.Where(item => item.MACNHA == MACNHA).ToList()); AllHouseTypes = new ObservableCollection <LOAINHA>(db.LOAINHAs); } SelectedHouse = new NHA(); SelectedHouseForRent = new CHITIETNHATHUE(); SelectedHouseForSale = new CHITIETNHABAN(); }
private HomeScreenViewModel() { using (QUANLYNHADATEntities db = new QUANLYNHADATEntities()) { Houses = new ObservableCollection <NHA>(db.NHAs.Where(item => item.MACN == MACN)); AllHouses = new ObservableCollection <NHA>(db.NHAs.Where(item => item.MACN == MACN)); AllHouseTypes = new ObservableCollection <LOAINHA>(db.LOAINHAs); AllHouseOwners = new ObservableCollection <CHUNHA>(db.CHUNHAs); Staffs = new ObservableCollection <NHANVIEN>(db.NHANVIENs.Where(item => item.MACN == MACN)); Customers = new ObservableCollection <KHACHHANG>(db.KHACHHANGs.Where(item => item.CNQUANLY == MACN)); } SelectedHouse = new NHA(); SelectedHouseForRent = new CHITIETNHATHUE(); SelectedHouseForSale = new CHITIETNHABAN(); SelectedStaff = new NHANVIEN(); SelectedCustomer = new KHACHHANG(); OldNewHousetypeRequest = new Dictionary <int, int>(); }