private void OnPageCountChangedCommand() { if (EnterpriseInfoList.Any()) { ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>(); } }
private void OnPageSizeChangedCommand() { if (EnterpriseInfoList.Any()) { TotalPageCount = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize); ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>(); } }
/// <summary> /// 构造函数 /// </summary> public EntSiteInfoAddViewModel() { ConfirmCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnExecuteConfirmCommand, OnCanExecuteConfirmCommand); CancelCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnExecuteCancelCommand); PageCountChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnPageCountChangedCommand, OnCanPageCountChangedCommand); PageSizeChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnPageSizeChangedCommand, OnCanPageSizeChangedCommand); TotalPageCountChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnTotalPageCountChangedCommand, OnCanTotalPageCountChangedCommand); ComboxSearchCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnSearchChangedCommand, OnCanSearchChangedCommand); EnterpriseNameChangedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(OnEnterpriseNameChangedCommand, OnCanEnterpriseNameChangedCommand); PageSizeList = new List <int>() { 5, 10, 20, 50 }; getPageData(1, 10000); TotalPageCount = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize); ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>(); }
private void OnSearchChangedCommand() { if (String.IsNullOrEmpty(ComboboxContent)) { pageRepuestParams.FilterGroup = null; getPageData(1, 10000); TotalPageCount = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize); PageCount = 1; ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>(); } else { FilterGroup filterGroup = new FilterGroup(FilterOperate.Or); FilterRule filterRuleName = new FilterRule("EnterpriseName", ComboboxContent.Trim(), "contains"); filterGroup.Rules.Add(filterRuleName); pageRepuestParams.FilterGroup = filterGroup; getPageData(1, 10000); TotalPageCount = (int)Math.Ceiling((decimal)EnterpriseInfoList.Count() / pageSize); PageCount = 1; ShowEnterpriseInfoList = EnterpriseInfoList.Skip((PageCount - 1) * pageSize).Take(pageSize).ToObservableCollection <EnterpriseModel>(); } }