Ejemplo n.º 1
0
        private ActionViewModel GetPageViewModel(string viewName, dynamic viewData = null)
        {
            ActionViewModel pageViewModel = null;

            switch (viewName)
            {
            case "index":
            {
                pageViewModel = new ActionViewModel(
                    title: _moduleLocalizer["Register"],
                    module: "Admin",
                    viewLayout: "_LayoutBlank",
                    resourceDictionary: new Dictionary <string, string>
                    {
                        { "loginBtnLabel", _moduleLocalizer["Login"] },
                        { "successMessageTitle", _moduleLocalizer["Congratulations"] },
                        { "successMessage", _moduleLocalizer["Registration has been successfully completed, click button below to login with your account."] }
                    }
                    );

                var formViewModel = new FormViewModel(
                    title: _moduleLocalizer["Register"],
                    description: _moduleLocalizer["Create your account"]);

                formViewModel.GenerateFields(new RegisterViewModel());

                pageViewModel.AddForm(
                    formViewModel: formViewModel,
                    formName: "default"
                    );
                break;
            }
            }
            return(pageViewModel);
        }
Ejemplo n.º 2
0
        public void Add(AddActionViewModel clientActionViewModel, Guid clientId)
        {
            ActionViewModel lastNavigation = null;

            if (clientActionViewModel.ActionType == Misc.Common.Enums.ClientActionType.PageNavigation)
            {
                var action = _actionRepository.GetLastClientPageNavigation(clientId);
                if (action != null)
                {
                    lastNavigation = Mapper.Map(_actionRepository.GetLastClientPageNavigation(clientId));
                }
            }
            var entity = Mapper.Map(clientActionViewModel, clientId);

            _actionRepository.Add(entity);
            var currentNavigation = Mapper.Map(entity);

            if (entity.ActionType == Misc.Common.Enums.ClientActionType.PageNavigation)
            {
                var spentSeconds = CalculateSecondsSpentOnPage(lastNavigation, currentNavigation);
                if (spentSeconds == 0)
                {
                    return;
                }
                _timeOnPageRepository.Add(new DAL.Entities.TimeOnPage()
                {
                    SecondsSpent = spentSeconds,
                    Page         = lastNavigation.Url
                });
            }
        }
Ejemplo n.º 3
0
        public IActionResult Action(decimal id, ActionViewModel actionViewModel)
        {
            Groep groep = _groepRepository.GetById(id);

            if (groep == null)
            {
                return(NotFound());
            }

            Pad pad = groep.getCurrentGroepPad(groep.Progress).Paden;

            if (pad.Toegangscode.Code == actionViewModel.Toegangscode)
            {
                groep.VerhoogProgress();

                _groepRepository.SaveChanges();

                return(RedirectToAction("Start", "Groep", new { Id = groep.Id }));
            }
            else
            {
                if (groep.Fout == 3)
                {
                    groep.Blok();
                }
                else
                {
                    groep.VerhoogFout();
                }
            }

            return(View(new ActionViewModel(pad, groep, false)));
        }
        public ActionViewModel Get(long id)
        {
            ActionDto       actionDto       = actionAppService.Get(id);
            ActionViewModel actionViewModel = this.mapper.Map <ActionViewModel>(actionDto);

            return(actionViewModel);
        }
Ejemplo n.º 5
0
        //Constructeur quand on a double cliquer sur le tablea de bord, on récupère l'id de l'action associée pour la modifier
        public Action(int id)
        {
            InitializeComponent();
            _actionController = new ActionViewModel(id);

            this.DataContext = _actionController;
        }
Ejemplo n.º 6
0
 public GitFlowActionSection()
 {
     Title     = "Recommended actions";
     IsVisible = false;
     model     = new ActionViewModel(this);
     UpdateVisibleState();
 }
Ejemplo n.º 7
0
        public void CtorTest()
        {
            var action = new ActionViewModel();

            action = new ActionViewModel(() => action = null);
            action = new ActionViewModel(() => action = null, () => action != null);
        }
Ejemplo n.º 8
0
        public async Task <ServiceResult <int> > Get(ClaimsPrincipal user, int groupId, int actionId)
        {
            var group = groupsRepository.Get(groupId);

            if (group is null)
            {
                return(ServiceResult <int> .Error(404, "Group was not found"));
            }

            var authorizationResult = await authorizationService.AuthorizeAsync(user, group, GroupOperations.Write);

            if (!authorizationResult.Succeeded)
            {
                return(ServiceResult <int> .Error(401, "Unauthorized"));
            }


            var action = actionsRepository.Get(actionId);

            if (action is null || action.GroupId != groupId)
            {
                return(ServiceResult <int> .Error(404, "Action was not found"));
            }
            return(ServiceResult <int> .Success(ActionViewModel.FromModel(action)));
        }
Ejemplo n.º 9
0
        public static ActionViewModel GetActionViewModel()
        {
            IEnumerable <ContactEntry> contact = new List <ContactEntry>()
            {
                new ContactEntry()
                {
                    Id = 1, FullName = "Unit-test"
                }
            };
            IEnumerable <TagViewModel> tag = new List <TagViewModel>()
            {
                new TagViewModel()
                {
                    TagID = 1001
                }
            };
            ActionViewModel actionViewModel = new ActionViewModel();

            actionViewModel.ActionMessage = "Sample";
            actionViewModel.Contacts      = contact;
            actionViewModel.TagsList      = tag;
            actionViewModel.ReminderTypes = new List <dynamic>()
            {
                ReminderType.Email
            };
            actionViewModel.RemindOn = DateTime.Now.AddDays(1);
            return(actionViewModel);
        }
Ejemplo n.º 10
0
        public void ExecuteTest()
        {
            var actionExecuted = false;
            var action         = new ActionViewModel(() => actionExecuted = true);

            action.Execute();
            Assert.True(actionExecuted);
        }
Ejemplo n.º 11
0
        private static void TestProperty <TProp>(Func <ActionViewModel, TProp> getProperty, Action <ActionViewModel, TProp> setProperty, TProp testValue)
        {
            var action = new ActionViewModel();

            setProperty(action, testValue);

            Assert.Equal(testValue, getProperty(action));
        }
Ejemplo n.º 12
0
        public ActionListPage()
        {
            InitializeComponent();

            this.Title = PageResources.DefaultPageTitle;

            vm = new ActionViewModel();
            this.BindingContext = vm;
        }
 public void DoRemoveFaceRecognizedAction(ActionViewModel actionViewModel)
 {
     _logger.Info("DoRemoveFaceRecognizedAction() called");
     if (actionViewModel != null)
     {
         FaceRecognizedActions.Remove(actionViewModel);
         _logger.Info($"DoRemoveFaceRecognizedAction() removed {actionViewModel?.ToString()}");
     }
 }
Ejemplo n.º 14
0
        public HttpResponseMessage PostAction(ActionViewModel viewModel)
        {
            InsertActionResponse response = actionService.InsertAction(new InsertActionRequest()
            {
                ActionViewModel = viewModel
            });

            return(Request.BuildResponse(response));
        }
 public void DoRemoveStartupAction(ActionViewModel actionViewModel)
 {
     _logger.Info("DoRemoveStartupAction() called");
     if (actionViewModel != null)
     {
         StartupActions.Remove(actionViewModel);
         _logger.Info($"DoRemoveStartupAction() removed {actionViewModel?.ToString()}");
     }
 }
Ejemplo n.º 16
0
        public HttpResponseMessage PutAction(ActionViewModel viewModel)
        {
            UpdateActionResponse response = actionService.UpdateAction(new UpdateActionRequest()
            {
                ActionViewModel = viewModel
            });

            return(Request.BuildResponse(response));
        }
Ejemplo n.º 17
0
        public void Execute_WithAction_IsExecuted()
        {
            var text = string.Empty;

            var action = new ActionViewModel <string>(parameter => text += parameter);

            action.Execute("1234");

            Assert.Equal("1234", text);
        }
Ejemplo n.º 18
0
        public void Execute_WithCommand_ExecuteIsCalled()
        {
            var command = A.Fake <ICommand>();

            var action = new ActionViewModel <string>(command);

            action.Execute("1234");

            A.CallTo(() => command.Execute("1234")).MustHaveHappenedOnceExactly();
        }
Ejemplo n.º 19
0
        public void Execute_CanExecuteIsFalse_IsNotExecuted()
        {
            var text = string.Empty;

            var action = new ActionViewModel <string>(parameter => text += parameter, _ => false);

            action.Execute("1234");

            Assert.Equal(string.Empty, text);
        }
Ejemplo n.º 20
0
 protected virtual void InitViewModels()
 {
     ActionsViewModel          = new ActionsViewModel(BaseLayer, ActionErrorCatcher);
     ActionViewModel           = new ActionViewModel(CreateActionTemplate(), ActionsViewModel, ActionErrorCatcher);
     EventsViewModel           = new EventsViewModel(BaseLayer, EventErrorCatcher);
     EventViewModel            = new EventViewModel(CreateEventTemplate(), EventsViewModel, EventErrorCatcher);
     TaskParamsViewModel       = new TaskParamsViewModel(BaseLayer, TaskParamErrorCatcher);
     EventsDepActionsViewModel = new EventsDepActionsViewModel(BaseLayer, EventErrorCatcher);
     EventDepActionViewModel   = new EventDepActionViewModel(BaseLayer, CreateEventTemplate(), EventsDepActionsViewModel, EventErrorCatcher);
 }
Ejemplo n.º 21
0
 public GitFlowActionSection()
 {
     Title     = "Recommended actions";
     IsVisible = false;
     if (GitFlowPage.ActiveRepoPath != null)
     {
         model = new ActionViewModel(this);
     }
     UpdateVisibleState();
 }
Ejemplo n.º 22
0
        public void ActionAutoMap_ViewModelToEntity_SuccessfulMap()
        {
            ActionViewModel viewModel = ActionMockData.GetActionViewModel();

            DA.Action action = Mapper.Map <ActionViewModel, DA.Action>(viewModel);

            Assert.AreEqual(action.Id, viewModel.ActionId);
            Assert.AreEqual(action.Details, viewModel.ActionMessage);
            Assert.AreEqual(action.Contacts.Count, viewModel.Contacts.Count());
        }
Ejemplo n.º 23
0
        private void ListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ActionViewModel action = (ActionViewModel)e.ClickedItem;

            localSettings.Values[Settings.ACTIONID]     = action.Action.Id;
            localSettings.Values[Settings.ACTIONACTION] = Settings.Actions.EDIT;
            localSettings.Values[Settings.JOBNAME]      = JobName;
            localSettings.Values[Settings.JOBCRON]      = JobCron;
            Frame.Navigate(typeof(ActionPage), action.Action.Id);
        }
Ejemplo n.º 24
0
        public async Task <IActionResult> Create([FromBody] ActionViewModel action)
        {
            if (action == null)
            {
                return(BadRequest());
            }

            var id = await _service.Add(action);

            return(Created($"api/User/{id}", id));  //HTTP201 Resource created
        }
Ejemplo n.º 25
0
        public virtual ActionResult Update(long id, string lang = null)
        {
            var actionViewModel = new ActionViewModel(
                parameters: new Dictionary <string, object>
            {
                { "id", id },
                { "lang", lang }
            });

            return(View(actionViewModel));
        }
Ejemplo n.º 26
0
        public void UpdateAction_ValidAction_Succeed()
        {
            ActionViewModel actionViewModel = ActionMockData.GetActionViewModel();

            mockActionRepository.Setup(a => a.Update(new DA.Action())).Verifiable("Unable to delete Action");
            UpdateActionResponse response = actionService.UpdateAction(new UpdateActionRequest()
            {
                ActionViewModel = actionViewModel
            });

            mockRepository.VerifyAll();
        }
Ejemplo n.º 27
0
        public override ActionResult Create()
        {
            var entityTypeId = long.Parse(HttpContext.Request.Query["entityTypeId"][0]);

            var actionViewModel = new ActionViewModel(
                parameters: new Dictionary <string, object>
            {
                { "entityTypeId", entityTypeId }
            });

            return(View(actionViewModel));
        }
Ejemplo n.º 28
0
        private void LoadActions()
        {
            var addNewForm = (ActionViewModel)ActionViewModel.Clone();

            HeaderViewModel.AddNewForm       = addNewForm;
            HeaderViewModel.AddNewForm.Title = Constants.NewRequest;

            var returnForm = (ActionViewModel)ActionViewModel.Clone();

            HeaderViewModel.ReturnAction       = returnForm;
            HeaderViewModel.ReturnAction.Title = Constants.ReturnAction;
        }
Ejemplo n.º 29
0
        public static ActionViewModel FillAction(int id, DescriptionActionAttribute description)
        {
            var result = new ActionViewModel()
            {
                Id             = id,
                Compatibilitys = description.Compatibilitys,
                Description    = description.Description,
                Service        = description.Service
            };

            return(result);
        }
Ejemplo n.º 30
0
        public void ActionStatus_Completed_Succeed()
        {
            ActionViewModel actionViewModel = ActionMockData.GetActionViewModel();

            mockActionRepository.Setup(a => a.ActionCompleted(It.IsAny <int>(), It.IsAny <bool>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>(), It.IsAny <int>(), It.IsAny <DateTime>(), It.IsAny <bool>(), It.IsAny <int>())).Verifiable("Unable to call Actioncompleted method");
            CompletedActionResponse response = actionService.ActionStatus(new CompletedActionRequest()
            {
                actionId = ACTION_ID, contactId = CONTACT_ID, isCompleted = true
            });

            mockRepository.VerifyAll();
            Assert.AreEqual(null, response.Exception);
        }