public static void ChooseOption(string userchoise)// sort the user's choice { if (userchoise.Length == 1) { switch (userchoise) { case "1": // in case the user wants to add task to his board; Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("in order to add a task please enter the following detail according to the Instructions"); Console.WriteLine("the number of tasks in each column is limited, make sure you have space left befor trying to add a task"); Console.WriteLine("your limit is: " + kanban.GetMaxLength()); // צריך שיטה כזאתת Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("task title - contain max 50 characters, and not empty! "); Console.ResetColor(); Console.Write("title :"); string title = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("task body - can contain 0-300 characters "); Console.ResetColor(); Console.Write("body :"); string body = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("task due date - must be a date that hasn't passed yet "); Console.ResetColor(); Console.Write("Enter due date (e.g. 10/22/1987) : "); DateTime dueDate = DateTime.Parse(Console.ReadLine()); //להמשיך את מה שדורין המלכה כתבה AddTask(title, body, dueDate); break; case "2": //in case the user wants to further a task Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("if you start working on a task or if you finish one"); Console.WriteLine("you can move your task one column forward"); Console.WriteLine("from 'to do' to 'in progress' and from 'in progress' to 'done' "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("note: you can't move a task that located in the done column!"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("please enter the following task's details"); Console.ResetColor(); Console.Write("task Id :"); string taskId = Console.ReadLine(); int task = ValidNumber(taskId); if (task == -1) //if the inputs invalid { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("invalid input! make sure you enter a valid task number"); Console.ResetColor(); } else { MoveTask(task); } break; case "3": //in case the user wants to remove task Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("please enter the following task's detail,in order to remove it"); Console.ResetColor(); Console.Write("task Id :"); taskId = Console.ReadLine(); task = ValidNumber(taskId); if (task == -1) //if the inputs invalid { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("invalid input! make sure you enter a valid task number"); Console.ResetColor(); } else { RemoveTask(task); } break; case "4": //log out LogOut(); break; case "5": // exit the system Exit(); break; default: //the user enter incorrect option Console.WriteLine("your input is invalid! please type only one of the options"); UserOption(); break; } } else //the user enter incorrect option { Console.WriteLine("your input is invalid! please type only one of the options"); UserOption(); //same as default } }
public static void ChooseOption(string userChoise)// sort the user's choice { if (userChoise.Length == 1) { switch (userChoise) { case "1": // in case the user wants to add task to his board Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("In order to add a task please enter the following details according to the instructions."); Console.WriteLine("The number of tasks in each column is limited, make sure you have space left before trying to add a task."); Console.WriteLine("Your limit is: " + kanban.GetMaxLength() + "\n"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Task's title - contains max 50 characters, not empty.\n"); Console.ResetColor(); Console.Write("Title :"); string title = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Task's description - contains 0-300 characters."); Console.ResetColor(); Console.Write("Description :"); string body = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Task's due date - must be a date that has not passed yet."); Console.ResetColor(); Console.Write("Enter due date (e.g. 10/22/1987) : "); string dueDate = Console.ReadLine(); while (!IsDateTime(dueDate)) { Console.ForegroundColor = ConsoleColor.Red; Log.Warn("Invalid date"); Console.WriteLine("Please enter a valid date as mentioned."); Console.ResetColor(); Console.Write("Enter due date (e.g. 10/22/1987) : "); dueDate = Console.ReadLine(); } AddTask(title, body, DateTime.Parse(dueDate)); break; case "2": //in case the user wants to further a task Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("If you start working on a task or if you finish one"); Console.WriteLine("You can move your task one column forward"); Console.WriteLine("From 'to do' to 'in progress' and from 'in progress' to 'done'."); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Note: you can't move a task that is located in 'done' column!"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Please enter the following task's details."); Console.ResetColor(); Console.Write("Task number :"); string taskId = Console.ReadLine(); int task = ValidNumber(taskId); if (task == -1) //if the input is invalid { Console.ForegroundColor = ConsoleColor.Red; Log.Warn("Invalid task number"); Console.WriteLine("Make sure you enter a valid task number."); Console.ResetColor(); UserOption(); } else { MoveTask(task); } break; case "3": //in case the user wants to remove task Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Please enter the following task's details."); Console.ResetColor(); Console.Write("Task number :"); taskId = Console.ReadLine(); task = ValidNumber(taskId); if (task == -1) //if the inputs invalid { Console.ForegroundColor = ConsoleColor.Red; Log.Warn("Invalid task number"); Console.WriteLine("Make sure you enter a valid task number."); Console.ResetColor(); } else { RemoveTask(task); } break; case "4": //edit task Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Please enter the number of the task you would like to edit"); Console.ResetColor(); Console.Write("Task number :"); taskId = Console.ReadLine(); task = ValidNumber(taskId); if (task == -1) //if the inputs invalid { Console.ForegroundColor = ConsoleColor.Red; Log.Warn("Invalid task number"); Console.WriteLine("Make sure you enter a valid task number."); Console.ResetColor(); UserOption(); } else if (kanban.FindTask(task)) { EditTaskChooseOption(task); } else { Console.ForegroundColor = ConsoleColor.Red; Log.Warn("Invalid task number"); Console.WriteLine("Task number doesn't exist\n"); Console.ResetColor(); UserOption(); } break; case "5": //log out LogOut(); break; case "6": // exit the system Exit(); break; default: //the user enter incorrect option Log.Info("Invalid input, this input isn't one of the options"); Console.WriteLine("please type only one of the options.\n"); UserOption(); break; } } else //the user enter incorrect option { Log.Info("Invalid input, this input isn't one of the options"); Console.WriteLine("please type only one of the options.\n"); UserOption(); //same as default } }