public void AddEmployee() { SelectedEmployees.Add(SelectedEmployeeToAdd); AvailableEmployees.Remove(SelectedEmployeeToAdd); NotifyOfPropertyChange(() => SelectedEmployees); NotifyOfPropertyChange(() => CanPrint); NotifyOfPropertyChange(() => CanReset); }
private void AddEmployee() { EmployeeSelectDialog dlg = new EmployeeSelectDialog(true); dlg.AddTriggered += ep => { if (!SelectedEmployees.Contains(ep)) { SelectedEmployees.Add(ep); } }; dlg.ShowDialog(); }
public void AddEmployee() { foreach (var item in AvailableEmployees.Where(x => x.IsSelected).Reverse()) { SelectedEmployeeToAdd.IsSelected = false; SelectedEmployees.Add(SelectedEmployeeToAdd); AvailableEmployees.Remove(SelectedEmployeeToAdd); } NotifyOfPropertyChange(() => SelectedEmployees); NotifyOfPropertyChange(() => AvailableEmployees); NotifyOfPropertyChange(() => CanSave); NotifyOfPropertyChange(() => CanReset); SortEmployees(SelectedEmployees); SortEmployees(AvailableEmployees); }
public NewAuditViewModel() { Audit = new NewAudit(); MessagingCenter.Subscribe <CalendarPopupViewModel>(this, MessageKeys.StartDateAudit, sender => { PeriodDateIn = sender.SelectedDate; IsChangedStartDate = true; }); MessagingCenter.Subscribe <CalendarPopupViewModel>(this, MessageKeys.EndDateAudit, sender => { PeriodDateOut = sender.SelectedDate; IsChangedEndDate = true; }); MessagingCenter.Subscribe <EmployeeListViewModel>(this, MessageKeys.AddEmployeers, sender => { var t = new ObservableCollection <Employee>(sender.Employees .Where(i => (i is Employee && (((Employee)i) .IsChecked) && !IsExistInCurrentList(i)))); if (t.Count != 0) { foreach (var item in t) { SelectedEmployees.Add(item); } } ListViewSelectedEmployeesHeight = (49 * SelectedEmployees.Count); if (SelectedEmployees.Count != 0) { IsListEmployeesVisible = true; } }); MessagingCenter.Subscribe <Employee>(this, MessageKeys.AddChairman, sender => { Chairman = sender; OnPropertyChanged(nameof(ChairmanText)); }); MessagingCenter.Subscribe <AuditSubject>(this, MessageKeys.AddAuditSubject, sender => { AuditSubject = sender; OnPropertyChanged(nameof(AuditSubjectText)); }); MessagingCenter.Subscribe <AuditBase>(this, MessageKeys.AddAuditBase, sender => { AuditBase = sender; OnPropertyChanged(nameof(AuditBaseText)); }); MessagingCenter.Subscribe <AuditType>(this, MessageKeys.AddAuditType, sender => { AuditType = sender; OnPropertyChanged(nameof(AuditTypeText)); }); SelectedEmployees = new ObservableCollection <Employee>(); ListViewSelectedEmployeesHeight = 0; }