Esempio n. 1
0
        private void ProcessActions(List <ICombatAction> actions, IActionPlan plan)
        {
            if (actions.Count > 0)
            {
                var nextAction = actions[0];
                var poiFactory = new PointOfInterestFactory(BattleViewState.Dimensions);
                var poi        = nextAction.GetPointofInterest(poiFactory);

                Action panListener = null;
                panListener = new Action(() => {
                    Action listener = null;
                    listener        = new Action(() => {
                        ProcessActions(actions.Skip(1).ToList(), plan);
                        ActionCompleteSignal.RemoveListener(listener);
                    });
                    ActionCompleteSignal.AddListener(listener);
                    AnimateActionSignal.Dispatch(nextAction);

                    CameraPanCompleteSignal.RemoveListener(panListener);
                });
                CameraPanCompleteSignal.AddListener(panListener);
                PanToPointOfInterestSignal.Dispatch(poi);
            }
            else if (plan.HasActionsRemaining())
            {
                ProcessActions(plan.NextActionStep(BattleViewState.Battle), plan);
            }
            else
            {
                Release();
                EnemyTurnCompleteSignal.Dispatch();
            }
        }
Esempio n. 2
0
        public IActionResult DeletePost(int actionPlanID)
        {
            actionPlan = actionPlanCollection.GetActionPlan(actionPlanID);

            actionPlan.DeleteActionPlan();

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public List <ValidationResult> ValidateResource(IActionPlan resource)
        {
            var context = new ValidationContext(resource, null, null);
            var results = new List <ValidationResult>();

            Validator.TryValidateObject(resource, context, results, true);
            ValidateActionPlanRules(resource, results);

            return(results);
        }
Esempio n. 4
0
        public IActionResult PlanPage(int actionPlanID)
        {
            actionPlan = actionPlanCollection.GetActionPlan(actionPlanID);

            PlanPageViewModel model = new PlanPageViewModel()
            {
                PlanTitle   = actionPlan.PlanTitle,
                PlanMessage = actionPlan.PlanMessage
            };

            return(View(model));
        }
        public int CreateActionPlan(IActionPlan actionPlan)
        {
            IActionPlanDto actionPlanDto = DataHandlerFactory.DataHandlerFactory.GetActionPlanDto();

            actionPlanDto.AccountID       = actionPlan.AccountID;
            actionPlanDto.PlanTitle       = actionPlan.PlanTitle;
            actionPlanDto.PlanMessage     = actionPlan.PlanMessage;
            actionPlanDto.PlanCategory    = actionPlan.PlanCategory;
            actionPlanDto.PlanDateCreated = actionPlan.PlanDateCreated;

            int rowcount = db.CreateActionPlan(actionPlanDto);

            return(rowcount);
        }
Esempio n. 6
0
        public IActionResult Edit(int actionPlanID)
        {
            actionPlan = actionPlanCollection.GetActionPlan(actionPlanID);

            EditPlanViewModel model = new EditPlanViewModel()
            {
                ActionPlanID = actionPlan.ActionPlanID,
                PlanTitle    = actionPlan.PlanTitle,
                PlanMessage  = actionPlan.PlanMessage,
                PlanCategory = actionPlan.PlanCategory
            };

            return(View(model));
        }
Esempio n. 7
0
        public IActionResult Delete(int actionPlanID)
        {
            actionPlan = actionPlanCollection.GetActionPlan(actionPlanID);

            DeletePlanViewModel model = new DeletePlanViewModel()
            {
                ActionPlanID    = actionPlan.ActionPlanID,
                AccountID       = actionPlan.AccountID,
                PlanTitle       = actionPlan.PlanTitle,
                PlanMessage     = actionPlan.PlanMessage,
                PlanCategory    = actionPlan.PlanCategory,
                PlanDateCreated = actionPlan.PlanDateCreated
            };

            return(View(model));
        }
Esempio n. 8
0
        private void ValidateActionPlanRules(IActionPlan actionPlanResource, List <ValidationResult> results)
        {
            if (actionPlanResource == null)
            {
                return;
            }

            if (actionPlanResource.DateActionPlanCreated.HasValue && actionPlanResource.DateActionPlanCreated.Value > DateTime.UtcNow)
            {
                results.Add(new ValidationResult("Date ActionPlan Created must be less the current date/time", new[] { "DateActionPlanCreated" }));
            }

            if (actionPlanResource.DateAndTimeCharterShown.HasValue && actionPlanResource.DateAndTimeCharterShown.Value > DateTime.UtcNow)
            {
                results.Add(new ValidationResult("Date And Time Charter Shown must be less the current date/time", new[] { "DateAndTimeCharterShown" }));
            }

            if (actionPlanResource.DateActionPlanSentToCustomer.HasValue && actionPlanResource.DateActionPlanSentToCustomer.Value > DateTime.UtcNow)
            {
                results.Add(new ValidationResult("Date ActionPlan Sent To Customer must be less the current date/time", new[] { "DateActionPlanSentToCustomer" }));
            }

            if (actionPlanResource.DateActionPlanAcknowledged.HasValue && actionPlanResource.DateActionPlanAcknowledged.Value > DateTime.UtcNow)
            {
                results.Add(new ValidationResult("Date ActionPlan Acknowledged must be less the current date/time", new[] { "DateActionPlanAcknowledged" }));
            }

            if (actionPlanResource.LastModifiedDate.HasValue && actionPlanResource.LastModifiedDate.Value > DateTime.UtcNow)
            {
                results.Add(new ValidationResult("Last Modified Date must be less the current date/time", new[] { "LastModifiedDate" }));
            }

            if (actionPlanResource.PriorityCustomer.HasValue && !Enum.IsDefined(typeof(PriorityCustomer), actionPlanResource.PriorityCustomer.Value))
            {
                results.Add(new ValidationResult("Please supply a valid Priority Customer", new[] { "PriorityCustomer" }));
            }

            if (actionPlanResource.ActionPlanDeliveryMethod.HasValue && !Enum.IsDefined(typeof(ActionPlanDeliveryMethod), actionPlanResource.ActionPlanDeliveryMethod.Value))
            {
                results.Add(new ValidationResult("Please supply a valid Action Plan Delivery Method", new[] { "ActionPlanDeliveryMethod" }));
            }
        }
Esempio n. 9
0
 public ActionPlansController()
 {
     actionPlan           = LogicFactory.LogicFactory.GetActionPlan();
     actionPlanCollection = LogicFactory.LogicFactory.GetActionPlanCollection();
 }