Example #1
0
 public NextPageCommand(PaginationViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Example #2
0
 public SearchById(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
Example #3
0
 public SearchCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     srchById = new SearchById(paging, model);
     srchByName = new SearchByName(paging, model);
     pagingCondition = new PagingCondition(paging, model);
 }
Example #4
0
 public PreviousPageCommand(PaginationViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
Example #5
0
        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;
        }
Example #6
0
 public PagingCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
Example #7
0
        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;
        }