public FurnitureProductFilterResultPage(FilterFurnitureProductModel filterMoel) { InitializeComponent(); LV.ItemTemplate = new DataTemplate(typeof(Cells.FurnitureCells.ProductViewCell)); this.Title = Language.ket_qua_loc; this.BindingContext = viewModel = new FilterFurnitureProductViewModel(filterMoel); Init(); }
public MyProductListPageViewModel() { FilterModel = new FilterFurnitureProductModel(); FilterModel.CreatedById = Guid.Parse(UserLogged.Id); PreLoadData = new Command(() => { string json = Newtonsoft.Json.JsonConvert.SerializeObject(this.FilterModel); ApiUrl = $"{ApiRouter.FURNITUREPRODUCT_FILTER}?json={json}&page={Page}"; }); }
public async void AddProduct_Clicked(object sender, EventArgs e) { if (!UserLogged.IsLogged) { await DisplayAlert("", Language.vui_long_dang_nhap, Language.dong); ((AppShell)Shell.Current).SetLoginPageActive(); return; } var action = await Shell.Current.DisplayActionSheet(Language.tuy_chon, Language.huy, null, Language.them_moi_san_pham, Language.chon_tu_san_pham_noi_that); if (action == Language.them_moi_san_pham) { await Navigation.PushAsync(new AddProductPage(true) { Title = Language.them_san_pham }); } else if (action == Language.chon_tu_san_pham_noi_that) { loadingPopup.IsVisible = true; if (searchPageResultViewModel == null) // chua bat popup lan nao. { this.ListView0.ItemTapped += ListView0_ItemTapped; searchPageResultViewModel = new ListViewPageViewModel2 <SundihomeApi.Entities.Furniture.FurnitureProduct>(); FilterModel = new FilterFurnitureProductModel(); FilterModel.ProductStatus = 0; FilterModel.IsPromotion = false; FilterModel.CreatedById = Guid.Parse(UserLogged.Id); string json = Newtonsoft.Json.JsonConvert.SerializeObject(this.FilterModel); searchPageResultViewModel.PreLoadData = new Command(() => { searchPageResultViewModel.ApiUrl = $"{Configuration.ApiRouter.FURNITUREPRODUCT_FILTER}?json={json}&page={searchPageResultViewModel.Page}"; }); this.ListView0.BindingContext = searchPageResultViewModel; } else { Keyword = null; ModalPopupSearchBar.Text = null; } await searchPageResultViewModel.LoadOnRefreshCommandAsync(); loadingPopup.IsVisible = false; ModalPopup.IsVisible = true; await ModalPopup.TranslateTo(0, 0, 150); } }
public FilterFurnitureProductViewModel(FilterFurnitureProductModel filterModel = null) { if (filterModel != null) { FilterModel = filterModel; } else { FilterModel = new FilterFurnitureProductModel(); FilterModel.IsPromotion = false; FilterModel.ProductStatus = 0; } PreLoadData = new Command(() => { string json = Newtonsoft.Json.JsonConvert.SerializeObject(this.FilterModel); ApiUrl = $"{Configuration.ApiRouter.FURNITUREPRODUCT_FILTER}?json={json}&page={this.Page}"; }); Categories = new ObservableCollection <FurnitureCategory>(); }
public async void Filter_Clicked(object sender, EventArgs e) { FilterFurnitureProductModel filterModel = new FilterFurnitureProductModel(); //if (segmentPostType.SelectedIndex != -1) //{ // filterModel.PostType = (short)segmentPostType.SelectedIndex; //} if (viewModel.ParentCategory != null) { filterModel.ParentCategoryId = viewModel.ParentCategory.Id; } if (viewModel.ChildCategory != null) { filterModel.CategoryId = viewModel.ChildCategory.Id; } if (viewModel.Province != null) { filterModel.ProvinceId = viewModel.Province.Id; } if (viewModel.District != null) { filterModel.DistrictId = viewModel.District.Id; } if (viewModel.Ward != null) { filterModel.WardId = viewModel.Ward.Id; } if (!string.IsNullOrWhiteSpace(viewModel.Keyword)) { filterModel.Keyword = viewModel.Keyword.Trim(); } await Shell.Current.Navigation.PushAsync(new FurnitureProductFilterResultPage(filterModel)); }