Example #1
0
 public TaskHandler(TaskVm taskVm)
 {
     TaskVm            = taskVm;
     _frameNavigation  = new FrameNavigateClass();
     _collectionsClass = new Collections();
     _sortingHandler   = new SortingHandler(this);
 }
        public ActionResult Edit(int id)
        {
            TaskVm taskVm = _taskService.Get(id);

            taskVm.Title = "Редактирование задачи";
            return(PartialView("_Edit", taskVm));
        }
Example #3
0
 public TaskModel(TaskVm taskVm)
 {
     this.Id     = taskVm.Id;
     this.IsDone = taskVm.IsComplete;
     this.Member = taskVm.AssignedMemberId;
     this.Text   = taskVm.Subject;
 }
 /// <summary>
 /// Selects the draged task.
 /// </summary>
 /// <param name="id">The identifier.</param>
 public void SelectDragedTask(Guid id)
 {
     foreach (var taskModel in Tasks)
     {
         DragedTask = Tasks.SingleOrDefault(t => t.Id == id);
     }
 }
Example #5
0
        public TaskVm Create([FromBody] TaskVm task)
        {
            var userName = HttpContext.User.Identity.Name;
            var mTask    = _taskService.Create(task, userName);

            return(mTask);
        }
Example #6
0
        public async Task <bool> CompleteMemberTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await CompleteMemTask(model.ToCompleteMemberTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
            return(isOperationSuccessful);
        }
Example #7
0
        public async void AssignTask(Guid memberId)
        {
            if (memberId != Guid.Empty && SelectedTask != null)
            {
                var result = await AssignTask(new AssignTaskCommand()
                {
                    MemberId = memberId, TaskId = SelectedTask.Id
                });

                // empty task selection
                SelectedTask = null;

                if (result.Succeed)
                {
                    var updatedList = (await GetAllTasks()).Payload;
                    tasks = updatedList;
                    TasksChanged?.Invoke(this, null);
                }
                else
                {
                    AssignTaskFailed?.Invoke(this, "Unable to assign task.");
                }
            }
            else
            {
                AssignTaskFailed?.Invoke(this, "MemberId and TaskId are require to assign task.");
            }
        }
Example #8
0
        public async Task <bool> AssignTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await Assign(model.ToAssignTaskCommand());

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The task assignment was successful, but we can no longer get an updated list of member wise tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to assign task(s).");
            return(isOperationSuccessful);
        }
Example #9
0
        public async Task <bool> CreateTask(TaskVm model)
        {
            isOperationSuccessful = false;

            var result = await Create(model.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedTasks = (await GetAllTasks()).Payload;

                if (updatedTasks != null)
                {
                    isOperationSuccessful = true;
                    tasksToDo             = updatedTasks;
                    TasksChanged?.Invoke(this, null);
                    return(isOperationSuccessful);
                }

                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of tasks from the server.");
                return(isOperationSuccessful);
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
            return(isOperationSuccessful);
        }
Example #10
0
        public async static Task <TaskVm> AddTask(TaskVm task)
        {
            var address  = Api.BuildAdress(taskController, addTask, null, null, "?token=");
            var response = await Api.RequestAndSerialize <TaskVm>(RestSharp.Method.POST, address, task);

            return(response);
        }
        public TaskVm Get(int id)
        {
            TodolistModel todolist = _taskRepository.Get(id);
            TaskVm        taskVm   = new TaskVm(todolist);

            return(taskVm);
        }
Example #12
0
 public void BeforeTest()
 {
     TaskVm              = new TaskVm();
     DeleteTaskHandler   = new DeleteTaskHandler(TaskVm);
     Collections         = new Collections();
     TaskVm.SelectedItem = new TaskEquipmentStation("SMPS", "HCAB");
 }
        public ActionResult Create()
        {
            TaskVm taskVm = new TaskVm();

            taskVm.Title = "Добавление задачи";
            return(PartialView("_Create", taskVm));
        }
 public static CompleteTaskCommand ToCompleteTaskCommand(this TaskVm model)
 {
     return(new CompleteTaskCommand
     {
         Id = model.Id
     });
 }
        public ActionResult Delete(int id)
        {
            TaskVm taskVm = _taskService.Get(id);

            taskVm.Title = "Удаление задачи";
            return(PartialView("_Delete", taskVm));
        }
        public async Task AddTask(TaskModel model)
        {
            ListTasks.Add(model);
            TasksUpdated?.Invoke(this, null);

            var newModel = new TaskVm();

            newModel.Id           = model.Id;
            newModel.AssignedToId = model.Member;
            newModel.IsComplete   = model.IsDone;
            newModel.Subject      = model.Text;

            var result = await Create(newModel.ToCreateTaskCommand());

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    tasks = updatedList;
                    TasksChanged?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The creation was successful, but we can no longer get an updated list of members from the server.");
            }

            UpdateTaskFailed?.Invoke(this, "Unable to create record.");
        }
 public static AssignTaskCommand ToAssignTaskCommand(this TaskVm model)
 {
     return(new AssignTaskCommand
     {
         Id = model.Id,
         AssignedToId = model.AssignedToId ?? default(Guid)
     });
 }
 public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
 {
     return(new CreateTaskCommand
     {
         Subject = model.Subject,
         AssignedToId = model.AssignedToId
     });
 }
Example #19
0
 public MenuPage()
 {
     this.InitializeComponent();
     this.DataContext = new VmContainer();
     MyFrame.Navigate(typeof(TaskPage));
     Bvm = new NavigationHelperVm();
     Tvm = new TaskVm();
 }
Example #20
0
 public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
 {
     return(new CreateTaskCommand
     {
         Subject = model.Subject,
         AssignedMemberId = model.AssignedMemberId,
         IsComplete = model.IsComplete
     });
 }
        public static CompleteTaskCommand ToCompleteTaskCommand(this TaskVm model)
        {
            var command = new CompleteTaskCommand()
            {
                Id         = model.Id,
                IsComplete = model.IsComplete
            };

            return(command);
        }
        public static AssignTaskCommand ToAssignTaskCommand(this TaskVm model)
        {
            var command = new AssignTaskCommand()
            {
                Id           = model.Id,
                AssignedToId = model.AssignedToId
            };

            return(command);
        }
        public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
        {
            var command = new CreateTaskCommand()
            {
                Subject      = model.Subject,
                AssignedToId = model.AssignedToId
            };

            return(command);
        }
Example #24
0
        public static AssignMemberCommand ToAssignMemberCommand(this TaskVm model)
        {
            var command = new AssignMemberCommand()
            {
                TaskId   = model.Id,
                MemberId = (Guid)model.AssignedMemberId
            };

            return(command);
        }
Example #25
0
 public UpdateTaskHandler(UpdateTaskVm updateVm)
 {
     _updateVm        = updateVm;
     Bvm              = new NavigationHelperVm();
     DoGoTask         = new RelayCommandClass(GoTask);
     Dc               = new DateConverter();
     Tvm              = new TaskVm();
     Tvm.SelectedItem = new TaskEquipmentStation();
     Singleton        = TaskEquipmentStationSingleton.GetInstance();
 }
        public static CompleteMemberTaskCommand ToCompleteMemberTaskCommand(this TaskVm model)
        {
            var command = new CompleteMemberTaskCommand()
            {
                Id           = model.Id,
                IsComplete   = model.IsComplete,
                AssignedToId = model.AssignedToId
            };

            return(command);
        }
Example #27
0
 public void SelectTask(Guid id)
 {
     if (tasks.All(taskVm => taskVm.Id != id))
     {
         return;
     }
     {
         SelectedTask = tasks.SingleOrDefault(taskVm => taskVm.Id == id);
         TasksChanged?.Invoke(this, null);
     }
 }
        public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
        {
            var command = new CreateTaskCommand()
            {
                Subject          = model.Subject,
                IsComplete       = model.IsComplete,
                AssignedMemberId = model.AssignedMemberId,
            };

            return(command);
        }
Example #29
0
        public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
        {
            var command = new CreateTaskCommand()
            {
                AssignedToId = Guid.Empty == model.AssignedToId ? (Guid?)null : model.AssignedToId,
                IsComplete   = model.IsComplete,
                Subject      = model.Subject
            };

            return(command);
        }
        public static UpdateTaskCommand ToUpdateTaskCommand(this TaskVm model)
        {
            var command = new UpdateTaskCommand()
            {
                Id               = model.Id,
                IsComplete       = model.IsComplete,
                AssignedMemberId = model.AssignedMemberId
            };

            return(command);
        }