private ReorderError AllowReorder(List <dtoReorderGraphActivity> activities, ReorderAction dAction = ReorderAction.Ignore) { ReorderError result = Service.AllowReorder(activities); switch (result) { case ReorderError.InConflictPredecessorsFound: case ReorderError.SummaryWithLinks: result = (dAction == ReorderAction.RemoveAllPredecessors || dAction == ReorderAction.RemoveConflictPredecessors) ? ReorderError.None: result; break; } return(result); }
public void ConfirmReorder(List <dtoReorderGraphActivity> activities, ReorderAction dAction = ReorderAction.Ignore) { long idProject = View.IdProject; if (IsSessionTimeout()) { return; } else { switch (dAction) { case ReorderAction.ReloadProjectMap: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderReloadProjectMap); LoadItems(idProject, View.GetDefaultAction()); break; case ReorderAction.ReloadProjectMapWithReorderedItems: View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderReloadProjectMapWithReorderedItems); LoadItems(idProject, activities, dAction); break; case ReorderAction.RemoveAllPredecessors: case ReorderAction.RemoveConflictPredecessors: activities = Service.AnalyzeActionsForReorder(idProject, activities); if (activities.Where(a => a.Status != FieldStatus.removed).Any()) { if (Service.ReorderActivities(idProject, activities, dAction, true) == ReorderError.None) { View.DisplayReorderCompleted(); View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderApplied); LoadItems(idProject, dAction); } else { View.DisplayUnableToReorder(); } } else if (activities.Any()) { View.DisplayNoActivitiesToReorder(); } break; default: LoadItems(idProject, activities, dAction); break; } } }
private void LoadItems(long idProject, List <dtoActivityTreeItem> tasks, ReorderAction dAction = ReorderAction.AskAlways) { List <ReorderAction> actions = new List <ReorderAction>(); if (tasks == null) { View.LoadAvailableActions(actions, ReorderAction.Ignore, false); } else if (tasks.Where(t => t.HasLinks).Any()) { actions.Add(ReorderAction.RemoveConflictPredecessors); actions.Add(ReorderAction.RemoveAllPredecessors); actions.Add(ReorderAction.AskAlways); View.LoadAvailableActions(actions, dAction, true); } else { View.LoadAvailableActions(actions, ReorderAction.Ignore, true); } View.LoadActivities(tasks); View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderLoadItems); }
private void LoadItems(long idProject, List <dtoReorderGraphActivity> activities, ReorderAction dAction = ReorderAction.AskAlways) { LoadItems(idProject, Service.GetProjectTreeForReorder(idProject, activities), dAction); }
public void ApplyReorder(List <dtoReorderGraphActivity> activities, ReorderAction dAction = ReorderAction.Ignore) { long idProject = View.IdProject; if (IsSessionTimeout()) { return; } else if (activities.Any()) { activities = Service.AnalyzeActionsForReorder(idProject, activities); ReorderError result = AllowReorder(activities, dAction); if (result == ReorderError.None) { result = Service.ReorderActivities(idProject, activities, dAction); } switch (result) { case ReorderError.None: View.DisplayReorderCompleted(); //ModuleProjectManagement.ActionType uAction = ModuleProjectManagement.ActionType.ReorderApplied; //switch (dAction) { // case ReorderAction.RemoveAllPredecessors: // uAction = ModuleProjectManagement.ActionType.ReorderAppliedWithAllLinksRemoved; // break; // case ReorderAction.RemoveConflictPredecessors: // uAction = ModuleProjectManagement.ActionType.ReorderAppliedWithCyclesInvolvedLinksRemoved; // break; //} View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderApplied); LoadItems(idProject, dAction); break; case ReorderError.ProjectMapChanged: View.DisplayConfirmActions(result, new List <dtoReorderAction>() { new dtoReorderAction() { Action = ReorderAction.ReloadProjectMap }, new dtoReorderAction() { Action = ReorderAction.ReloadProjectMapWithReorderedItems, Selected = true } }); View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderProjectMapChanged); LoadItems(idProject, activities, dAction); break; case ReorderError.DataAccess: View.DisplayConfirmActions(result); View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderDataSavingErrors); LoadItems(idProject, activities, dAction); break; case ReorderError.InConflictPredecessorsFound: case ReorderError.SummaryWithLinks: View.DisplayConfirmActions(result, new List <dtoReorderAction>() { new dtoReorderAction(ReorderAction.RemoveConflictPredecessors, true), new dtoReorderAction(ReorderAction.RemoveAllPredecessors) }); View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ReorderCyclesFound); LoadItems(idProject, activities, dAction); break; } } else { LoadItems(idProject, dAction); } }
private void LoadItems(long idProject, ReorderAction dAction = ReorderAction.AskAlways) { LoadItems(idProject, Service.GetProjectTreeForReorder(idProject), dAction); }
public dtoReorderAction(ReorderAction action, Boolean selected = false) { Action = action; Selected = selected; }