コード例 #1
0
ファイル: NextPageCommand.cs プロジェクト: 4pawan/WPF_Sample
 public NextPageCommand(PaginationViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
コード例 #2
0
ファイル: SearchById.cs プロジェクト: 4pawan/WPF_Sample
 public SearchById(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
コード例 #3
0
ファイル: SearchCondition.cs プロジェクト: 4pawan/WPF_Sample
 public SearchCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     srchById = new SearchById(paging, model);
     srchByName = new SearchByName(paging, model);
     pagingCondition = new PagingCondition(paging, model);
 }
コード例 #4
0
 public PreviousPageCommand(PaginationViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
コード例 #5
0
ファイル: EmpViewModel.cs プロジェクト: 4pawan/WPF_Sample
        public EmpViewModel()
        {
            EmpList = EmpService.GetEmpList();

            Paging = new PaginationViewModel
            {
                PeopleList = _empList,
            };
            Paging.ViewList.Filter += ViewList_Filter;

            ImportCommand = new RelayCommand(() =>
            {
                IsImportDataVisible = true;
                IsSearchVisible = false;
            }, () => true);

            SearchCommand = new RelayCommand(() =>
            {
                IsImportDataVisible = false;
                IsSearchVisible = true;
                EmpFormViewModel = new EmpFormViewModel();
            }, () => true);

            NavigateToForm = new RelayCommand<dynamic>(vm =>
            {
                this.IsImportDataVisible = false;
                this.IsSearchVisible = true;

                if (vm != null) EmpFormViewModel = vm;
            });

            SortCommand1 = new RelayCommand<dynamic>(item =>
            {
                if (string.Equals(item, "Name", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (SortColumn.NameSortOrder == SortDir.Descending)
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
                        SortColumn.NameSortOrder = SortDir.Ascending;
                    }
                    else
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Descending));
                        SortColumn.NameSortOrder = SortDir.Descending;
                    }
                }

                if (string.Equals(item, "Id", StringComparison.InvariantCultureIgnoreCase))
                {

                    // Paging.ViewList.View.Filter(propfull=) implement filter based on textBox

                    if (SortColumn.NameSortOrder == SortDir.Descending)
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Ascending));
                        SortColumn.NameSortOrder = SortDir.Ascending;
                    }
                    else
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Descending));
                        SortColumn.NameSortOrder = SortDir.Descending;
                    }
                }

            }, item => true);

            Paging.SearchByColumnCommand = new RelayCommand(() =>
            {
                Paging.PeopleList = new ObservableCollection<EmpFormViewModel>(EmpList.Where(p => new SearchCondition(Paging, p).Evaluate()));
            }, () => true);

            IsImportDataVisible = true;
        }
コード例 #6
0
ファイル: PagingCondition.cs プロジェクト: 4pawan/WPF_Sample
 public PagingCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
コード例 #7
0
ファイル: EmpViewModel.cs プロジェクト: 4pawan/WPF_Sample
        public EmpViewModel()
        {
            EmpList = EmpService.GetEmpList();

            Paging = new PaginationViewModel
            {
                PeopleList = _empList,
            };
            Paging.ViewList.Filter += ViewList_Filter;


            ImportCommand = new RelayCommand(() =>
            {
                IsImportDataVisible = true;
                IsSearchVisible     = false;
            }, () => true);

            SearchCommand = new RelayCommand(() =>
            {
                IsImportDataVisible = false;
                IsSearchVisible     = true;
                EmpFormViewModel    = new EmpFormViewModel();
            }, () => true);


            NavigateToForm = new RelayCommand <dynamic>(vm =>
            {
                this.IsImportDataVisible = false;
                this.IsSearchVisible     = true;

                if (vm != null)
                {
                    EmpFormViewModel = vm;
                }
            });

            SortCommand1 = new RelayCommand <dynamic>(item =>
            {
                if (string.Equals(item, "Name", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (SortColumn.NameSortOrder == SortDir.Descending)
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
                        SortColumn.NameSortOrder = SortDir.Ascending;
                    }
                    else
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Descending));
                        SortColumn.NameSortOrder = SortDir.Descending;
                    }
                }

                if (string.Equals(item, "Id", StringComparison.InvariantCultureIgnoreCase))
                {
                    // Paging.ViewList.View.Filter(propfull=) implement filter based on textBox

                    if (SortColumn.NameSortOrder == SortDir.Descending)
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Ascending));
                        SortColumn.NameSortOrder = SortDir.Ascending;
                    }
                    else
                    {
                        Paging.ViewList.SortDescriptions.Clear();
                        Paging.ViewList.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Descending));
                        SortColumn.NameSortOrder = SortDir.Descending;
                    }
                }
            }, item => true);

            Paging.SearchByColumnCommand = new RelayCommand(() =>
            {
                Paging.PeopleList = new ObservableCollection <EmpFormViewModel>(EmpList.Where(p => new SearchCondition(Paging, p).Evaluate()));
            }, () => true);

            IsImportDataVisible = true;
        }