Beispiel #1
0
        public void Filter()
        {
            if (searchName == null)
            {
                searchName = string.Empty;
            }

            var result = ProfessorsLocal.Where(p => p.Name.ToLowerInvariant().Contains(SearchName.ToLowerInvariant()))
                         .ToList();

            if (result != null)
            {
                var remove = Professors.Except(result).ToList();

                remove.ForEach(r =>
                {
                    Professors.Remove(r);
                });
            }

            for (int index = 0; index < result.Count; index++)
            {
                var item = result[index];
                if (index + 1 > Professors.Count || !Professors[index].Equals(item))
                {
                    Professors.Insert(index, item);
                }
            }
        }
        public async Task OnDeleteProfessor(Professor professor)
        {
            var result = await _confirmationDialogHelper.ConfirmationWindowCall(ElementType.Professor);

            if (result)
            {
                Professors.Remove(professor);
                _professorRepository.DeleteProfessor(professor);
            }
        }
        private void ExecuteRemove(object p)
        {
            if (p != null && p is Professor)
            {
                try
                {
                    var professor = p as Professor;

                    ServiceDataProvider.DeleteProfessor(professor.ProfessorId);
                    Professors.Remove(professor);
                }
                catch (FaultException <DeleteFault> fe)
                {
                    MessageBox.Show(string.Format("{0} {1}", fe.Detail.Message, fe.Detail.Description));
                }
            }
        }