public async Task SetForm() { var response = await ApiHelper.Get <GoiVay>(ApiRouter.BANK_GOIVAY + "/" + _id); if (response.IsSuccess && response.Content != null) { this._goiVay = response.Content as GoiVay; this.Title = _goiVay.Name; image.Success += (sender1, e1) => { heightImage = e1.ImageInformation.OriginalHeight; widthImage = e1.ImageInformation.OriginalWidth; setSizeImage(); }; image.Source = ImageSource.FromUri(new Uri(_goiVay.ImageFullUrl)); lblNganHang.Text = _goiVay.Bank.Name; lblGoiVayName.Text = _goiVay.Name; lblMaxPrice.Text = DecimalHelper.DecimalToText(_goiVay.MaxPrice) + "%"; lblMaxTime.Text = _goiVay.MaxTime + " " + (_goiVay.MaxTimeUnit == 0 ? Language.year.ToLower() : Language.month.ToLower()); lblLaiSuat.Text = DecimalHelper.DecimalToText(_goiVay.LaiSuat) + "%"; lblCondition.Text = _goiVay.Condition; lblDescription.Text = _goiVay.Description; lblEmpName.Text = _goiVay.User.FullName; lblPhone.Text = _goiVay.User.Phone; imageAvatar.Source = _goiVay.User.AvatarFullUrl; lblAddress.Text = _goiVay.Employee.Address; } }
public async void PriceToPick_Clicked(object sender, EventArgs e) { SelectPricePage selectPricePage = new SelectPricePage(viewModel.PostModel.PriceTo, viewModel.PostModel.PriceToUnit); selectPricePage.SetSaveEvent(async(object sSender, EventArgs sE) => { viewModel.PostModel.PriceToUnit = (short)selectPricePage.SelectedOption.Id; viewModel.PostModel.PriceToText = DecimalHelper.DecimalToText(selectPricePage.Price) + " " + selectPricePage.SelectedOption.Name.ToLower(); viewModel.PostModel.PriceTo = selectPricePage.Price; viewModel.PostModel.PriceToQuyDoi = selectPricePage.Price * selectPricePage.SelectedOption.QuyDoi; await Navigation.PopAsync(); }); await Navigation.PushAsync(selectPricePage); }
private async void InitUpdate() { var apiResponse = await ApiHelper.Get <PostModel>($"{ApiRouter.POST_GETBYID}/{this._id}"); if (apiResponse.IsSuccess == false) { return; } var model = apiResponse.Content as PostModel; model.AreaFromText = DecimalHelper.DecimalToText(model.AreaFrom, 2); model.AreaToText = DecimalHelper.DecimalToText(model.AreaTo, 2); model.ChieuSauFormatText = DecimalHelper.DecimalToText(model.ChieuSau, 2); model.DuongVaoFormatText = DecimalHelper.DecimalToText(model.DuongVao, 2); model.MatTienFormatText = DecimalHelper.DecimalToText(model.MatTien, 2); EntryAreaFrom.SetPrice(model.AreaFrom); EntryAreaTo.SetPrice(model.AreaTo); EntryChieuSau.SetPrice(model.ChieuSau); EntryMatTien.SetPrice(model.MatTien); EntryDuongVao.SetPrice(model.DuongVao); viewModel.PostModel = model; await Task.WhenAll( viewModel.LoadLoaiBatDongSan(viewModel.PostModel.PostType), viewModel.GetProvinceAsync(), viewModel.GetDistrictAsync(), viewModel.GetWardAsync() ); viewModel.PostModel.LoaiBatDongSan = viewModel.LoaiBatDongSanList.SingleOrDefault(x => x.Id == model.LoaiBatDongSanId); viewModel.PostModel.TinhTrangPhapLy = viewModel.TinhTrangPhaplyList.SingleOrDefault(x => x.Id == model.TinhTrangPhapLyId); LoaiBatDongSan_Change(null, null); // set dia chi viewModel.PostModel.Province = viewModel.ProvinceList.Single(x => x.Id == model.ProvinceId); viewModel.PostModel.District = viewModel.DistrictList.Single(x => x.Id == model.DistrictId); viewModel.PostModel.Ward = viewModel.WardList.Single(x => x.Id == model.WardId); if (model.ProjectId.HasValue) { viewModel.PostModel.Project = viewModel.ProjectList.SingleOrDefault(x => x.Id == model.ProjectId); } // set so phong ngu cho control if (model.NumOfBedRoom.HasValue) { var SoPhongNguList = SegmentSoPhongNgu.ItemsSource.Cast <short>().ToList(); SegmentSoPhongNgu.SelectedIndex = SoPhongNguList.IndexOf(viewModel.PostModel.NumOfBedRoom.Value); } // set so phong tam cho control if (model.NumOfBathRoom.HasValue) { var SoPhongTamList = SegmentSoPhongTam.ItemsSource.Cast <short>().ToList(); SegmentSoPhongTam.SelectedIndex = SoPhongTamList.IndexOf(viewModel.PostModel.NumOfBathRoom.Value); } // set huong if (model.HuongId.HasValue) { viewModel.PostModel.Huong = viewModel.HuongList.SingleOrDefault(x => x.Id == model.HuongId); } // noi that tien ich if (!string.IsNullOrEmpty(model.Utilities)) { viewModel.SelectedUtitlitesId = Array.ConvertAll(model.Utilities.Split(','), s => int.Parse(s)).ToList(); } // ban/cho thue moi load hinh. if (viewModel.PostModel.PostType == 0 || viewModel.PostModel.PostType == 1) { // load hinh anh. if (string.IsNullOrEmpty(model.Images) == false) { string[] imageList = model.Images.Split(','); foreach (var image in imageList) { viewModel.Media.Add(new MediaFile() { PreviewPath = ImageHelper.GetImageUrl("post", image), }); } } } loadingPopup.IsVisible = false; }