22using System . Windows . Input ;
33using hygge_imaotai . Entity ;
44using hygge_imaotai . Repository ;
5- using hygge_imaotai . UserInterface . UserControls ;
65
76namespace hygge_imaotai . Domain
87{
98 /// <summary>
109 /// 门店列表Page的ViewModel
1110 /// </summary>
12- public class StoreListViewModel : ViewModelBase
11+ public class ShopListViewModel : ViewModelBase
1312 {
1413 #region Field
1514 private string _shopId ;
@@ -19,10 +18,10 @@ public class StoreListViewModel:ViewModelBase
1918 private string _companyName ;
2019
2120 // 分页数据
22- private int _total = 0 ;
21+ private long _total = 0 ;
2322 private int _current = 1 ;
24- private int _pageSize = 10 ;
25- private int _pageCount = 0 ;
23+ private long _pageSize = 10 ;
24+ private long _pageCount = 0 ;
2625 #endregion
2726
2827 #region Properties
@@ -57,9 +56,9 @@ public string CompanyName
5756 set => SetProperty ( ref _companyName , value ) ;
5857 }
5958
60- public static ObservableCollection < StoreEntity > StoreList { get ; } = new ObservableCollection < StoreEntity > ( ) ;
59+ public static ObservableCollection < ShopEntity > StoreList { get ; } = new ObservableCollection < ShopEntity > ( ) ;
6160
62- public int Total
61+ public long Total
6362 {
6463 get => _total ;
6564 set => SetProperty ( ref _total , value ) ;
@@ -71,13 +70,13 @@ public int Current
7170 set => SetProperty ( ref _current , value ) ;
7271 }
7372
74- public int PageSize
73+ public long PageSize
7574 {
7675 get => _pageSize ;
7776 set => SetProperty ( ref _pageSize , value ) ;
7877 }
7978
80- public int PageCount
79+ public long PageCount
8180 {
8281 get => _pageCount ;
8382 set => SetProperty ( ref _pageCount , value ) ;
@@ -87,18 +86,27 @@ public int PageCount
8786
8887 #region Constructor
8988
90- public StoreListViewModel ( )
89+ public ShopListViewModel ( )
9190 {
9291 CurrentPageChangeCommand = new AnotherCommandImplementation ( UpdateData ) ;
9392 }
94- #endregion
93+ #endregion
9594
9695 #region DelegateCommand
9796 public ICommand CurrentPageChangeCommand { get ; private set ; }
9897 private void UpdateData ( object parameter )
9998 {
10099 StoreList . Clear ( ) ;
101- ShopRepository . GetPageData ( ( int ) parameter , 10 , this ) . ForEach ( StoreList . Add ) ;
100+ DB . Sqlite . Select < ShopEntity > ( )
101+ . WhereIf ( ! string . IsNullOrEmpty ( this . ShopId ) ,
102+ i => i . ShopId . Contains ( this . ShopId ) )
103+ . WhereIf ( ! string . IsNullOrEmpty ( this . Province ) ,
104+ i => i . Province . Contains ( this . Province ) )
105+ . WhereIf ( ! string . IsNullOrEmpty ( this . City ) ,
106+ i => i . City . Contains ( this . City ) )
107+ . WhereIf ( ! string . IsNullOrEmpty ( this . Area ) , i => i . Area . Contains ( this . Area ) )
108+ . WhereIf ( ! string . IsNullOrEmpty ( this . CompanyName ) , i => i . CompanyName . Contains ( this . CompanyName ) )
109+ . Page ( ( int ) parameter , 10 ) . ToList ( ) . ForEach ( StoreList . Add ) ;
102110 }
103111
104112 #endregion
0 commit comments