public ActionResult AddNewProjectManager(UserModel um) { ViewBag.Url = "/Images/" + User.Identity.Name + "_profile.jpg"; if (ModelState.IsValid) { ProjectManager pm = new ProjectManager(); pm.AddUser(um); return(RedirectToAction("BrowseProjectManagers")); } return(View()); }
/// <summary> /// Gets command from user. /// </summary> private void CommandParser() { string command = textBox1.Text; if (command == "help") { DisplayHelp(); } string[] splitedCommand = command.Trim().Split(' '); try { CommandCheck(splitedCommand); switch (splitedCommand[0]) { case "createuser": projectManager.AddUser(splitedCommand[1]); RefreshRTB("Users"); break; case "userlist": usersFillerFunction = projectManager.GetUserList; RefreshRTB("Users"); break; case "removeuser": projectManager.RemoveUser(splitedCommand[1]); RefreshRTB("Users"); break; case "createproject": projectManager.CreateProject(splitedCommand[1], int.Parse(splitedCommand[2])); RefreshRTB("Projects"); break; case "projectlist": projectsFillerFunction = projectManager.GetProjectList; RefreshRTB("Projects"); break; case "changeprojectname": projectManager.ChangeProjectName(splitedCommand[1], splitedCommand[2]); RefreshRTB("Projects"); break; case "removeproject": projectManager.RemoveProject(splitedCommand[1]); RefreshRTB("Projects"); break; case "addtasktoproject": projectManager.GetProject(splitedCommand[1]).CreateNewTask(splitedCommand[2], StringToTaskLevel(splitedCommand[3])); RefreshRTB("Tasks"); RefreshRTB("Projects"); break; case "addusertotask": projectManager.AssignUserToTask(splitedCommand[1], splitedCommand[2], splitedCommand[3]); RefreshRTB("Tasks"); break; case "removeuserfromtask": projectManager.RemoveUserFromTask(splitedCommand[1], splitedCommand[2], splitedCommand[3]); RefreshRTB("Tasks"); break; case "changetaskstatus": projectManager.GetProject(splitedCommand[1]).ChangeTaskStatus(splitedCommand[2], StringToTaskStatus(splitedCommand[3])); RefreshRTB("Tasks"); break; case "tasklist": tasksFillerFunction = projectManager.GetProject(splitedCommand[1]).GetTaskList; RefreshRTB("Tasks"); break; case "groupedtasklist": tasksFillerFunction = projectManager.GetProject(splitedCommand[1]).GetOrderedByStatusTaskList; RefreshRTB("Tasks"); break; case "removetaskfromproject": projectManager.GetProject(splitedCommand[1]).RemoveTask(splitedCommand[2]); RefreshRTB("Tasks"); RefreshRTB("Projects"); break; case "addsubtasktoepictask": projectManager.GetProject(splitedCommand[1]).AddTaskToEpicTask(splitedCommand[2], splitedCommand[3], StringToTaskLevel(splitedCommand[4])); RefreshRTB("Tasks"); break; case "removesubtaskfromepictask": projectManager.GetProject(splitedCommand[1]).RemoveSubtaskFromEpicTask(splitedCommand[2], splitedCommand[3]); RefreshRTB("Tasks"); break; case "changeepictasksubtaskstatus": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).ChangeTaskStatus(splitedCommand[3], StringToTaskStatus(splitedCommand[4])); RefreshRTB("Tasks"); break; case "epictasksubtasklist": tasksFillerFunction = projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).GetSubtaskList; RefreshRTB("Tasks"); break; case "epictaskgroupedsubtasklist": tasksFillerFunction = projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).GetOrderedByStatusSubtaskList; RefreshRTB("Tasks"); break; case "addusertoepictasksubtask": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).AssignUserToSubtask(splitedCommand[3], splitedCommand[4]); RefreshRTB("Tasks"); break; case "removeuserfromepictasksubtask": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).RemoveUserFromSubtask(splitedCommand[3], splitedCommand[4]); RefreshRTB("Tasks"); break; default: throw new ArgumentException("Invalid command."); } } catch (Exception ex) { MessageBox.Show($"Error. {ex.Message}"); } }
/// <summary> /// Gets command from user. /// </summary> static void CommandParser(ProjectManager projectManager) { Console.Write("> "); string command = Console.ReadLine(); if (command == "safexit") { throw new Exception("Save and exit."); } if (command == "help") { DisplayHelp(); } string[] splitedCommand = command.Trim().Split(' '); try { CommandCheck(splitedCommand); switch (splitedCommand[0]) { case "createuser": projectManager.AddUser(splitedCommand[1]); break; case "userlist": foreach (var userName in projectManager.GetUserList()) { Console.WriteLine(userName); } break; case "removeuser": projectManager.RemoveUser(splitedCommand[1]); break; case "createproject": projectManager.CreateProject(splitedCommand[1], int.Parse(splitedCommand[2])); break; case "projectlist": foreach (var project in projectManager.GetProjectList()) { Console.WriteLine(project); } break; case "changeprojectname": projectManager.ChangeProjectName(splitedCommand[1], splitedCommand[2]); break; case "removeproject": projectManager.RemoveProject(splitedCommand[1]); break; case "addtasktoproject": projectManager.GetProject(splitedCommand[1]).CreateNewTask(splitedCommand[2], StringToTaskLevel(splitedCommand[3])); break; case "addusertotask": projectManager.AssignUserToTask(splitedCommand[1], splitedCommand[2], splitedCommand[3]); break; case "removeuserfromtask": projectManager.RemoveUserFromTask(splitedCommand[1], splitedCommand[2], splitedCommand[3]); break; case "changetaskstatus": projectManager.GetProject(splitedCommand[1]).ChangeTaskStatus(splitedCommand[2], StringToTaskStatus(splitedCommand[3])); break; case "tasklist": foreach (var taskinfo in projectManager.GetProject(splitedCommand[1]).GetTaskList()) { Console.WriteLine(taskinfo); } break; case "groupedtasklist": foreach (var taskinfo in projectManager.GetProject(splitedCommand[1]).GetOrderedByStatusTaskList()) { Console.WriteLine(taskinfo); } break; case "removetaskfromproject": projectManager.GetProject(splitedCommand[1]).RemoveTask(splitedCommand[2]); break; case "addsubtasktoepictask": projectManager.GetProject(splitedCommand[1]).AddTaskToEpicTask(splitedCommand[2], splitedCommand[3], StringToTaskLevel(splitedCommand[4])); break; case "removesubtaskfromepictask": projectManager.GetProject(splitedCommand[1]).RemoveSubtaskFromEpicTask(splitedCommand[2], splitedCommand[3]); break; case "changeepictasksubtaskstatus": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).ChangeTaskStatus(splitedCommand[3], StringToTaskStatus(splitedCommand[4])); break; case "epictasksubtasklist": foreach (var taskinfo in projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).GetSubtaskList()) { Console.WriteLine(taskinfo); } break; case "epictaskgroupedsubtasklist": foreach (var taskinfo in projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).GetOrderedByStatusSubtaskList()) { Console.WriteLine(taskinfo); } break; case "addusertoepictasksubtask": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).AssignUserToSubtask(splitedCommand[3], splitedCommand[4]); break; case "removeuserfromepictasksubtask": projectManager.GetProject(splitedCommand[1]).GetEpicTask(splitedCommand[2]).RemoveUserFromSubtask(splitedCommand[3], splitedCommand[4]); break; default: throw new ArgumentException("Invalid command."); } } catch (Exception ex) { Console.WriteLine($"Error. {ex.Message}"); } }