public QuestionnaireViewModel(IQuestionnaireService questionnaireService, QuestionFactory questionFactory,
                                      IFrameNavigationService navigationService, IFestivalService festivalService, IOfflineService offlineService, IConfiguration config)
        {
            _config = config;
            _questionnaireService = questionnaireService;
            _navigationService    = navigationService;
            _questionFactory      = questionFactory;
            _festivalService      = festivalService;
            _offlineService       = offlineService;

            Initialize((int)_navigationService.Parameter);

            AddedQuestions         = new ObservableCollection <Question>();
            RemovedQuestions       = new ObservableCollection <Question>();
            OpenDeleteCheckCommand = new RelayCommand <Question>(DeleteCommandCheck, _ => offlineService.IsOnline, true);
            AddQuestionCommand     = new RelayCommand(AddQuestion, () => SelectedItem != null, true);
            // DeleteQuestionCommand = new RelayCommand<Question>(DeleteQuestion, _ => offlineService.IsOnline, true);
            DeleteCommand = new RelayCommand(DeleteQuestion, () => offlineService.IsOnline, true);
            DeleteQuestionnaireCommand     = new RelayCommand(DeleteQuestionnaire, () => offlineService.IsOnline, true);
            SaveQuestionnaireCommand       = new RelayCommand(SaveQuestionnaire, () => offlineService.IsOnline, true);
            OpenFileWindowCommand          = new RelayCommand <Question>(OpenFileWindow, HasAnswers);
            AddOptionToQuestion            = new RelayCommand <Question>(AddOption, _ => offlineService.IsOnline, true);
            SelectReferenceQuestionCommand =
                new RelayCommand <ReferenceQuestion>(SelectReferenceQuestion, _ => offlineService.IsOnline, true);
            SetReferenceQuestionCommand =
                new RelayCommand <Question>(SetReferenceQuestion, _ => offlineService.IsOnline, true);

            QuestionList        = (CollectionView)CollectionViewSource.GetDefaultView(_allQuestions());
            QuestionList.Filter = Filter;
        }
Exemple #2
0
        public CreateFestivalViewModel(IFrameNavigationService navigationService, IFestivalService festivalService,
                                       IGoogleMapsService googleMapsService)
        {
            Festival = new Festival
            {
                OpeningHours = new OpeningHours(),
                Address      = new Address()
            };
            _festivalService   = festivalService;
            _navigationService = navigationService;

            if (navigationService.Parameter == null || !(navigationService.Parameter is int customerId))
            {
                throw new InvalidNavigationException();
            }

            _customerId = customerId;

            CreateFestivalCommand = new RelayCommand(CreateFestival);

            #region Google Search

            _googleService = googleMapsService;
            SearchCommand  = new RelayCommand(Search);
            SelectCommand  = new RelayCommand <string>(Select);

            #endregion
        }
 public FestivalsController(IMapper mapper, IFestivalService service,
                            IValidator <FestivalCreateRequestBody> validator,
                            IValidator <FestivalUpdateRequestBody> updateValidator)
 {
     _mapper          = mapper;
     _service         = service;
     _createValidator = validator;
     _updateValidator = updateValidator;
 }
        public FestivalListViewModel(IFrameNavigationService navigationService, IFestivalService festivalService)
        {
            _navigationService = navigationService;

            OpenFestivalCommand = new RelayCommand <int>(OpenFestival);
            Festivals           = (CollectionView)CollectionViewSource.GetDefaultView(festivalService.GetFestivals());
            Festivals.Filter    = Filter;

            festivalService.Sync();
        }
Exemple #5
0
 public ClientWorker(IFestivalService server, TcpClient client)
 {
     this.server = server;
     this.client = client;
     try
     {
         stream    = client.GetStream();
         formatter = new BinaryFormatter();
         connected = true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
Exemple #6
0
        public FestivalServiceTests()
        {
            // Setup database mocks
            _dbMock = new Mock <FestispecContext>();

            _dbMock.Setup(x => x.Questionnaires).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object);
            _dbMock.Setup(x => x.Customers).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Customers).Object);
            _dbMock.Setup(x => x.Questions).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questions).Object);
            _dbMock.Setup(x => x.Answers).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Answers).Object);
            _dbMock.Setup(x => x.PlannedInspections).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().PlannedInspections).Object);
            _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Festivals).Object);
            _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Employees).Object);
            _dbMock.Setup(x => x.Addresses).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Addresses).Object);
            _dbMock.Setup(m => m.SaveChangesAsync()).ReturnsAsync(1);

            _festivalService = new FestivalService(_dbMock.Object, new JsonSyncService <Festival>(_dbMock.Object), new AddressService(_dbMock.Object));
        }
Exemple #7
0
        public UpdateFestivalViewModel(IFrameNavigationService navigationService, IFestivalService festivalService,
                                       IGoogleMapsService googleMapsService)
        {
            _festivalService      = festivalService;
            _navigationService    = navigationService;
            _googleService        = googleMapsService;
            Festival              = _festivalService.GetFestival((int)_navigationService.Parameter);
            UpdateFestivalCommand = new RelayCommand(UpdateFestival);
            CancelCommand         = new RelayCommand(() => _navigationService.NavigateTo("FestivalInfo", Festival.Id));

            #region Google Search

            _googleService = googleMapsService;
            SearchCommand  = new RelayCommand(Search);
            SelectCommand  = new RelayCommand <string>(Select);
            CurrentAddress = $"Huidige adres: {Festival.Address}";

            #endregion
        }
Exemple #8
0
 public HomeController(ApplicationDbContext context,
                       IMessengerService messengerService,
                       IKeypadService keypadService, IConfigService configService,
                       IUserDataService userDataService, IOrderService orderService,
                       IButtonService buttonService, IProvinceService provinceService,
                       IFestivalService festivalService, IGroupService groupService,
                       IApiService apiService)
 {
     _context          = context;
     _messengerService = messengerService;
     _keypadService    = keypadService;
     _configService    = configService;
     _userDataService  = userDataService;
     _buttonService    = buttonService;
     _provinceService  = provinceService;
     _festivalService  = festivalService;
     _groupService     = groupService;
     _orderService     = orderService;
     _apiService       = apiService;
 }
Exemple #9
0
        public MapViewModel(
            IFrameNavigationService navigationService,
            IFestivalService festivalService,
            ICustomerService customerService,
            IEmployeeService employeeService,
            IConfiguration config
            )
        {
            _festivalService   = festivalService;
            _navigationService = navigationService;
            _customerService   = customerService;
            _employeeService   = employeeService;

            CheckboxCheckedCommand   = new RelayCommand(FilterPoints);
            BackCommand              = new RelayCommand(Back);
            BingMapsTileLayer.ApiKey = config["ApiKeys:Bing"];

            LoadPoints();
            FilterPoints();
        }
        public RapportPreviewViewModel(
            IFrameNavigationService navigationService,
            IQuestionnaireService questionnaireService,
            IFestivalService festivalService,
            IConfiguration config,
            GraphSelectorFactory graphSelector,
            IEmployeeService employeeService
            )
        {
            _questionnaireService = questionnaireService;
            _navigationService    = navigationService;
            _graphFactory         = graphSelector;
            _config          = config;
            _employeeService = employeeService;
            SelectedFestival = festivalService.GetFestival((int)navigationService.Parameter);

            GeneratePdfCommand = new RelayCommand(SavePdf);
            BackCommand        = new RelayCommand(Back);

            GenerateReport();
        }
Exemple #11
0
        public FestivalViewModel(IFrameNavigationService navigationService, IFestivalService festivalService,
                                 IQuestionnaireService questionnaireService, IInspectionService inspectionService,
                                 IOfflineService offlineService)
        {
            _festivalService      = festivalService;
            _navigationService    = navigationService;
            _questionnaireService = questionnaireService;
            _inspectionService    = inspectionService;

            RemoveFestivalCommand = new RelayCommand(OpenDeletePopup, () => offlineService.IsOnline, true);
            DeleteCommand         = new RelayCommand(RemoveFestival, () => offlineService.IsOnline, true);
            EditFestivalCommand   = new RelayCommand(() => _navigationService.NavigateTo("UpdateFestival", Festival.Id),
                                                     () => offlineService.IsOnline, true);
            OpenQuestionnaireCommand          = new RelayCommand <int>(OpenQuestionnaire);
            CreateQuestionnaireCommand        = new RelayCommand(CreateQuestionnaire, () => offlineService.IsOnline, true);
            ConfirmDeleteQuestionnaireCommand =
                new RelayCommand(DeleteQuestionnaire, () => offlineService.IsOnline, true);
            DeleteQuestionnaireCommand =
                new RelayCommand <int>(id => _deletetingQuestionnareId = id, _ => offlineService.IsOnline, true);
            NewQuestionnaireCommand       = new RelayCommand(NewQuestionnaire);
            OpenCopyQuestionnaireCommand  = new RelayCommand <int>(OpenCopyQuestionnaire);
            CloseCopyQuestionnaireCommand = new RelayCommand(CloseCopyQuestionnaire);
            CopyQuestionnaireCommand      = new RelayCommand(CopyQuestionnaire);
            GenerateReportCommand         = new RelayCommand(GenerateReport);
            EditPlannedInspectionCommand  = new RelayCommand <List <PlannedInspection> >(plannedInspections =>
                                                                                         _navigationService.NavigateTo("Inspection",
                                                                                                                       new { PlannedInspectionId = plannedInspections[0].Id, FestivalId = -1 }),
                                                                                         _ => offlineService.IsOnline, true);
            CreatePlannedInspectionCommand =
                new RelayCommand(
                    () => _navigationService.NavigateTo("Inspection",
                                                        new { PlannedInspectionId = -1, FestivalId = Festival.Id }), () => offlineService.IsOnline,
                    true);

            CanEdit = offlineService.IsOnline;

            Initialize((int)_navigationService.Parameter);
        }
Exemple #12
0
 public ClientCtrl(IFestivalService s)
 {
     server      = s;
     currentUser = null;
 }
Exemple #13
0
 public FestivalController(IFestivalService festivalService)
 {
     _festivalService = festivalService;
 }
Exemple #14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbWork"></param>
 /// <param name="festivalService"></param>
 public FestivalController(IUnitOfWork dbWork, IFestivalService festivalService)
 {
     _festivalService = festivalService;
     _db = dbWork;
 }
 public GroupService(ApplicationDbContext context, IFestivalService festivalService)
 {
     _context         = context;
     _festivalService = festivalService;
 }
 public MyConcurrentServer(string host, int port, IFestivalService serv) : base(host, port)
 {
     server = serv;
 }
 public FestivalController(IMapper mapper, IFestivalService festivalService)
 {
     _mapper          = mapper;
     _festivalService = festivalService;
 }