Esempio n. 1
0
        private void edit_task_btn_Click(object sender, RoutedEventArgs e)
        {
            TaskModel task = task_list_grid.SelectedItem as TaskModel;

            if (task != null)
            {
                EditTaskView edit_view = new EditTaskView();

                edit_view.DescriptionText = task.Task_desc;
                edit_view.DeadlineText    = task.Task_deadline;
                edit_view.PriorityText    = task.Priority_Txt;
                edit_view.LinkIDText      = task.Task_link_id;

                if (edit_view.ShowDialog() == true)
                {
                    tasks.Remove(task);

                    task.Task_desc     = edit_view.DescriptionText;
                    task.Task_deadline = edit_view.DeadlineText;
                    task.Task_priority = Convert.ToInt32(edit_view.PriorityText);
                    task.Task_link_id  = edit_view.LinkIDText;


                    tasks.Add(task);
                }
            }
        }
Esempio n. 2
0
        private void edit_btn_Click(object sender, RoutedEventArgs e)
        {
            TaskModel update_task = list_tasks_grid.SelectedItem as TaskModel;

            if (update_task != null)
            {
                EditTaskView edit_view = new EditTaskView();

                edit_view.DescriptionText = update_task.Task_desc;
                edit_view.DeadlineText    = update_task.Task_deadline;
                edit_view.PriorityText    = update_task.Priority_Txt;
                edit_view.LinkIDText      = update_task.Task_link_id;

                if (edit_view.ShowDialog() == true)
                {
                    ListController controller = new ListController();

                    tasks_list.Remove(update_task);

                    update_task.Task_desc     = edit_view.DescriptionText;
                    update_task.Task_deadline = edit_view.DeadlineText;
                    update_task.Task_priority = Convert.ToInt32(edit_view.PriorityText);
                    update_task.Task_link_id  = edit_view.LinkIDText;

                    update_task.Task_sorted_order = 0;
                    update_task.Task_front        = 0;

                    bool result = controller.EditTask(update_task);

                    if (result)
                    {
                        tasks_list.Add(update_task);
                    }
                }
            }
        }