public async Task <IActionResult> Edit(int id, [Bind("departmentAttributeId,departmentAttributeName,departmentAttributeType,valueLength,isRequired,valueRegEx")] DepartmentAttributes departmentAttributes)
        {
            step = ActionStep.edit;
            if (id != departmentAttributes.departmentAttributeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departmentAttributes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentAttributesExists(departmentAttributes.departmentAttributeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departmentAttributes));
        }
        private ActionStep ConvertToStep(AutomationStep stepData)
        {
            ActionStep step = new ActionStep();

            step.Name        = stepData.Name;
            step.Description = stepData.Description;

            return(step);
        }
        public async Task <IActionResult> Create([Bind("departmentAttributeId,departmentAttributeName,departmentAttributeType,valueLength,isRequired,valueRegEx")] DepartmentAttributes departmentAttributes)
        {
            step = ActionStep.create;
            if (ModelState.IsValid)
            {
                _context.Add(departmentAttributes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departmentAttributes));
        }
示例#4
0
 public void SoThisFailed(ActionStep failedStep)
 {
     if (failedStep.associatedTask == Tasks.CreatureTasks.EAT)
     {
         if (failedStep.failReason == ActionStep.FailReason.CouldntGetToTarget ||
             failedStep.failReason == ActionStep.FailReason.InfinityDistance)
         {
             AddMemory(new MemoryInstance(Verb.MOVEDTO, failedStep._targetThing, true));
             Debug.LogWarning("Memory of couldnt move to " + failedStep._targetThing.thingName);
         }
     }
 }
示例#5
0
        public async Task <IActionResult> Create([Bind("positionId,positionName,positionAbstract")] Position position)
        {
            step = ActionStep.create;
            if (ModelState.IsValid)
            {
                _context.Add(position);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(position));
        }
示例#6
0
        // GET: Position/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            step = ActionStep.edit;
            if (id == null)
            {
                return(NotFound());
            }

            var position = await _context.Position.SingleOrDefaultAsync(m => m.positionId == id);

            if (position == null)
            {
                return(NotFound());
            }
            return(View(position));
        }
        // GET: DepartmentAttributes/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            step = ActionStep.edit;
            if (id == null)
            {
                return(NotFound());
            }

            var departmentAttributes = await _context.DepartmentAttributes.SingleOrDefaultAsync(m => m.departmentAttributeId == id);

            if (departmentAttributes == null)
            {
                return(NotFound());
            }
            return(View(departmentAttributes));
        }
        public void LoadConfig(WebAutomationConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config must not be null");
            }
            if (config.StepList == null)
            {
                return;
            }

            // conver to
            actionStepList = new List <ActionStep>();

            foreach (AutomationStep stepData in config.StepList)
            {
                if (!stepData.Enabled)
                {
                    continue;
                }

                ActionStep step = ConvertToStep(stepData);
                if (stepData.ActionList != null)
                {
                    foreach (AutomationAction actionData in stepData.ActionList)
                    {
                        if (!actionData.Enabled)
                        {
                            continue;
                        }
                        IAction action = ConvertToAction(actionData);
                        if (step.ActionList == null)
                        {
                            step.ActionList = new List <IAction>();
                        }
                        step.ActionList.Add(action);

                        LoadChildAction(action, actionData);
                        LoadConditionAction(action, actionData);
                    }
                }

                actionStepList.Add(step);
            }
        }
示例#9
0
        // GET: Department/Delete/5
        public async Task <IActionResult> Delete(int?id)
        {
            step = ActionStep.delete;
            if (id == null)
            {
                return(NotFound());
            }

            var department = await _context.Department
                             .SingleOrDefaultAsync(m => m.departmentId == id);

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

            return(View(department));
        }
示例#10
0
        // GET: Department/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            step = ActionStep.details;
            if (id == null)
            {
                return(NotFound());
            }

            var department = await _context.Department.Include(d => d.departmentValues)
                             .SingleOrDefaultAsync(m => m.departmentId == id);

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

            GetAttributes(id);
            return(View(department));
        }
示例#11
0
        // GET: Department/Create
        public IActionResult Create()
        {
            step = ActionStep.create;
            //GetAttributes(null);
            var attr   = _context.DepartmentAttributes;
            var values = new List <DepartmentValue>();

            foreach (var a in attr)
            {
                values.Add(new DepartmentValue {
                    departmentAttributes = a, departmentAttributeId = a.departmentAttributeId
                });
            }
            Department department = new Department()
            {
                departmentValues = values
            };

            return(View(department));
        }
示例#12
0
    // Using "walkTo" bool for now, for so long as no other pathing is implemented. True to walk, false to perform action instantly
    protected void ActionQueueAdd(Consts.HighlightGroupType selectable, bool walkTo, float minSelReachDist, Action <SpriteBase> OnSelectionContact)
    {
        // Record parameters - selectable types need to be selected, replaced with sprites.

        ActionStep step = new ActionStep {
            selectable      = selectable,
            walkTo          = walkTo,
            minSelReachDist = minSelReachDist,
            OnSelContact    = OnSelectionContact
        };

        if (actPathSplit)
        {
            splitStepsList.Add(step);
        }
        else
        {
            steps.Add(step);
        }
    }
示例#13
0
        public override ActionStep ProcessSubmittedStep(ActionStep fromStep)
        {
            CheckStepNumberAndChangeIfValid(fromStep);
            switch (StepNumber)
            {
            case 1:
                var step = CheckStepIs <Step1>(fromStep);

                AdvanceStepNumber();
                return(Continue());

            case 2:
                CheckStepIs <Step2>(fromStep);
                AdvanceStepNumber();
                return(Continue());

            default:
                throw new DomainException("Not a valid Step number");
            }
        }
示例#14
0
        public async Task <IActionResult> Edit(int id, [Bind("departmentId,departmentName")] Department department, IDictionary <int, string> dictionary)
        {
            step = ActionStep.edit;
            if (id != department.departmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    var departmentValues = _context.DepartmentValue.Where(v => v.departmentId == id);
                    foreach (KeyValuePair <int, string> value in dictionary)
                    {
                        DepartmentValue dv = departmentValues.SingleOrDefault(v => v.departmentValueId == value.Key);
                        if (dv != null)
                        {
                            dv.departmentValue = value.Value;
                            _context.Update(dv);
                        }
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.departmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
        public void RunStep(ActionStep step)
        {
            WaitBrowserBusy();
            LoggerManager.Info("Step:{0}", step.Name);

            if (step.ActionList == null || step.ActionList.Count == 0)
            {
                return;
            }

            foreach (IAction action in step.ActionList)
            {
                LoggerManager.Debug("Start Run Action:{0}", action.ActionType);

                try
                {
                    RunAction(action);
                }
                catch (ElementNoFoundException ex)
                {
                    // report fatal
                    if (ErrorMessage != null)
                    {
                        ErrorMessage(ex.Message, ex.Action.AutomationActionData.ToString());
                    }

                    return;
                }
                catch (Exception ex)
                {
                    if (ErrorMessage != null)
                    {
                        ErrorMessage(ex.Message, string.Empty);
                    }

                    return;
                }
            }
        }
示例#16
0
        public async Task <IActionResult> Create(Department model)
        {
            step = ActionStep.create;
            if (ModelState.IsValid)
            {
                //foreach(var value in model.departmentValues)
                //{
                //    value.department=model;
                //    _context.Add(value);
                //}
                _context.Add(model);
                //await _context.SaveChangesAsync();
                // foreach(KeyValuePair<int,string> value in dictionary)
                // {
                //     _context.Add(new DepartmentValue { departmentAttributeId = value.Key,department=department,departmentValue = value.Value });
                // }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
示例#17
0
		public void CurrentStep()
		{
			var pipeline = new CompilerPipeline();

			var step1 = new ActionStep(delegate {});
			pipeline.Add(step1);

			ActionStep step2 = null;
			step2 = new ActionStep(() => Assert.AreSame(step2, pipeline.CurrentStep));
			pipeline.Add(step2);

			var currentSteps = new Boo.Lang.List();
			pipeline.Before += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.BeforeStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.AfterStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.After += (sender, args) => currentSteps.Add(pipeline.CurrentStep);

			pipeline.Run(new CompilerContext());

			Assert.AreEqual(
				new object[] { null, step1, step1, step2, step2, null },
				currentSteps.ToArray());
		}
示例#18
0
		public void ExecutionOrder()
		{
			var order = new List<string>();
			var p1 = new ActionStep(() => order.Add("p1"));
			var p2 = new ActionStep(() => order.Add("p2"));

			var pipeline = new CompilerPipeline { p1, p2 };
			pipeline.Run(new CompilerContext());

			Assert.AreEqual(new[] { "p1", "p2" }, order.ToArray());
		}