Пример #1
0
        /*
         * BusinessProcessState createdstate = new BusinessProcessState
         *              {
         *                  DatePerformed = DateTime.Now,
         *                  PerformedBy = "System",
         *                  Comment = "Created workflow for Payment Request"
         *
         *              };
         *              _PaymentRequestservice.Create(request);
         *
         *              BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PR,request.PaymentRequestID,
         *                                                                                 "PaymentRequest", createdstate);
         *              request.BusinessProcessID = bp.BusinessProcessID;
         */
        public BusinessProcess CreateBusinessProcessForObject(int templateID, int DocumentID, string DocumentType, bool save = false)
        {
            StateTemplate   startingTemplate = _unitOfWork.StateTemplateRepository.FindBy(s => s.ParentProcessTemplateID == templateID && s.StateType == 0).Single();
            BusinessProcess bp = new BusinessProcess {
                ProcessTypeID = templateID, DocumentID = DocumentID, DocumentType = DocumentType
            };
            BusinessProcessState StartingState = new BusinessProcessState
            {
                DatePerformed = DateTime.Now,
                PerformedBy   = "System",
                Comment       = "Created workflow for" + DocumentType
            };

            _unitOfWork.BusinessProcessRepository.Add(bp);

            StartingState.ParentBusinessProcess = bp;
            StartingState.StateID = startingTemplate.StateTemplateID;

            _unitOfWork.BusinessProcessStateRepository.Add(StartingState);
            bp.CurrentStateID = StartingState.BusinessProcessStateID;

            //   _unitOfWork.BusinessProcessRepository.Edit(bp);
            //  PromotWorkflow(StartingState);

            if (save)
            {
                _unitOfWork.Save();
            }
            return(bp);
        }
Пример #2
0
    public override void CloneData(StateTemplate _reference)
    {
        MoveAround controller = _reference as MoveAround;

        this.rotationSpeed = controller.GetRotationSpeed();
        this.minDistance   = controller.GetMinDistance();
    }
Пример #3
0
    public override void CloneData(StateTemplate _reference)
    {
        Attack controller = _reference as Attack;

        this.CoolDown   = controller.GetCoolDown();
        this.AttackTime = controller.GetAttackTime();
    }
Пример #4
0
        public string Serialize()
        {
            StateTemplate temp = new StateTemplate();

            foreach (Output o in Outputs)
            {
                OutputTemplate ot = new OutputTemplate();
                ot.ID        = o.ID;
                ot.Ports     = o.Ports;
                ot.Name      = o.Name;
                ot.IPAddress = o.IP;
                foreach (Fixture f in o.GetFixtures())
                {
                    ot.Fixtures.Add(FixtureTemplateFactory.createFixtureTemplate(f));
                }
                temp.Outputs.Add(ot);
            }

            foreach (Fixture f in FixturePool)
            {
                temp.FixturePool.Add(FixtureTemplateFactory.createFixtureTemplate(f));
            }
            temp.ActionMessage = ActionMessage;

            return(JsonConvert.SerializeObject(temp));
        }
Пример #5
0
 public ActionResult EditStateJSON(StateTemplate item)
 {
     if (item != null)
     {
         _StateTemplateService.Update(item);
         return(Json(toStateTemplatePOCO(item), JsonRequestBehavior.AllowGet));
     }
     return(Json("{}"));
 }
Пример #6
0
    public override void CloneData(StateTemplate _reference)
    {
        FollowPlayer controller = _reference as FollowPlayer;

        this.rotationSpeed      = controller.GetRotationSpeed();
        this.minDistance        = controller.GetMinDistance();
        this.parentSpeedOnEnter = controller.GetParentSpeedOnEnter();
        this.parentSpeedOnExit  = controller.GetParentSpeedOnExit();
    }
Пример #7
0
 public ActionResult Edit(StateTemplate item)
 {
     if (ModelState.IsValid)
     {
         _StateTemplateService.Update(item);
         return(RedirectToAction("Index"));
     }
     return(View(item));
 }
Пример #8
0
 public ActionResult EditKendo([DataSourceRequest] DataSourceRequest request, StateTemplate item)
 {
     if (ModelState.IsValid)
     {
         _StateTemplateService.Update(item);
         return(Json(ModelState.ToDataSourceResult()));
     }
     return(Json(ModelState.ToDataSourceResult()));
 }
Пример #9
0
        public ActionResult Delete(int id = 0)
        {
            StateTemplate item = _StateTemplateService.FindById(id);

            if (item == null)
            {
                return(HttpNotFound());
            }
            return(View(item));
        }
Пример #10
0
 public bool Delete(StateTemplate item)
 {
     if (item == null)
     {
         return(false);
     }
     _unitOfWork.StateTemplateRepository.Delete(item);
     _unitOfWork.Save();
     return(true);
 }
Пример #11
0
 private StateTemplatePOCO toStateTemplatePOCO(StateTemplate item)
 {
     return(new StateTemplatePOCO()
     {
         AllowedAccessLevel = item.AllowedAccessLevel,
         Name = item.Name,
         ParentProcessTemplateID = item.ParentProcessTemplateID,
         StateNo = item.StateNo,
         StateTemplateID = item.StateTemplateID,
         StateType = item.StateType
     });
 }
Пример #12
0
    // Update is called once per frame
    protected override void Update()
    {
        this.currState.Tick();

        StateTemplate state = this.currState.CheckTransitions();

        if (this.currState != state)
        {
            this.currState.OnExit();
            this.currState = state;
            this.currState.OnEnter();
        }
    }
Пример #13
0
    public virtual void Init()
    {
        if (this.StartHealth == -1)
        {
            this.StartHealth = this.Health;
        }

        this.Health = this.StartHealth;

        this.currState = this.states[0];

        this.currState.OnEnter();

        this.OnEnemyCreated.Raise();
    }
Пример #14
0
    public override void CloneData()
    {
        List <StateTemplate> states       = this.parent.GetStates();
        List <StateTemplate> clonedStates = new List <StateTemplate>();

        //this.parent.Start();

        for (int count = 0; count < states.Count; count++)
        {
            clonedStates.Add(Instantiate(states[count]));
            clonedStates[count].name = this.parent.gameObject.name + "_" + clonedStates[count].name;
        }

        for (int count = 0; count < clonedStates.Count; count++)
        {
            List <TransitionTemplate> transition       = clonedStates[count].GetTransitions();
            List <TransitionTemplate> clonedTransition = new List <TransitionTemplate>();


            for (int countT = 0; countT < transition.Count; countT++)
            {
                clonedTransition.Add(Instantiate(transition[countT]));
                clonedTransition[countT].name = this.parent.gameObject.name + "_" + clonedTransition[countT].name;

                string targetId = clonedTransition[countT].GetTarget().GetID();

                StateTemplate newTarget = clonedStates.Find(x => x.GetID() == targetId);

                clonedTransition[countT].SetTarget(newTarget);
                clonedTransition[countT].CloneData(transition[countT]);
            }

            clonedStates[count].SetTransitions(clonedTransition);

            clonedStates[count].Init(this.parent);
            clonedStates[count].CloneData(states[count]);
        }

        this.parent.SetStates(clonedStates);
    }
Пример #15
0
        public T Deserialize <T>(string str)
        {
            StateTemplate stateTemp = JsonConvert.DeserializeObject <StateTemplate>(str);
            State         state     = new State();

            // deserialize outputs
            foreach (OutputTemplate o in stateTemp.Outputs)
            {
                Output output = new Output();
                // add prots
                foreach (Port p in o.Ports)
                {
                    output.Ports.Add(p);
                }

                // add fixtures
                foreach (FixtureTemplate ft in o.Fixtures)
                {
                    Fixture f = FixtureFactory.createFixture(ft);
                    f.Name = ft.Name;
                    output.TryPatchFixture(f);
                }
                output.IP   = o.IPAddress;
                output.Name = o.Name;
                state.Outputs.Add(output);
            }

            // deserialize fixture pool
            foreach (FixtureTemplate ft in stateTemp.FixturePool)
            {
                Fixture f = FixtureFactory.createFixture(ft);
                f.Name = ft.Name;
                state.FixturePool.Add(f);
            }
            state.ActionMessage = stateTemp.ActionMessage;
            return((T)Convert.ChangeType(state, typeof(State)));
        }
Пример #16
0
        public ActionResult CreateKendo([DataSourceRequest] DataSourceRequest request, StateTemplate item, int ProcessTemplateID = 0)
        {
            if (item != null && ModelState.IsValid)
            {
                if (ProcessTemplateID > 0)
                {
                    item.ParentProcessTemplateID = ProcessTemplateID;
                }
                _StateTemplateService.Add(item);
            }

            return(Json(new[] { item }.ToDataSourceResult(request, ModelState)));
        }
Пример #17
0
    // Use this for initialization
    public override void Init(StateTemplate _parent)
    {
        base.Init(_parent);

        this.target = this.parent.GetParent().GetTarget();
    }
Пример #18
0
 public virtual void CloneData(StateTemplate _reference)
 {
 }
Пример #19
0
 // Use this for initialization
 public override void Init(StateTemplate _parent)
 {
     base.Init(_parent);
     this.state = (MoveAround)this.parent;
 }
Пример #20
0
 public bool Add(StateTemplate item)
 {
     _unitOfWork.StateTemplateRepository.Add(item);
     _unitOfWork.Save();
     return(true);
 }
Пример #21
0
 // Use this for initialization
 public virtual void Init(StateTemplate _parent)
 {
     this.parent = _parent;
 }
Пример #22
0
 public virtual void SetTarget(StateTemplate _target)
 {
     this.targetState = _target;
 }
Пример #23
0
        public ActionResult DeleteKendo([DataSourceRequest] DataSourceRequest request, StateTemplate item)
        {
            if (item != null)
            {
                _StateTemplateService.DeleteById(item.StateTemplateID);
            }

            return(Json(ModelState.ToDataSourceResult()));
        }
Пример #24
0
 public ITraitContextBuilder UseTrait(StateIdentifier stateIdentifier, StateTemplate stateTemplate)
 {
     stateIdentifiers.Add(stateIdentifier);
     stateMapping.Add(stateIdentifier, stateTemplate);
     return(this);
 }