示例#1
0
        public SeatsWindowVm(Guid sessionId, int sessionPlaces, ISeatQueries seatQueries, ICompanyQueries companyQueries, IStudentQueries studentQueries, IApplicationService applicationService, ISessionQueries sessionQueries)
        {
            _sessionId          = sessionId;
            _sessionPlaces      = sessionPlaces;
            _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService));
            _sessionQueries     = sessionQueries ?? throw new ArgumentNullException(nameof(sessionQueries));
            _companyQueries     = companyQueries ?? throw new ArgumentNullException(nameof(companyQueries));
            _studentQueries     = studentQueries ?? throw new ArgumentNullException(nameof(studentQueries));
            _seatQueries        = seatQueries ?? throw new ArgumentNullException(nameof(seatQueries));

            AddSeatCommand          = new RelayCommandAsync(() => ExecuteAddSeatAsync(false), () => SelectedCompany != null);
            AddValidatedSeatCommand = new RelayCommandAsync(() => ExecuteAddSeatAsync(true), () => SelectedCompany != null && SelectedStudent != null);
            CreateStudentCommand    = new RelayCommandAsync(ExecuteCreateStudentAsync);
            CreateCompanyCommand    = new RelayCommandAsync(ExecuteCreateSocieteAsync);

            SelectedSeats = new ObservableCollection <SeatItem>();
            SelectedSeats.CollectionChanged += (sender, args) =>
            {
                CancelSeatCommand.RaiseCanExecuteChanged();
                ValidateSeatCommand.RaiseCanExecuteChanged();
                RefuseSeatCommand.RaiseCanExecuteChanged();
            };

            CancelSeatCommand    = new RelayCommandAsync(ExecuteCancelSeatAsync, () => SelectedSeats.Any());
            ValidateSeatCommand  = new RelayCommandAsync(ExecuteValidateSeatAsync, () => SelectedSeats.Any());
            RefuseSeatCommand    = new RelayCommandAsync(ExecuteRefuseSeatAsync, () => SelectedSeats.Any());
            RefreshSeatsCommand  = new RelayCommandAsync(ExecuteRefreshSeatsAsync);
            DefineStudentCommand = new RelayCommand(() => { DefineStudent = !DefineStudent; SelectedStudent = null; });
            EditStudentCommand   = new RelayCommandAsync(ExecuteEditStudentAsync);

            GenerateAgreementCommand = new RelayCommandAsync(ExecuteGenerateAgreementAsync);
            OpenAgreementCommand     = new RelayCommandAsync(ExecuteOpenAgreementAsync);
            Security = new Security(applicationService);
        }
示例#2
0
        public EditStudentWindowVm(ObservableCollection <Item> students, Guid currentStudentId, IApplicationService applicationService, IStudentQueries studentQueries)
        {
            _previousSelectedStudent = currentStudentId;
            _applicationService      = applicationService ?? throw new ArgumentNullException(nameof(applicationService));
            _studentQueries          = studentQueries ?? throw new ArgumentNullException(nameof(studentQueries));
            SetValiderCommandCanExecute(() => SelectedStudent?.Id != _previousSelectedStudent);

            CreateStudentCommand = new RelayCommandAsync(ExecuteCreateStudentAsync);
            Students             = students;
        }
 public StudentsController(IStudentQueries studentQueries,
                           IRequestHandler <CreateStudentCommand, bool> createStudentCommand,
                           IRequestHandler <UpdateStudentCommand, bool> updateStudentCommand,
                           IRequestHandler <DeleteStudentCommand, bool> deleteStudentCommand
                           )
 {
     _studentQueries       = studentQueries;
     _createStudentCommand = createStudentCommand;
     _updateStudentCommand = updateStudentCommand;
     _deleteStudentCommand = deleteStudentCommand;
 }
 public StudentListVm(IApplicationService applicationService, IStudentQueries studentQueries) : base(applicationService)
 {
     _studentQueries = studentQueries ?? throw new ArgumentNullException(nameof(studentQueries));
 }
 public StudentController(IStudentQueries studentQueries)
 {
     _studentQueries = studentQueries;
 }