Ejemplo n.º 1
0
 public EmpFormViewModel()
 {
     SaveCommand = new RelayCommand(() =>
     {
         var age   = this.Age;
         var name  = this.Name;
         var model = new EmpFormViewModel
         {
             Name = this.Name,
             Age  = this.Age
         };
         Service.EmpService.AddEmp(model);
         MessageBox.Show("Save Executed", "Message Save", MessageBoxButton.OK, MessageBoxImage.Information);
     }, () => true);
 }
Ejemplo n.º 2
0
        public EmpFormViewModel()
        {
            SaveCommand = new RelayCommand(() =>
            {

                var age = this.Age;
                var name = this.Name;
                var model = new EmpFormViewModel
                {
                    Name = this.Name,
                    Age = this.Age
                };
                Service.EmpService.AddEmp(model);
                MessageBox.Show("Save Executed", "Message Save", MessageBoxButton.OK, MessageBoxImage.Information);

            }, () => true);
        }
Ejemplo n.º 3
0
 public SearchById(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
Ejemplo n.º 4
0
 public SearchCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     srchById = new SearchById(paging, model);
     srchByName = new SearchByName(paging, model);
     pagingCondition = new PagingCondition(paging, model);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 6
0
 public PagingCondition(PaginationViewModel paging, EmpFormViewModel model)
 {
     this.paging = paging;
     this.model = model;
 }
Ejemplo n.º 7
0
 public static void EditEmp(EmpFormViewModel emp)
 {
 }
Ejemplo n.º 8
0
 public static void DeleteEmp(EmpFormViewModel emp)
 {
 }
Ejemplo n.º 9
0
 public static void AddEmp(EmpFormViewModel emp)
 {
     empList.Add(emp);
 }
Ejemplo n.º 10
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;
        }