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(); } }
public IActionResult DeletePost(int actionPlanID) { actionPlan = actionPlanCollection.GetActionPlan(actionPlanID); actionPlan.DeleteActionPlan(); return(RedirectToAction("Index")); }
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); }
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); }
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)); }
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)); }
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" })); } }
public ActionPlansController() { actionPlan = LogicFactory.LogicFactory.GetActionPlan(); actionPlanCollection = LogicFactory.LogicFactory.GetActionPlanCollection(); }