Esempio n. 1
0
        public void Should_Success_Instantiate()
        {
            List <StepIndicatorViewModel> stepIndicators = new List <StepIndicatorViewModel>()
            {
                new StepIndicatorViewModel()
            };

            StepViewModel viewModel = new StepViewModel()
            {
                Code              = "Code",
                UId               = "UId",
                Alias             = "Alias",
                Process           = "Process",
                ProcessArea       = "ProcessArea",
                StepIndicators    = stepIndicators,
                LastModifiedBy    = "someone",
                CreatedBy         = "someone",
                LastModifiedAgent = "someone"
            };

            Assert.Equal("Code", viewModel.Code);
            Assert.Equal("UId", viewModel.UId);
            Assert.Equal("Alias", viewModel.Alias);
            Assert.Equal("ProcessArea", viewModel.ProcessArea);
            Assert.Equal(stepIndicators, viewModel.StepIndicators);
        }
		public GetJournalItemStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			GetJournalItemStep = (GetJournalItemStep)stepViewModel.Step;
			ResultArgument = new ArgumentViewModel(GetJournalItemStep.ResultArgument, stepViewModel.Update, UpdateContent, false);
			JournalColumnTypes = AutomationHelper.GetEnumObs<JournalColumnType>();
		}
Esempio n. 3
0
        public void validate_default()
        {
            StepViewModel viewModel = new StepViewModel();
            var           result    = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
Esempio n. 4
0
        public ActionResult Index(StepViewModel viewModel, string formID, int versionID, int stepNumber)
        {
            MergeConfigurationToStepViewModel(viewModel, stepNumber);
            MapToApplication(viewModel.Step);
            Validate(viewModel);

            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            SaveApplication(viewModel);

            if (viewModel.ActionType == ButtonActionType.Next)
            {
                return(RedirectToAction("Index", new { formID, versionID, stepNumber = stepNumber + 1, id = ApplicationFormContext.Application.ID }));
            }

            if (viewModel.ActionType == ButtonActionType.Previous)
            {
                return(RedirectToAction("Index", new { formID, versionID, stepNumber = stepNumber - 1, id = ApplicationFormContext.Application.ID }));
            }

            return(RedirectToAction("ThankYou", new { formID, versionID, id = ApplicationFormContext.Application.ID }));
        }
		public ExportOrganisationListStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ExportOrganisationListStep = (ExportOrganisationListStep)stepViewModel.Step;
			IsWithDeleted = new ArgumentViewModel(ExportOrganisationListStep.IsWithDeleted, stepViewModel.Update, UpdateContent);
			PathArgument = new ArgumentViewModel(ExportOrganisationListStep.PathArgument, stepViewModel.Update, UpdateContent);
		}
Esempio n. 6
0
        public async Task CannotEditStepWithModelErrors()
        {
            TestTrekStoriesContext tc = new TestTrekStoriesContext();
            Step step = new Step
            {
                StepId = 123,
                Trip   = new Trip {
                    TripId = 111, TripOwner = "ABC123"
                }
            };

            tc.Steps.Add(step);
            StepViewModel stepVm = new StepViewModel {
                StepId = 123, TripId = 111
            };

            var controller = new StepController(tc).WithAuthenticatedUser("ABC123");

            controller.ModelState.AddModelError("", "Error");

            var result = await controller.Edit(stepVm) as ViewResult;

            Assert.AreEqual("", result.ViewName);
            Assert.AreEqual(false, result.ViewData.ModelState.IsValid);
            Assert.IsNotNull(result.ViewData.ModelState[""].Errors);
        }
Esempio n. 7
0
        public async Task <IEnumerable <RecipeViewModel> > GetRecipes()
        {
            List <RecipeViewModel> recipes = new List <RecipeViewModel>();
            var result = await _recipeRepo.ListAllAsync();

            foreach (Recipe recipe in result)
            {
                RecipeViewModel recipeViewModel = new RecipeViewModel();
                recipeViewModel.Id              = recipe.Id;
                recipeViewModel.Name            = recipe.Name;
                recipeViewModel.NumberOfPersons = recipe.NumberOfPersons;
                var stepresult = _stepRepository.GetByRecipeId(recipe.Id);
                foreach (Step step in stepresult)
                {
                    StepViewModel localstep = new StepViewModel();
                    localstep.Id          = step.Id;
                    localstep.Description = step.Description;
                    localstep.Number      = step.Number;
                    recipeViewModel.Steps.Add(localstep);
                }

                var ingredientresult = _ingredientRepository.GetByRecipeId(recipe.Id);
                foreach (Ingredient item in ingredientresult)
                {
                    IngredientViewModel localIngredient = new IngredientViewModel();
                    localIngredient.Id   = item.Id;
                    localIngredient.Name = item.Name;
                    recipeViewModel.Ingredients.Add(localIngredient);
                }

                recipes.Add(recipeViewModel);
            }
            return(recipes);
        }
Esempio n. 8
0
		public RviAlarmStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			RviAlarmStep = (RviAlarmStep)stepViewModel.Step;
			NameArgument = new ArgumentViewModel(RviAlarmStep.NameArgument, stepViewModel.Update, null);
			NameArgument.ExplicitValue.MinIntValue = 0;
		}
Esempio n. 9
0
		public StopRecordStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			StopRecordStep = (StopRecordStep)stepViewModel.Step;
			EventUIDArgument = new ArgumentViewModel(StopRecordStep.EventUIDArgument, stepViewModel.Update, UpdateContent, false);
			CameraArgument = new ArgumentViewModel(StopRecordStep.CameraArgument, stepViewModel.Update, null);
		}
Esempio n. 10
0
        public IActionResult ShowStep(int id)
        {
            var stepViewModel = new StepViewModel();

            stepViewModel.SetAllParams(db, id);
            return(View("Step", stepViewModel));
        }
Esempio n. 11
0
        /// <summary>
        /// Searches a step of a recipe
        /// </summary>
        /// <param name="recipeId">Id of the owning Recipe</param>
        /// <param name="stepId">Id of a step</param>
        /// <param name="direction">To provide navigation you define if the step of the given id or one of its neighbors</param>
        /// <returns>Returns one step of a recipe</returns>
        public async Task <StepViewModel> GetStepAsync(int recipeId, int stepId = -1, StepDirection direction = StepDirection.ThisStep)
        {
            StepViewModel result = null;
            var           steps  = await this.GetStepsForRecipe(recipeId).ToListAsync();

            var step = stepId == -1 ? steps.FirstOrDefault() : steps.SingleOrDefault(x => x.Id.Equals(stepId));

            if (step == null)
            {
                var message = stepId == -1 ? $"Recipe {recipeId} does not define any steps" : $"No step with the id {stepId} was found";
                throw new DataObjectNotFoundException(message);
            }
            var stepIndex = steps.IndexOf(step);

            switch (direction)
            {
            case StepDirection.ThisStep:
                result = step;
                break;

            case StepDirection.Next:
                result = steps.ElementAtOrDefault(stepIndex + 1) ?? steps.Last();
                break;

            case StepDirection.Previous:
                result = steps.ElementAtOrDefault(stepIndex - 1) ?? steps.First();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
            }
            return(result);
        }
Esempio n. 12
0
        public async Task <StepViewModel> SavePlaceCalendar([FromBody] StepViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var session = await _sessionProvider.Get();

                    EventStepCommandResult eventStepCommandResult = await _commandSender.Send <EventStepCommand, EventStepCommandResult>(new EventStepCommand
                    {
                        EventId     = model.EventId,
                        CurrentStep = model.CurrentStep,
                        ModifiedBy  = session.User != null ? session.User.AltId : Guid.Parse("7390283B-4A32-4860-BA3D-B57F1E5F2DAC"),
                    });

                    return(new StepViewModel
                    {
                        CompletedStep = eventStepCommandResult.CompletedStep,
                        CurrentStep = eventStepCommandResult.CurrentStep,
                        EventId = model.EventId,
                        Success = eventStepCommandResult.Success
                    });
                }
                catch (Exception e)
                {
                    return(new StepViewModel {
                    });
                }
            }
            else
            {
                return(new StepViewModel {
                });
            }
        }
Esempio n. 13
0
        public async Task CanEditPostStep()
        {
            TestTrekStoriesContext tc = new TestTrekStoriesContext();
            Trip trip = new Trip {
                TripId = 111, TripOwner = "ABC123"
            };

            tc.Trips.Add(trip);
            Step step = new Step
            {
                StepId = 123,
                TripId = 111,
                Trip   = trip
            };

            tc.Steps.Add(step);
            StepViewModel stepVm = new StepViewModel
            {
                StepId             = 123,
                SequenceNo         = 2,
                From               = "B",
                To                 = "C",
                WalkingDistance    = 0,
                WalkingTimeHours   = 2,
                WalkingTimeMinutes = 30,
                TripId             = 111
            };

            var controller = new StepController(tc).WithAuthenticatedUser("ABC123");

            var result = await controller.Edit(stepVm) as RedirectToRouteResult;

            Assert.AreEqual("Details", result.RouteValues["action"]);
        }
Esempio n. 14
0
        private async void Next()
        {
            if (StepViewModel == null)
            {
                return;
            }

            if (StepViewModel.NextAction != null)
            {
                IsBusy = true;

                try
                {
                    var useDefaultBehavior = await StepViewModel.NextAction();

                    if (!useDefaultBehavior)
                    {
                        return;
                    }
                }
                finally
                {
                    IsBusy = false;
                }
            }

            ToNext();
        }
Esempio n. 15
0
        private void Selected_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "StepNumber")
            {
                var eventArgs = e as PropertyChangedExtendedEventArgs <int>;

                var tmp = new StepViewModel(StepItems[eventArgs.OldValue]);
                StepItems.RemoveAt(eventArgs.OldValue);
                StepItems.Insert(eventArgs.NewValue, tmp);

                for (int i = 0; i < StepItems.Count(); i++)
                {
                    StepItems[i].StepNumber = i;
                }

                Selected = StepItems[eventArgs.NewValue];
            }
            if (e.PropertyName == "NewItem")
            {
                var eventArgs = e as PropertyChangedExtendedEventArgs <StepViewModel>;

                if (eventArgs.OldValue.NextStepAvaiable)
                {
                    StepItems.Insert(eventArgs.OldValue.StepNumber, eventArgs.NewValue);
                    Selected = StepItems[eventArgs.OldValue.StepNumber];
                }
                else
                {
                    StepItems.Add(eventArgs.NewValue);
                    Selected = StepItems[StepItems.Count - 1];
                }
                StepViewModel.MaxSteps = StepItems.Count;
                for (int i = 0; i < StepItems.Count(); i++)
                {
                    StepItems[i].StepNumber = i;
                }
            }
            if (e.PropertyName == "RemoveItem")
            {
                var tmp = sender as StepViewModel;

                StepItems.Remove(sender as StepViewModel);
                StepViewModel.MaxSteps = StepItems.Count;
                for (int i = 0; i < StepItems.Count(); i++)
                {
                    StepItems[i].StepNumber = i;
                }


                if (tmp.StepNumber == 1)
                {
                    Selected = StepItems[0];
                }
                else
                {
                    Selected = StepItems[tmp.StepNumber - 2];
                }
            }
            InstructionDataProvider.UpdateData(ConvertToListofSteps(StepItems));
        }
		public IncrementValueStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			IncrementValueStep = (IncrementValueStep)stepViewModel.Step;
			IncrementTypes = AutomationHelper.GetEnumObs<IncrementType>();
			ResultArgument = new ArgumentViewModel(IncrementValueStep.ResultArgument, stepViewModel.Update, null, false);
		}
		public CheckPermissionStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			CheckPermissionStep = (CheckPermissionStep)stepViewModel.Step;
			PermissionArgument = new ArgumentViewModel(CheckPermissionStep.PermissionArgument, stepViewModel.Update, UpdateContent);
			ResultArgument = new ArgumentViewModel(CheckPermissionStep.ResultArgument, stepViewModel.Update, UpdateContent, false);
		}
Esempio n. 18
0
        public static StepViewModel ToWorkflowStepViewModel(Step step)
        {
            var viewModel = new StepViewModel()
            {
                Name        = step.Name,
                Description = step.Description,
                StepId      = step.PlanningWizardStepID,
                StepNo      = step.StepNo,
                StepWeight  = step.StepWeight,
                Notes       = step.Notes,
                Selected    = step.IsSelected,
                PhaseId     = step.PlanningWizardPhaseID
            };

            for (var i = 0; i < step.ActionItems.Count; i++)
            {
                var item = step.ActionItems.ElementAt(i);

                viewModel.ActionItems.Add(new ActionItemViewModel()
                {
                    ActionItemId = item.PlanningWizardActionItemID,
                    StepId       = item.PlanningWizardStepID,
                    Text         = item.ActionItemText,
                    ListNumber   = (i + 1).ToString(),
                    Complete     = item.IsComplete,
                    ResourceHtml = item.ResourcesContent
                });
            }

            return(viewModel);
        }
Esempio n. 19
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method is used to copy/paste a new item.</summary>
        ///
        /// <param name="copyItem">The item to copy/paste.</param>
        /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param>
        ///--------------------------------------------------------------------------------
        public StepViewModel PasteStep(StepViewModel copyItem, bool savePaste = true)
        {
            Step newItem = new Step();

            newItem.ReverseInstance = new Step();
            newItem.TransformDataFromObject(copyItem.Step, null, false);
            newItem.StepID        = Guid.NewGuid();
            newItem.IsAutoUpdated = false;

            newItem.Stage    = Stage;
            newItem.Solution = Solution;
            StepViewModel newView = new StepViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddStep(newView);

            // paste children
            foreach (StepTransitionViewModel childView in copyItem.StepTransitions)
            {
                newView.PasteStepTransition(childView, savePaste);
            }
            if (savePaste == true)
            {
                Solution.StepList.Add(newItem);
                Stage.StepList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }
Esempio n. 20
0
        // GET: Step/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Step step = await db.Steps.FindAsync(id);

            string nullOrOwnerError = StepNullOrNotOwnedByUserError(step);

            if (nullOrOwnerError != "")
            {
                return(View("CustomisedError", new HandleErrorInfo(new UnauthorizedAccessException(nullOrOwnerError), "Trip", "Index")));
            }
            StepViewModel stepToEdit = new StepViewModel()
            {
                StepId             = step.StepId,
                SequenceNo         = step.SequenceNo,
                From               = step.From,
                To                 = step.To,
                WalkingTimeHours   = (int)step.WalkingTime,
                WalkingTimeMinutes = (int)((step.WalkingTime % 1) * 60),
                WalkingDistance    = step.WalkingDistance,
                Ascent             = step.Ascent,
                Description        = step.Description,
                Notes              = step.Notes,
                TripId             = step.TripId
            };

            return(View(stepToEdit));
        }
		public ControlOpcDaTagStepViewModel(StepViewModel stepViewModel, ControlElementType controlElementType)
			: base(stepViewModel)
		{
			ControlOpcDaTagStep = (ControlOpcDaTagStep)stepViewModel.Step;
			ControlElementType = controlElementType;
			ValueArgument = new ArgumentViewModel(ControlOpcDaTagStep.ValueArgument, stepViewModel.Update, UpdateContent, controlElementType == ControlElementType.Set);
		}
Esempio n. 22
0
		public ShowPropertyStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ShowPropertyStep = (ShowPropertyStep)stepViewModel.Step;
			ObjectArgument = new ArgumentViewModel(ShowPropertyStep.ObjectArgument, stepViewModel.Update, null);
			ObjectTypes = new ObservableCollection<ObjectType>(AutomationHelper.GetEnumList<ObjectType>().FindAll(x => x != ObjectType.Organisation));
			IsServerContext = Procedure.ContextType == ContextType.Server;
		}
		public GetObjectPropertyStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			GetObjectPropertyStep = (GetObjectPropertyStep)stepViewModel.Step;
			ObjectArgument = new ArgumentViewModel(GetObjectPropertyStep.ObjectArgument, stepViewModel.Update, UpdateContent);
			ObjectTypes = AutomationHelper.GetEnumObs<ObjectType>();
			ResultArgument = new ArgumentViewModel(GetObjectPropertyStep.ResultArgument, stepViewModel.Update, UpdateContent, false);
		}
Esempio n. 24
0
		public PauseStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			PauseStep = (PauseStep)stepViewModel.Step;
			TimeTypes = AutomationHelper.GetEnumObs<TimeType>();
			PauseArgument = new ArgumentViewModel(PauseStep.PauseArgument, stepViewModel.Update, null);
			PauseArgument.ExplicitValue.MinIntValue = 0;
		}
Esempio n. 25
0
        public IActionResult Add()
        {
            StepViewModel ListOfWorkFlow = _stepService.getAllWorkFlow();

            ViewBag.ListOfWorkFlow = ListOfWorkFlow.workFlows.ToList();

            return(PartialView("_add"));
        }
Esempio n. 26
0
        public IActionResult Post(StepViewModel data)
        {
            data.Completed = false;
            var content = JsonConvert.SerializeObject(data);

            http.PostAsync("http://localhost:62021/api/step", new StringContent(content, Encoding.UTF8, "application/json"));
            return(Redirect("/step"));
        }
		public ControlPumpStationStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ControlPumpStationStep = (ControlPumpStationStep)stepViewModel.Step;
			Commands = AutomationHelper.GetEnumObs<PumpStationCommandType>();
			PumpStationArgument = new ArgumentViewModel(ControlPumpStationStep.PumpStationArgument, stepViewModel.Update, null);
			SelectedCommand = ControlPumpStationStep.PumpStationCommandType;
		}
Esempio n. 28
0
		public GetListCountStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			GetListCountStep = (GetListCountStep)stepViewModel.Step;
			ListArgument = new ArgumentViewModel(GetListCountStep.ListArgument, stepViewModel.Update, UpdateContent, false);
			CountArgument = new ArgumentViewModel(GetListCountStep.CountArgument, stepViewModel.Update, UpdateContent, false);
			CountArgument.ExplicitType = ExplicitType.Integer;
		}
Esempio n. 29
0
		public RandomStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			RandomStep = (RandomStep)stepViewModel.Step;
			MaxValueArgument = new ArgumentViewModel(RandomStep.MaxValueArgument, stepViewModel.Update, UpdateContent);
			MaxValueArgument.ExplicitValue.MinIntValue = 1;
			ResultArgument = new ArgumentViewModel(RandomStep.ResultArgument, stepViewModel.Update, UpdateContent, false);
		}
		public ControlGKFireZoneStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ControlGKFireZoneStep = (ControlGKFireZoneStep)stepViewModel.Step;
			Commands = AutomationHelper.GetEnumObs<ZoneCommandType>();
			GKFireZoneArgument = new ArgumentViewModel(ControlGKFireZoneStep.GKFireZoneArgument, stepViewModel.Update, null);
			SelectedCommand = ControlGKFireZoneStep.ZoneCommandType;
		}
Esempio n. 31
0
		public ForeachStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ForeachStep = (ForeachStep)stepViewModel.Step;
			ListArgument = new ArgumentViewModel(ForeachStep.ListArgument, stepViewModel.Update, UpdateContent, false);
			ListArgument.UpdateVariableHandler += UpdateItemVariable;
			ItemArgument = new ArgumentViewModel(ForeachStep.ItemArgument, stepViewModel.Update, UpdateContent, false);
		}
Esempio n. 32
0
		public ControlDelayStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ControlDelayStep = (ControlDelayStep)stepViewModel.Step;
			Commands = AutomationHelper.GetEnumObs<DelayCommandType>();
			DelayArgument = new ArgumentViewModel(ControlDelayStep.DelayArgument, stepViewModel.Update, null);
			SelectedCommand = ControlDelayStep.DelayCommandType;
		}
Esempio n. 33
0
		public RunProgramStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{

			RunProgramStep = (RunProgramStep)stepViewModel.Step;
			PathArgument = new ArgumentViewModel(RunProgramStep.PathArgument, stepViewModel.Update, UpdateContent);
			ParametersArgument = new ArgumentViewModel(RunProgramStep.ParametersArgument, stepViewModel.Update, UpdateContent);
		}
		public ControlVisualStepViewModel(StepViewModel stepViewModel, ControlElementType controlElementType)
			: base(stepViewModel)
		{
			ControlVisualStep = (ControlVisualStep)stepViewModel.Step;
			ControlElementType = controlElementType;
			IsServerContext = Procedure.ContextType == ContextType.Server;
			ValueArgument = new ArgumentViewModel(ControlVisualStep.Argument, stepViewModel.Update, UpdateContent, controlElementType == ControlElementType.Set);
		}
Esempio n. 35
0
        public async Task <IActionResult> Index(int stepNumber)
        {
            var model = new StepViewModel();

            await PageSetup(model, stepNumber);

            return(View(model));
        }
Esempio n. 36
0
        public async Task <ActionResult> Create(StepViewModel stepViewModel)
        {
            try
            {
                await CheckTripNotNullOrNonOwner(stepViewModel.TripId);
            }
            catch (UnauthorizedAccessException ex)
            {
                return(View("CustomisedError", new HandleErrorInfo(ex, "Trip", "Index")));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    Step newStep = new Step()
                    {
                        SequenceNo      = stepViewModel.SequenceNo,
                        From            = stepViewModel.From,
                        To              = stepViewModel.To,
                        WalkingTime     = stepViewModel.WalkingTimeHours + stepViewModel.WalkingTimeMinutes / 60.0,
                        WalkingDistance = stepViewModel.WalkingDistance,
                        Ascent          = stepViewModel.Ascent,
                        Description     = stepViewModel.Description,
                        Notes           = stepViewModel.Notes,
                        TripId          = stepViewModel.TripId
                    };
                    //retrieve all subsequent steps and update seq no
                    foreach (Step item in db.Steps.Where(s => s.TripId == newStep.TripId && s.SequenceNo >= newStep.SequenceNo))
                    {
                        item.SequenceNo++;
                    }

                    db.Steps.Add(newStep);
                    await db.SaveChangesAsync();

                    //retrieve all steps where seq no >= to new step.seq no in an array including new step and assign accommodation of previous step for that seq no
                    Step[] subsequentSteps = await db.Steps.Where(s => s.TripId == newStep.TripId && s.SequenceNo >= newStep.SequenceNo).OrderBy(s => s.SequenceNo).ToArrayAsync();

                    for (int i = 0; i < subsequentSteps.Length - 1; i++)
                    {
                        subsequentSteps[i].AccommodationId = subsequentSteps[i + 1].AccommodationId;
                    }
                    //set last one to null
                    subsequentSteps[subsequentSteps.Length - 1].AccommodationId = null;

                    await db.SaveChangesAsync();

                    return(RedirectToAction("Details", new { id = newStep.StepId }));
                }
            }
            catch (RetryLimitExceededException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, contact the system administrator.");
            }
            ViewBag.SeqNo = stepViewModel.SequenceNo;
            return(View(stepViewModel));
        }
		public ExportConfigurationStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ExportConfigurationStep = (ExportConfigurationStep)stepViewModel.Step;
			IsExportDevices = new ArgumentViewModel(ExportConfigurationStep.IsExportDevices, stepViewModel.Update, UpdateContent);
			IsExportZones = new ArgumentViewModel(ExportConfigurationStep.IsExportZones, stepViewModel.Update, UpdateContent);
			IsExportDoors = new ArgumentViewModel(ExportConfigurationStep.IsExportDoors, stepViewModel.Update, UpdateContent);
			PathArgument = new ArgumentViewModel(ExportConfigurationStep.PathArgument, stepViewModel.Update, UpdateContent);
		}
Esempio n. 38
0
		public ShowDialogStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ShowDialogStep = (ShowDialogStep)stepViewModel.Step;
			IsServerContext = Procedure.ContextType == ContextType.Server;
			WindowUIDArgument = new ArgumentViewModel(ShowDialogStep.WindowIDArgument, stepViewModel.Update, UpdateContent);
			ProcedureLayoutCollectionViewModel = new ProcedureLayoutCollectionViewModel(ShowDialogStep.LayoutFilter);
			IsServerContext = Procedure.ContextType == ContextType.Server;
		}
Esempio n. 39
0
		public HttpRequestStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			HttpRequestStep = (HttpRequestStep)stepViewModel.Step;
			UrlArgument = new ArgumentViewModel(HttpRequestStep.UrlArgument, stepViewModel.Update, UpdateContent);
			ContentArgument = new ArgumentViewModel(HttpRequestStep.ContentArgument, stepViewModel.Update, UpdateContent);
			ResponseArgument = new ArgumentViewModel(HttpRequestStep.ResponseArgument, stepViewModel.Update, UpdateContent, false);
			HttpMethods = AutomationHelper.GetEnumObs<HttpMethod>();
		}
Esempio n. 40
0
        private void SaveApplication(StepViewModel viewModel)
        {
            if (viewModel.ActionType == ButtonActionType.Submit)
            {
                this.submitApplicationTransition.Execute(ApplicationFormContext);
            }

            applicationRepository.SaveApplication(ApplicationFormContext.Application);
        }
Esempio n. 41
0
		public PtzStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			PtzStep = (PtzStep)stepViewModel.Step;
			CameraArgument = new ArgumentViewModel(PtzStep.CameraArgument, stepViewModel.Update, null);
			PtzNumberArgument = new ArgumentViewModel(PtzStep.PtzNumberArgument, stepViewModel.Update, null);
			PtzNumberArgument.ExplicitValue.MinIntValue = 1;
			PtzNumberArgument.ExplicitValue.MaxIntValue = 100;
		}
Esempio n. 42
0
		public ChangeListStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ChangeListStep = (ChangeListStep)stepViewModel.Step;
			ListArgument = new ArgumentViewModel(ChangeListStep.ListArgument, stepViewModel.Update, UpdateContent, false);
			ListArgument.UpdateVariableHandler = UpdateItemArgument;
			ItemArgument = new ArgumentViewModel(ChangeListStep.ItemArgument, stepViewModel.Update, UpdateContent);
			ChangeTypes = AutomationHelper.GetEnumObs<ChangeType>();
		}
Esempio n. 43
0
		public JournalStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			JournalStep = (JournalStep)stepViewModel.Step;
			MessageArgument = new ArgumentViewModel(JournalStep.MessageArgument, stepViewModel.Update, null);
			ExplicitTypes = new ObservableCollection<ExplicitType>(AutomationHelper.GetEnumList<ExplicitType>());
			EnumTypes = AutomationHelper.GetEnumObs<EnumType>();
			ObjectTypes = AutomationHelper.GetEnumObs<ObjectType>();
		}
Esempio n. 44
0
        public async Task <IActionResult> Index(int stepNumber)
        {
            var model = new StepViewModel
            {
                Content = await understandMySelfService.GetStepDetails(stepNumber, GetSessionId)
            };

            return(View(model));
        }
Esempio n. 45
0
        public ActionResult CreateWizard([Bind(Include = "Id,Title,Step1,Step2,Step3")] WizardViewModel wizardViewModel, HttpPostedFileBase File1, HttpPostedFileBase File2, HttpPostedFileBase File3)
        {
            if (ModelState.IsValid)
            {
                Wizard wizard = new Wizard(wizardViewModel.Title);
                if ((File1 != null && File1.ContentLength > 0) &&
                    (File2 != null && File2.ContentLength > 0) &&
                    (File3 != null && File3.ContentLength > 0))
                {
                    var f1 = new StepViewModel
                    {
                        ImageType = File1.ContentType
                    };
                    var f2 = new StepViewModel
                    {
                        ImageType = File2.ContentType
                    };
                    var f3 = new StepViewModel
                    {
                        ImageType = File3.ContentType
                    };
                    using (var reader1 = new BinaryReader(File1.InputStream))
                    {
                        f1.ImageContent = reader1.ReadBytes(File1.ContentLength);
                    }
                    using (var reader2 = new BinaryReader(File2.InputStream))
                    {
                        f2.ImageContent = reader2.ReadBytes(File2.ContentLength);
                    }
                    using (var reader3 = new BinaryReader(File3.InputStream))
                    {
                        f3.ImageContent = reader3.ReadBytes(File3.ContentLength);
                    }
                    Step s1 = new Step(null, wizardViewModel.Step1, f1.ImageContent, f1.ImageType);
                    Step s2 = new Step(s1, wizardViewModel.Step2, f2.ImageContent, f2.ImageType);
                    Step s3 = new Step(s2, wizardViewModel.Step3, f3.ImageContent, f3.ImageType);

                    ActiveDirectoryReadOnlyRepository ad = new ActiveDirectoryReadOnlyRepository();
                    ActiveDirectoryUser adu = ad.GetUser(HttpContext.User.Identity.Name);

                    User user;
                    user = unitOfWork.UserRepository.GetUserBySamAccountName(HttpContext.User.Identity.Name);
                    if (user == null)
                    {
                        UserName un = new UserName(adu.Name, adu.Surname);
                        user = new User(un, adu.SamAccountName, adu.EmailAddress, "");
                    }

                    wizard.Step     = s1;
                    wizard.CreateBy = user;
                }
                unitOfWork.WizardRepository.Insert(wizard);
                unitOfWork.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            return(View(wizardViewModel));
        }
Esempio n. 46
0
        public async Task <IActionResult> Index()
        {
            var model = new StepViewModel
            {
                Content = await understandMySelfService.GetResults(GetSessionId)
            };

            return(View(model));
        }
Esempio n. 47
0
		public StartRecordStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			StartRecordStep = (StartRecordStep)stepViewModel.Step;
			EventUIDArgument = new ArgumentViewModel(StartRecordStep.EventUIDArgument, stepViewModel.Update, UpdateContent, false);
			TimeoutArgument = new ArgumentViewModel(StartRecordStep.TimeoutArgument, stepViewModel.Update, UpdateContent);
			CameraArgument = new ArgumentViewModel(StartRecordStep.CameraArgument, stepViewModel.Update, null);
			TimeTypes = AutomationHelper.GetEnumObs<TimeType>();
			SelectedTimeType = StartRecordStep.TimeType;
		}
		public ControlGKDeviceStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ControlGkDeviceStep = (ControlGKDeviceStep)stepViewModel.Step;
			GKDeviceArgument = new ArgumentViewModel(ControlGkDeviceStep.GKDeviceArgument, stepViewModel.Update, null);
			GKDeviceArgument.UpdateVariableScopeHandler = Update;
			GKDeviceArgument.ExplicitValue.UpdateObjectHandler += Update;
			Commands = new ObservableCollection<CommandType>();
			Update();
		}
		public ExportJournalStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ExportJournalStep = (ExportJournalStep)stepViewModel.Step;
			IsExportJournalArgument = new ArgumentViewModel(ExportJournalStep.IsExportJournalArgument, stepViewModel.Update, UpdateContent);
			IsExportPassJournalArgument = new ArgumentViewModel(ExportJournalStep.IsExportPassJournalArgument, stepViewModel.Update, UpdateContent);
			MinDateArgument = new ArgumentViewModel(ExportJournalStep.MinDateArgument, stepViewModel.Update, UpdateContent);
			MaxDateArgument = new ArgumentViewModel(ExportJournalStep.MaxDateArgument, stepViewModel.Update, UpdateContent);
			PathArgument = new ArgumentViewModel(ExportJournalStep.PathArgument, stepViewModel.Update, UpdateContent);
		}
Esempio n. 50
0
		public GetListItemStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			GetListItemStep = (GetListItemStep)stepViewModel.Step;
			ListArgument = new ArgumentViewModel(GetListItemStep.ListArgument, stepViewModel.Update, UpdateContent, false);
			ListArgument.UpdateVariableHandler += UpdateItemVariable;
			ItemArgument = new ArgumentViewModel(GetListItemStep.ItemArgument, stepViewModel.Update, UpdateContent, false);
			IndexArgument = new ArgumentViewModel(GetListItemStep.IndexArgument, stepViewModel.Update, UpdateContent);
			PositionTypes = AutomationHelper.GetEnumObs<PositionType>();
		}
Esempio n. 51
0
		public SetValueStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			SetValueStep = (SetValueStep)stepViewModel.Step;
			SourceArgument = new ArgumentViewModel(SetValueStep.SourceArgument, stepViewModel.Update, UpdateContent);
			TargetArgument = new ArgumentViewModel(SetValueStep.TargetArgument, stepViewModel.Update, UpdateContent, false);
			ExplicitTypes = AutomationHelper.GetEnumObs<ExplicitType>();
			EnumTypes = AutomationHelper.GetEnumObs<EnumType>();
			ObjectTypes = AutomationHelper.GetEnumObs<ObjectType>();
			SelectedExplicitType = SetValueStep.ExplicitType;
		}
Esempio n. 52
0
 public static Step FromStepViewModel(StepViewModel viewModel)
 {
     return(new Step()
     {
         PlanningWizardStepID = viewModel.StepId,
         IsSelected = viewModel.Selected,
         Notes = viewModel.Notes,
         StepWeight = viewModel.StepWeight,
         ActionItems = viewModel.ActionItems.Select(FromActionItemViewModel).ToList()
     });
 }
Esempio n. 53
0
        //switches content when button is clicked
        private void NextStepButton_Clicked(object sender, EventArgs e)
        {
            if (NextStepButton.IsEnabled)
            {
                CurrentStep    = Steps[CurrentStep.StepNumber];
                BindingContext = CurrentStep;
                UpdateUI(CurrentStep.StepNumber);
            }

            AdjustButtons();
        }
Esempio n. 54
0
        public async Task <IActionResult> Index(StepViewModel model)
        {
            await understandMySelfRepository.SaveAnswerAsync(model.StepAnswer);

            if (model.StepAnswer.QuestionId < 3)
            {
                var nextstep = model.StepAnswer.QuestionId + 1;
                return(new RedirectResult($"/step/{nextstep}"));
            }
            return(new RedirectResult("/step/results"));
        }
Esempio n. 55
0
		public ShowMessageStepViewModel(StepViewModel stepViewModel)
			: base(stepViewModel)
		{
			ShowMessageStep = (ShowMessageStep)stepViewModel.Step;
			MessageArgument = new ArgumentViewModel(ShowMessageStep.MessageArgument, stepViewModel.Update, UpdateContent);
			ConfirmationValueArgument = new ArgumentViewModel(ShowMessageStep.ConfirmationValueArgument, stepViewModel.Update, UpdateContent, false);
			ExplicitTypes = new ObservableCollection<ExplicitType>(AutomationHelper.GetEnumList<ExplicitType>());
			EnumTypes = AutomationHelper.GetEnumObs<EnumType>();
			ObjectTypes = AutomationHelper.GetEnumObs<ObjectType>();
			IsServerContext = Procedure.ContextType == ContextType.Server;
		}
Esempio n. 56
0
        public void AddStep()
        {
            var dialogViewModel = new StepAddDialogViewModel();

            StepViewModel stepViewModel = dialogService.OpenDialog(dialogViewModel);

            if (stepViewModel != null)
            {
                StepViewModelList.Add(stepViewModel as StepViewModel);
            }
        }
Esempio n. 57
0
        public async Task InsertStepReassignsAccommodations()
        {
            TestTrekStoriesContext tc = new TestTrekStoriesContext();
            Trip newTrip = new Trip
            {
                Title        = "Test Trip",
                Country      = "Ireland",
                TripCategory = TripCategory.forest,
                StartDate    = new DateTime(2015, 4, 12),
                TripOwner    = "ABC123"
            };

            tc.Trips.Add(newTrip);
            Accommodation acc = new Accommodation {
                AccommodationId = 122
            };

            tc.Accommodations.Add(acc);
            Step stepA = new Step {
                StepId = 11, SequenceNo = 1
            };
            Step stepB = new Step {
                StepId = 12, SequenceNo = 2, AccommodationId = 122
            };
            Step stepC = new Step {
                StepId = 10, SequenceNo = 3
            };

            tc.Steps.Add(stepA);
            tc.Steps.Add(stepB);
            tc.Steps.Add(stepC);

            StepViewModel stepViewModel = new StepViewModel
            {
                SequenceNo         = 2,
                From               = "B",
                To                 = "C",
                WalkingTimeHours   = 2,
                WalkingTimeMinutes = 30,
                WalkingDistance    = 12,
                Ascent             = 630,
                Description        = "A lovely walk",
                Notes              = null,
                TripId             = newTrip.TripId
            };

            var controller = new StepController(tc).WithAuthenticatedUser("ABC123");
            var result     = await controller.Create(stepViewModel);

            var insertedStep = tc.Steps.FirstOrDefault(s => s.SequenceNo == 2);

            Assert.AreEqual(null, stepB.AccommodationId);
            Assert.AreEqual(122, insertedStep.AccommodationId);
        }
Esempio n. 58
0
        public IActionResult Index()
        {
            StepViewModel        allSteps       = _stepService.getLastFiveElement();
            WorkFlowViewModel    allWorkFlows   = _WorkFlowService.getLastFiveElement();
            ApplicationViewModel allApplication = _applicationService.getLastFiveElement();
            Home model = new Home()
            {
                ApplicationViewModel = allApplication, WorkFlowViewModel = allWorkFlows, StepViewModel = allSteps
            };

            return(View(model));
        }
Esempio n. 59
0
        //switches content when button is clicked
        private void PreviousStepButton_Clicked(object sender, EventArgs e)
        {
            if (PreviousStepButton.IsEnabled)
            {
                var previousStepNumber = CurrentStep.StepNumber - 2;
                CurrentStep    = Steps[previousStepNumber];
                BindingContext = CurrentStep;
                UpdateUI(CurrentStep.StepNumber);
            }

            AdjustButtons();
        }
Esempio n. 60
0
        // GET: Step/Edit/5
        public ActionResult Edit(int id)
        {
            var s = ss.GetById(id);

            TempData["idTreatment"] = ss.GetById(id).TreatmentId;
            StepViewModel svm = new StepViewModel();

            svm.StepId             = s.StepId;
            svm.StepSpeciality     = s.StepSpeciality;
            svm.NewStepSpeciality  = s.StepSpeciality;
            svm.StepDescription    = s.StepDescription;
            svm.NewStepDescription = s.StepDescription;
            svm.StepDate           = s.StepDate;
            svm.NewStepDate        = s.StepDate;

            if (s.Validation == true)
            {
                svm.Validation    = "Valid";
                svm.NewValidation = "Valid";
            }
            else
            {
                svm.Validation    = "NotValid";
                svm.NewValidation = "NotValid";
            }
            TempData["idPatient"]       = st.GetById(s.TreatmentId).PatientId;
            svm.TreatmentId             = s.TreatmentId;
            svm.LastModificationBy      = us.GetUserById(s.LastModificationBy).FirstName + " " + us.GetUserById(s.LastModificationBy).LastName;
            svm.NewLastModificationBy   = Int32.Parse(User.Identity.GetUserId());
            svm.LastModificationDate    = s.LastModificationDate.ToString();
            svm.NewLastModificationDate = DateTime.UtcNow.Date;
            svm.ModificationReason      = s.ModificationReason;
            svm.NewValidation           = "NotValid";
            svm.TreatmentIllness        = st.GetById(s.TreatmentId).Illness;
            svm.NewModificationReason   = "";

            ViewBag.illness = svm.TreatmentIllness;

            if (s.Appointment != null)
            {
                svm.AppointmentId = s.Appointment.AppointmentId;
                svm.Appointment   = "Taken";
            }
            else
            {
                svm.AppointmentId = 0;
                svm.Appointment   = "Not taken";
            }

            return(View(svm));
        }