Пример #1
0
        void ShowAllParticipants()
        {
            AllParticipantsViewModel allParticipantsVM = (AllParticipantsViewModel)Workspaces.FirstOrDefault(w => w is AllParticipantsViewModel);

            if (allParticipantsVM == null)
            {
                allParticipantsVM = new AllParticipantsViewModel(_repository
                                                                 );
                this.Workspaces.Add(allParticipantsVM);
            }
            this.SetActiveWorkspace(allParticipantsVM);
            allParticipantsVM.PropertyChanged += AllParticipantsVM_PropertyChanged;
            EventHandler onRequestClose = null;

            allParticipantsVM.RequestClose += onRequestClose = (o, e) =>
            {
                allParticipantsVM.PropertyChanged -= AllParticipantsVM_PropertyChanged;
                allParticipantsVM.RequestClose    -= onRequestClose;
                onRequestClose = null;
            };
        }
Пример #2
0
        public AllViolationsViewModel(IRepository repository)
            : base(repository)
        {
            var participantMap = AllParticipantsViewModel.GetParticipantBaseMapExpression();
            var allViolModels  = (from v in _repository.ProtocolViolations.Include("Participant").AsNoTracking().AsExpandable()
                                  select new ProtocolViolationModel
            {
                Id = v.Id,
                Participant = participantMap.Invoke(v.Participant),
                Details = v.Details,
                ReportingInvestigator = v.ReportingInvestigator,
                ReportingTimeLocal = v.ReportingTimeLocal,
                ViolationType = v.ViolationType
            }).ToList();

            foreach (var v in allViolModels)
            {
                v.Participant.StudyCentre = _repository.FindStudyCentre(v.Participant.CentreId);
            }
            AllViolations = new ObservableCollection <ProtocolViolationViewModel>(allViolModels.Select(v => new ProtocolViolationViewModel(_repository, v)));
            _repository.ProtocolViolationAddOrUpdate += ViolationAddOrUpdate;
            ShowViolationDetails = new RelayCommand(ShowViolationWindow, param => SelectedViolation != null && _violationWindow == null);
        }