コード例 #1
0
ファイル: TaskHandler.cs プロジェクト: Miimkkaa/StationLog
 public TaskHandler(TaskVm taskVm)
 {
     TaskVm            = taskVm;
     _frameNavigation  = new FrameNavigateClass();
     _collectionsClass = new Collections();
     _sortingHandler   = new SortingHandler(this);
 }
コード例 #2
0
        public ActionResult Edit(int id)
        {
            TaskVm taskVm = _taskService.Get(id);

            taskVm.Title = "Редактирование задачи";
            return(PartialView("_Edit", taskVm));
        }
コード例 #3
0
 public TaskModel(TaskVm taskVm)
 {
     this.Id     = taskVm.Id;
     this.IsDone = taskVm.IsComplete;
     this.Member = taskVm.AssignedMemberId;
     this.Text   = taskVm.Subject;
 }
コード例 #4
0
 /// <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);
     }
 }
コード例 #5
0
        public TaskVm Create([FromBody] TaskVm task)
        {
            var userName = HttpContext.User.Identity.Name;
            var mTask    = _taskService.Create(task, userName);

            return(mTask);
        }
コード例 #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);
        }
コード例 #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.");
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #11
0
        public TaskVm Get(int id)
        {
            TodolistModel todolist = _taskRepository.Get(id);
            TaskVm        taskVm   = new TaskVm(todolist);

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

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

            taskVm.Title = "Удаление задачи";
            return(PartialView("_Delete", taskVm));
        }
コード例 #16
0
        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.");
        }
コード例 #17
0
 public static AssignTaskCommand ToAssignTaskCommand(this TaskVm model)
 {
     return(new AssignTaskCommand
     {
         Id = model.Id,
         AssignedToId = model.AssignedToId ?? default(Guid)
     });
 }
コード例 #18
0
 public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
 {
     return(new CreateTaskCommand
     {
         Subject = model.Subject,
         AssignedToId = model.AssignedToId
     });
 }
コード例 #19
0
 public MenuPage()
 {
     this.InitializeComponent();
     this.DataContext = new VmContainer();
     MyFrame.Navigate(typeof(TaskPage));
     Bvm = new NavigationHelperVm();
     Tvm = new TaskVm();
 }
コード例 #20
0
 public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
 {
     return(new CreateTaskCommand
     {
         Subject = model.Subject,
         AssignedMemberId = model.AssignedMemberId,
         IsComplete = model.IsComplete
     });
 }
コード例 #21
0
        public static CompleteTaskCommand ToCompleteTaskCommand(this TaskVm model)
        {
            var command = new CompleteTaskCommand()
            {
                Id         = model.Id,
                IsComplete = model.IsComplete
            };

            return(command);
        }
コード例 #22
0
        public static AssignTaskCommand ToAssignTaskCommand(this TaskVm model)
        {
            var command = new AssignTaskCommand()
            {
                Id           = model.Id,
                AssignedToId = model.AssignedToId
            };

            return(command);
        }
コード例 #23
0
        public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
        {
            var command = new CreateTaskCommand()
            {
                Subject      = model.Subject,
                AssignedToId = model.AssignedToId
            };

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

            return(command);
        }
コード例 #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();
 }
コード例 #26
0
        public static CompleteMemberTaskCommand ToCompleteMemberTaskCommand(this TaskVm model)
        {
            var command = new CompleteMemberTaskCommand()
            {
                Id           = model.Id,
                IsComplete   = model.IsComplete,
                AssignedToId = model.AssignedToId
            };

            return(command);
        }
コード例 #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);
     }
 }
コード例 #28
0
        public static CreateTaskCommand ToCreateTaskCommand(this TaskVm model)
        {
            var command = new CreateTaskCommand()
            {
                Subject          = model.Subject,
                IsComplete       = model.IsComplete,
                AssignedMemberId = model.AssignedMemberId,
            };

            return(command);
        }
コード例 #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);
        }
コード例 #30
0
        public static UpdateTaskCommand ToUpdateTaskCommand(this TaskVm model)
        {
            var command = new UpdateTaskCommand()
            {
                Id               = model.Id,
                IsComplete       = model.IsComplete,
                AssignedMemberId = model.AssignedMemberId
            };

            return(command);
        }