Exemple #1
0
        public void DeleteUser(UserDO user)
        {
            _projectStaffDao.DeleteAllStaffingForUser(user.UserId);

            var usersTasks = _taskDao.ReadAllUserTasks(user.UserId);

            foreach (var task in usersTasks)
            {
                task.UserId = null;
                task.User   = null;
                _taskDao.Update(task);
            }

            _userDao.Delete(user);
        }
Exemple #2
0
 public bool ChangeContent(string text, Task task)
 {
     if (task != null)
     {
         if (taskDAO.Find(task) != null)
         {
             if (!String.IsNullOrWhiteSpace(text))
             {
                 taskDAO.Update(text, task);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         return(false);
     }
     return(false);
 }
Exemple #3
0
 private MenuOptionResult CompleteTask(Task task)
 {
     task.Completed = true;
     taskDAO.Update(task);
     return(MenuOptionResult.CloseMenuAfterSelection);
 }
 public TaskDO UpdateTask(TaskDO task)
 {
     return(taskDAO.Update(task));
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Task List!\r\n");
            System.Threading.Thread.Sleep(500);

            // Read the config file
            Config config = new Config("appsettings.json");

            if (config.UseSql)
            {
                taskDAO = new TaskSqlDAO(config.ConnectionString);
            }
            else
            {
                taskDAO = new TaskFileDAO(config.FilePath);
            }

            while (true)
            {
                Console.Clear();

                // List all the tasks
                IList <Task> list = taskDAO.GetOpenTasks();
                ListTasks(list);

                Console.WriteLine();
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("(A)dd a task");
                Console.WriteLine("(C)omplete a task");
                Console.WriteLine("(Q)uit");

                string input = Console.ReadLine().Trim().ToUpper();

                if (input.Length == 0)
                {
                    continue;
                }
                if (input.Substring(0, 1) == "Q")
                {
                    break;
                }
                int taskId;
                switch (input.Substring(0, 1))
                {
                case "A":
                    // Prompt the user to add a task
                    Task task = GetTaskinfo();
                    taskDAO.AddTask(task);
                    break;

                case "C":
                    taskId = GetTaskId(list);
                    if (taskId > 0)
                    {
                        task           = taskDAO.GetById(taskId);
                        task.Completed = true;
                        taskDAO.Update(task);
                    }
                    break;
                }
            }
        }