public void LoadLoaiBatDongSan() { loaiBatDongSans = LoaiBatDongSanModel.GetList(null); LookUpType.ItemsSource = loaiBatDongSans; }
public void InitLoaiBatDongSanList() { viewModel.LoaiBatDongSanList = LoaiBatDongSanModel.GetList(null); }
public async void Init() { bool HasResult = await viewModel.LoadPost(_id); if (!HasResult) { await DisplayAlert("", Language.bai_dang_khong_ton_tai_hoac_da_xoa, Language.dong); await Navigation.PopAsync(); return; } // cau hinh button. SetFloatingButtonGroup(); // can thue can mua thi load comment ve. hien thi o comment. if (viewModel.GetPost.PostType == 2 || viewModel.GetPost.PostType == 3) { await viewModel.LoadPostComment(); StacklayoutPostComments.IsVisible = true; onClick_HideShow_Description(null, EventArgs.Empty); // dong lai mo ta. neu post type 2 3 MessagingCenter.Subscribe <PickPostPage>(this, "OnNewPostComment", async(sender) => { loadingPopup.IsVisible = true; viewModel.PostComments.Clear(); viewModel.PostCommentPage = 1; await viewModel.LoadPostComment(); loadingPopup.IsVisible = false; }); } else { StacklayoutPostComments.IsVisible = false; } lbLoaiBatDongSan.Text = LoaiBatDongSanModel.GetList(null).SingleOrDefault(x => x.Id == viewModel.GetPost.LoaiBatDongSanId).Name; if (viewModel.GetPost.PostType == 0 || viewModel.GetPost.PostType == 1) { stListImg.IsVisible = true; } if (viewModel.GetPost.PostType == 2 || viewModel.GetPost.PostType == 3) { gridContent.Margin = new Thickness(0, 10, 0, 0); // đây frame xuong cvBDSCungKhuVuc.HeightRequest = 90; frContentPost.Margin = new Thickness(10, 0, 10, 0); } //lấy danh sách Images if (viewModel.GetPost.ImageList != null) { string[] ListImages = viewModel.GetPost.ImageList; for (int i = 0; i < ListImages.Length; i++) { Photo photo = new Photo(); photo.URL = ImageHelper.GetImageUrl("post", ListImages[i]); GetPhotos.Add(photo); } lbNumImages.Text = ListImages.Count().ToString(); carouseView.ItemsSource = GetPhotos; } if (viewModel.GetPost.TinhTrangPhapLyId.HasValue) { var TinhTrangPhapLy = viewModel.GetPost.TinhTrangPhapLyId; List <TinhTrangPhapLyModel> tinhtrangphaplyModel = TinhTrangPhapLyData.GetList(); TinhTrangPhapLyModel modelTinhTrangPhapLy = tinhtrangphaplyModel.Where(x => x.Id == TinhTrangPhapLy).SingleOrDefault(); lbTinhTrangPhapLy.Text = modelTinhTrangPhapLy.Name; } if (viewModel.GetPost.HuongId.HasValue) { var HuongNha = viewModel.GetPost.HuongId; List <HuongModel> huongnhaModel = HuongData.GetList(); HuongModel modelHuong = huongnhaModel.Where(x => x.Id == HuongNha).SingleOrDefault(); lbHuongNha.Text = modelHuong.Name; } //set trang thai duu an. if (viewModel.GetPost.Project?.Status != null) { int id_Status = viewModel.GetPost.Project.Status.Value; List <ProjectStatusModel> listStatus = ProjectStatusData.GetList(); ProjectStatusModel modelStatus = listStatus.Single(x => x.Id == id_Status); spStatus.Text = modelStatus.Name; } //kiểm tra là lấy thông tin của "nội thất tiện nghi" if (viewModel.GetPost.Utilities != null) { string[] utilitiesArr = viewModel.GetPost.Utilities.Split(','); Option[] utilitiesImg = new Option[utilitiesArr.Length]; List <Option> tienichduan = BDSUtilities.GetListUtilities(); for (int i = 0; i < utilitiesArr.Length; i++) { var item = utilitiesArr[i]; Option model = tienichduan.Where(x => x.Id == short.Parse(item)).SingleOrDefault(); utilitiesImg[i] = model; } flvUtilities.FlowItemsSource = utilitiesImg; stNoiThatTienNghi.IsVisible = true; } else { stNoiThatTienNghi.IsVisible = false; } //kiểm tra. nếu có projectId thì cho hiện "Thuộc dự an" và lấy loại bất động sản if (viewModel.GetPost.ProjectId.HasValue) { // stThuocDuAn.IsVisible = true; Guid _idProject = viewModel.GetPost.ProjectId.Value; await viewModel.LoadBDSKhac(_id, _idProject); if (viewModel.BDSKhac.Count != 0) { stBDSKhac.IsVisible = true; } // lấy loại bất động sản string[] categoriArr = viewModel.GetPost.Project.CategoriBDS.Split(','); string[] newCategoriArr = new string[categoriArr.Length]; List <ProjectTypeModel> modelCategori = ProjectTypeData.GetListProjectType(); for (int i = 0; i < categoriArr.Length; i++) { var temp = categoriArr[i]; ProjectTypeModel categoriModel = modelCategori.Where(x => x.Id == short.Parse(temp)).SingleOrDefault(); newCategoriArr[i] = categoriModel.Name; } lbCatogoriBDS.Text = string.Join(", ", newCategoriArr); } //gán dữ liệ cho label lbTongDienTichSuDung.Text = viewModel.GetPost.AreaFormatText; lbDuongVao.Text = viewModel.GetPost.DuongVao.ToString(); lbMatTien.Text = viewModel.GetPost.MatTien.ToString(); lbChieuSau.Text = viewModel.GetPost.ChieuSau.ToString(); lbTang.Text = viewModel.GetPost.Tang.ToString(); lbSoTang.Text = viewModel.GetPost.NumOfFloor.ToString(); lbSoThangMay.Text = viewModel.GetPost.SoThangMay.ToString(); lbSoDuongNgu.Text = viewModel.GetPost.NumOfBedroom.ToString(); lbSoPhongtam.Text = viewModel.GetPost.NumOfBathroom.ToString(); // hiển thị thông tin trong phần "tổng quan dự án" (những thông tin luôn hiện) stTinhTrangPhapLy.IsVisible = true; stHuongNha.IsVisible = true; stTongDienTichSuDung.IsVisible = true; //hiển thị thông tin trong phần "tổng quan dự án" (kiểm tra theo loại bất động sản) var LoaiBatDongSan = viewModel.GetPost.LoaiBatDongSanId; if (LoaiBatDongSan == 0) { stTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 1) { stTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 2) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stSoTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 3) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stSoTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 4) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stSoTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 5) { stTang.IsVisible = true; } if (LoaiBatDongSan == 6) { stTang.IsVisible = true; stSoThangMay.IsVisible = true; } if (LoaiBatDongSan == 7) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stSoTang.IsVisible = true; stSoPhongTam.IsVisible = true; stSoDuongNgu.IsVisible = true; } if (LoaiBatDongSan == 8) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stChieuSau.IsVisible = true; } if (LoaiBatDongSan == 9) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stChieuSau.IsVisible = true; } if (LoaiBatDongSan == 10) { stDuongVao.IsVisible = true; stMatTien.IsVisible = true; stChieuSau.IsVisible = true; } var gridChildren = gridContent.Children.Where(x => x.IsVisible == true).ToList(); for (int i = 0; i < gridChildren.Count(); i++) { gridContent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(9, GridUnitType.Auto) }); Grid.SetRow(gridChildren[i], i); } //check follow await ChekcIsFollowPost(); //disable loading loadingPopup.IsVisible = false; ScrollView_Detail_M_B.IsVisible = true; }