Exemplo n.º 1
0
        public static void SaveTask(List <TaskVO> tasksRequest)
        {
            if (tasksRequest == null)
            {
                throw new ArgumentNullException(nameof(tasksRequest));
            }
            var tasksToUpdate = new List <TaskVO>();

            for (int i = 1; i <= tasksRequest.Count; i++)
            {
                TaskVO task = tasksRequest[i - 1];

                if (string.IsNullOrEmpty(task.firstName) ||
                    string.IsNullOrEmpty(task.lastName) ||
                    string.IsNullOrEmpty(task.task) ||
                    string.IsNullOrEmpty(task.status))
                {
                    Console.WriteLine("TaskVO has NULL Value, error out..." + task);
                }
                else
                {
                    task.tid = i.ToString();
                    tasksToUpdate.Add(task);
                    Console.WriteLine("Added To Update List =====> " + task);
                }
            }

            Console.WriteLine("Task To Update Size : " + tasksToUpdate.Count);

            TasksDAO.UpdateTasks(tasksToUpdate);
        }
Exemplo n.º 2
0
        public static void SaveTask1()
        {
            Console.WriteLine("=====> Starting Save Task1...");

            List <TaskVO> tasks = new List <TaskVO>();

            TaskVO task1 = new TaskVO();
            TaskVO task2 = new TaskVO();

            task1.firstName = "TestSave1";
            task1.lastName  = "Tester101";
            task1.task      = "Fun";
            task1.status    = "Enjoy";
            task1.iteration = "Iteration1";
            task1.tid       = "1";

            task2.firstName = "Funny";
            task2.lastName  = "Stuff";
            task2.task      = "LuLu";
            task2.status    = "OK";
            task2.iteration = "Iteration1";
            task2.tid       = "2";

            tasks.Add(task1);
            tasks.Add(task2);

            TasksDAO.UpdateTasks(tasks);
        }