public void TaskItemClick(ZTask item) { taskOperation = TaskOperation.Modify; TaskObj = item; TaskId = TaskObj.TaskDetails.TaskId; ModifyPriority(item); if (TaskObj.TaskDetails.RemindOn == null) { Reminder.IsEnabled = false; checkBox.IsChecked = false; } else { Reminder.IsEnabled = true; checkBox.IsChecked = true; } subtasks.Clear(); foreach (ZTask subTask in item.SubTasks) { subtasks.Add(subTask); Debug.WriteLine(subTask.TaskDetails.TaskTitle); } //if (subtasks.Count == 0) //{ // ZTask zTask = new ZTask(); // TaskDetail subTaskDetail = zTask.TaskDetails; // subTaskDetail.TaskId = Guid.NewGuid().ToString(); // subTaskDetail.ParentTaskId = GetTaskId(); // newRowSubTask = zTask; // Assignment(zTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", subTaskDetail.TaskId); // subtasks.Add(zTask); //} Debug.WriteLine(item.TaskDetails.TaskTitle); }
public async void DeleteSubTask(object sender, RoutedEventArgs e) { Button item = (Button)sender; //Debug.WriteLine(item.Text, item.Name); ZTask task = (ZTask)item.DataContext; // Debug.WriteLine("delete"); MessageDialog showDialog = new MessageDialog("Do you wish to delete this task ?"); showDialog.Commands.Add(new UICommand("Yes") { Id = 0 }); showDialog.Commands.Add(new UICommand("No") { Id = 1 }); showDialog.DefaultCommandIndex = 0; showDialog.CancelCommandIndex = 1; var result = await showDialog.ShowAsync(); if ((int)result.Id == 0) { subtasks.Remove(task); } else { } }
public void PriorityClick(object sender, RoutedEventArgs e) { MenuFlyoutItem item = (MenuFlyoutItem)sender; ZTask task = (ZTask)item.DataContext; High.Background = new SolidColorBrush(Colors.Transparent); Low.Background = new SolidColorBrush(Colors.Transparent); Medium.Background = new SolidColorBrush(Colors.Transparent); if ((string)item.Tag == "2") { High.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); //SubTaskPriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 217, 72, 59)); task.TaskDetails.Priority = 2; } else if ((string)item.Tag == "3") { Medium.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); // SubTaskPriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 93, 188, 210)); task.TaskDetails.Priority = 3; } else if ((string)item.Tag == "4") { Low.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); //SubTaskPriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 136, 136, 136)); task.TaskDetails.Priority = 4; } }
public CreateOrModifyTaskUseCase(List <ZTask> tasks, ZTask parentZtask, ICreateOrModifyTaskPresenterCallback callBack, TaskOperation taskOperation) { this.tasks = tasks; this.parentZtask = parentZtask; this.callback = callBack; this.taskOperation = taskOperation; }
public void AddToLists(ZTask task) { if (task.Assignment.AssigneeId != "user101010") { AssignedToOthers.Add(task); } DateTimeOffset?offset = task.TaskDetails.DueDate; DateTime? dateTime = offset.HasValue ? offset.Value.DateTime : (DateTime?)null; if (dateTime != null) { if (dateTime?.Date == DateTime.Today && task.TaskDetails.TaskStatus == 0) { Today.Add(task); } if (dateTime?.Date < DateTime.Today && task.TaskDetails.TaskStatus == 0) { Delayed.Add(task); } if (dateTime?.Date > DateTime.Today && task.TaskDetails.TaskStatus == 0) { Upcoming.Add(task); } } }
public List <ZTask> TaskUtilityToZTask(List <TaskUtilityModel> ZtaskList) { List <ZTask> tasks = new List <ZTask>(); List <ZTask> subTasks = new List <ZTask>(); foreach (TaskUtilityModel task in ZtaskList) { ZTask zTask = new ZTask(); TaskDetail taskDetail = zTask.TaskDetails; TaskAssignment taskAssignment = zTask.Assignment; taskDetail.TaskId = task.TaskId; taskDetail.TaskTitle = task.TaskTitle; taskDetail.CreatedTime = task.CreatedTime; taskDetail.DueDate = task.DueDate; taskDetail.ModifiedDate = task.ModifiedDate; taskDetail.Priority = task.Priority; taskDetail.TaskStatus = task.TaskStatus; taskDetail.RemindOn = task.RemindOn; taskDetail.Description = task.Description; taskDetail.ParentTaskId = task.ParentTaskId; taskAssignment.TaskId = taskDetail.TaskId; taskAssignment.AssigneeId = task.AssigneeId; taskAssignment.AssignedById = task.AssignedById; taskAssignment.AssignedByName = task.AssignedByName; taskAssignment.AssigneeName = task.AssigneeName; if (zTask.TaskDetails.ParentTaskId == null) { tasks.Add(zTask); } else { subTasks.Add(zTask); } } foreach (ZTask task in tasks) { foreach (ZTask subTask in subTasks) { if (subTask.TaskDetails.ParentTaskId == task.TaskDetails.TaskId) { task.SubTasks.Add(subTask); } } } return(tasks); }
public async void OnSuccess(ZTask task) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Debug.WriteLine("success", RefreshData); RefreshData?.Invoke(task); }); }
public void ItemClick(object sender, ItemClickEventArgs e) { MyFrame.BackStack.Clear(); MyFrame.Navigate(typeof(CreateOrModifyTaskPage), this, new SuppressNavigationTransitionInfo()); ZTask item = (ZTask)e.ClickedItem; TaskClicked?.Invoke(item); ShowSlideInPane(); }
public void Unschedule() { if (!(Content is ZScheduledTask)) { throw new Exception("Task is not scheduled"); } Content = new ZTask { Title = Content.Title, Description = Content.Description }; }
public void AddReply(long commentId, long taskId, string replyString) { Comment addReply = new Comment { CommentString = replyString, TaskID = taskId, ParentId = commentId, commentedDateTime = DateTime.Now }; ZTask zTask = taskManager.GetZTask(taskId); zTask.Comment.Add(addReply); }
public void AddComment(long taskId, string commentString) { Comment addComment = new Comment { CommentString = commentString, TaskID = taskId, commentedDateTime = DateTime.Now }; ZTask zTask = taskManager.GetZTask(taskId); zTask.Comment.Add(addComment); taskManager.UpdateTask(zTask); }
public void AddTask(string taskString, PriorityEnum priority, uint assignedTo, uint assignedBy, DateTime assignedDate, DateTime dueDate) { ZTask addTask = new ZTask { TaskName = taskString, AssignedTo = assignedTo, AssignedBy = assignedBy, AssignedDate = assignedDate, DueDate = dueDate, Priority = priority }; TaskList.Add(addTask); }
async Task ICreateOrModifyTaskDMContract.AddOrModifyTask(List <ZTask> task, ZTask parentZtask, ICreateOrModifyTaskCallback callback, TaskOperation taskOperation) { this.callback = callback; addTaskDbHandler = CreateOrModifyTaskDbHandler.GetInstance; if (taskOperation == TaskOperation.Add) { IAddTasksNetworkHandlerContract Handler = new CreateOrModifyTaskNetworkHandler(); await Handler.AddTasksAsync(this, task, parentZtask); } else { await addTaskDbHandler.AddOrModifyTask(task, parentZtask, this, taskOperation); } }
public void UpdateTask(ZTask updateTask) { foreach (var task in TaskList) { if (task.Id == updateTask.Id) { task.Priority = updateTask.Priority; task.AssignedTo = updateTask.AssignedTo; task.AssignedDate = updateTask.AssignedDate; task.TaskName = updateTask.TaskName; task.DueDate = updateTask.DueDate; task.Comment = updateTask.Comment; } } }
public void SetUpFixture() { task = new ZTask() { Title = ZTestUtil.TestTitle, Description = ZTestUtil.TestDescription }; scheduledTask = new ZScheduledTask() { Title = ZTestUtil.TestTitle, Description = ZTestUtil.TestDescription, Deadline = DateTime.Now, ZBuffer = TimeSpan.FromMinutes(50) }; }
public async Task AddTasksAsync(IAddTasksNetworkCallback addTasksNetworkCallback, List <ZTask> task, ZTask parentZtask) { await NetworkHelper.InitializeClientAsync(); var parameters = new Dictionary <string, string> { { "taction", "addTaskSubtask" }, { "title", parentZtask.TaskDetails.TaskTitle }, { "priority", parentZtask.TaskDetails.Priority.ToString() }, { "status", parentZtask.TaskDetails.TaskStatus.ToString() } }; if (parentZtask.TaskDetails.DueDate != null) { string fmt = "d"; parameters.Add("dueDate", parentZtask.TaskDetails.DueDate.Value.DateTime.Date.ToString(fmt)); } if (parentZtask.TaskDetails.RemindOn != null) { string fmt = "MM/dd/yyyy HH:mm:ss"; parameters.Add("reminderDate", parentZtask.TaskDetails.RemindOn.Value.DateTime.ToString(fmt)); } if (!string.IsNullOrEmpty(parentZtask.TaskDetails.Description)) { parameters.Add("summary", parentZtask.TaskDetails.Description); } var encodedContent = new FormUrlEncodedContent(parameters); CancellationTokenSource cts = new CancellationTokenSource(30000); CancellationToken cancellationToken = cts.Token; HttpResponseMessage response = await NetworkHelper.Client.PostAsync("/zm/taskActionAPI.do", encodedContent, cancellationToken); var result = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { ZTask zTask = new ZTask(); zTask.TaskDetails.TaskTitle = parentZtask.TaskDetails.TaskTitle; zTask.Assignment.AssigneeName = parentZtask.Assignment.AssigneeName; addTasksNetworkCallback.OnSuccess(zTask); } Debug.WriteLine(result); }
async public Task AddOrModifyTask(List <ZTask> task, ZTask parentZtask, ICreateOrModifyTaskDMCallback callback, TaskOperation taskOperation) { await AddOrModifyTasks(task, taskOperation); parentZtask.TaskDetails.ModifiedDate = DateTime.Now.Date; if (taskOperation == TaskOperation.Add) { await DatabaseAccessContext.Connection.InsertAsync(parentZtask.TaskDetails); await DatabaseAccessContext.Connection.InsertAsync(parentZtask.Assignment); } else if (taskOperation == TaskOperation.Modify) { await DatabaseAccessContext.Connection.UpdateAsync(parentZtask.TaskDetails); await DatabaseAccessContext.Connection.UpdateAsync(parentZtask.Assignment); } Debug.WriteLine("hii"); callback.OnSuccess(parentZtask); }
public bool AddReactionToTask(long reactedById, long taskId) { ZTask task = taskManager.GetZTask(taskId); foreach (var reaction in task.Reaction) { if (reaction.ReactedById == reactedById) { return(false); } } Reaction newReaction = new Reaction { ReactedById = reactedById, ReactedToId = taskId }; task.Reaction.Add(newReaction); return(true); }
public void ModifyPriority(ZTask zTask) { High.Background = new SolidColorBrush(Colors.Transparent); Low.Background = new SolidColorBrush(Colors.Transparent); Medium.Background = new SolidColorBrush(Colors.Transparent); if (zTask.TaskDetails.Priority == 4) { Low.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); // PriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 136, 136, 136)); } else if (zTask.TaskDetails.Priority == 3) { Medium.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); // PriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 93, 188, 210)); } else if (zTask.TaskDetails.Priority == 2) { High.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); //PriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 217, 72, 59)); } }
//private void Task_KeyDown(object sender, KeyRoutedEventArgs e) //{ // TextBox b = (TextBox)sender; // if (e.Key == Windows.System.VirtualKey.Enter && subtasks.Count == 0 && !string.IsNullOrWhiteSpace(b.Text)) // { // ZTask zTask = new ZTask(); // TaskDetail subTaskDetail = zTask.TaskDetails; // subTaskDetail.TaskId = Guid.NewGuid().ToString(); // subTaskDetail.ParentTaskId = GetTaskId(); // subTaskDetail.CreatedTime = DateTime.Now.Date; // newRowSubTask = zTask; // Assignment(zTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", subTaskDetail.TaskId); // subtasks.Add(zTask); // // e.Handled = true; LoseFocus(sender); // } //} private void Box_KeyDown(object sender, KeyRoutedEventArgs e) { TextBox b = (TextBox)sender; //ZTask task1 = (ZTask)b.DataContext; //task1.TaskDetails.TaskTitle = b.Text; //Debug.WriteLine(task1.TaskDetails.TaskTitle); //if (subtasks.Last() == task1 && !string.IsNullOrWhiteSpace(b.Text)) //{ // ZTask zTask = new ZTask(); // TaskDetail subTaskDetail = zTask.TaskDetails; // subTaskDetail.TaskId = Guid.NewGuid().ToString(); // subTaskDetail.ParentTaskId = GetTaskId(); // subTaskDetail.CreatedTime = DateTime.Now.Date; // //newRowSubTask = zTask; // Assignment(zTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", subTaskDetail.TaskId); // subtasks.Add(zTask); // //e.Handled = true; LoseFocus(sender); //} if (e.Key == Windows.System.VirtualKey.Enter && !string.IsNullOrWhiteSpace(b.Text)) { ZTask zTask = new ZTask(); TaskDetail subTaskDetail = zTask.TaskDetails; subTaskDetail.TaskId = Guid.NewGuid().ToString(); subTaskDetail.ParentTaskId = GetTaskId(); subTaskDetail.CreatedTime = DateTime.Now.Date; subTaskDetail.TaskTitle = b.Text; subTaskDetail.Priority = AddTask.TaskDetails.Priority; subTaskDetail.DueDate = AddTask.TaskDetails.DueDate; //newRowSubTask = zTask; Assignment(zTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", subTaskDetail.TaskId); subtasks.Add(zTask); AddTask.TaskDetails.TaskTitle = ""; SubTaskTitle.Text = ""; AddTask.TaskDetails.Priority = 4; AddTask.TaskDetails.DueDate = null; //e.Handled = true; LoseFocus(sender); } }
public void PageSetup() { AddTask = new ZTask(); TaskId = ""; subtasks = createTaskViewModel.Ztasks; subtasks.Clear(); ZTask zTask = new ZTask(); TaskDetail taskDetail = zTask.TaskDetails; taskDetail.TaskId = GetTaskId(); Assignment(zTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", taskDetail.TaskId); TaskObj = zTask; TaskObj.TaskDetails.CreatedTime = DateTime.Now.Date; //ZTask zSubTask = new ZTask(); //TaskDetail subTaskDetail = zSubTask.TaskDetails; //subTaskDetail.CreatedTime = DateTime.Now.Date; //subTaskDetail.TaskId = Guid.NewGuid().ToString(); //subTaskDetail.ParentTaskId = GetTaskId(); //Assignment(zSubTask.Assignment, "user101010", "user101010", "Prithvi Venu", "Prithvi Venu", subTaskDetail.TaskId); //subtasks.Add(zSubTask); // Low.Background = new SolidColorBrush(Color.FromArgb(255, 227, 227, 227)); // PriorityText.Foreground = new SolidColorBrush(Color.FromArgb(255, 136, 136, 136)); TaskObj.TaskDetails.Priority = 4; }
public void AddOrModifyTask(ZTask parentZtask, TaskOperation taskOperation) { RemoveEmptyListElements(); usecase = new CreateOrModifyTaskUseCase(Ztasks.ToList <ZTask>(), parentZtask, this, taskOperation); usecase.Execute(); }
public void RefreshTask(ZTask task) { tasks.Add(task); TasksListView.ScrollIntoView(task); TasksListView.SelectedItem = task; }
public Comment GetComment(long commentId, long taskId) { ZTask task = taskManager.GetZTask(taskId); return(task.Comment.Find(comment => comment.Id == commentId)); }
public void RefreshList(ZTask task) { RefreshData?.Invoke(task); taskOperation = TaskOperation.Modify; }
static void Main(string[] args) { TaskManager taskManager = TaskManager.GetTaskManager(); UserManager userManager = UserManager.GetUserManager(); CommentManager commentManager = CommentManager.GetCommentManager(); ReactionManager reactionManager = ReactionManager.GetReactionManager(); userManager.AddUser("dennis", "dennis"); userManager.AddUser("saravana", "saravana"); User newUser; do { Console.WriteLine("Enter your User Name"); string username = Console.ReadLine(); Console.WriteLine("Enter your Password"); string password = Console.ReadLine(); newUser = userManager.VerifyUser(username, password); } while (newUser == null); int option; do { Console.WriteLine("\nEnter Your Choice\n1.Create New Task \n2.List All Task \n3.Update Task\n4.Delete Task\n5.Comment on a Task\n6.Reply to a Comment\n7.View a Specific Task\n8.Like a Task\n9.Like a Comment\n0.Quit"); option = Convert.ToInt32(Console.ReadLine()); switch (option) { case 1: Console.WriteLine("Enter Name of the task"); string taskName = Console.ReadLine(); Console.WriteLine("Assigned To (User Id)"); uint assignedTo = Convert.ToUInt32(Console.ReadLine()); Console.WriteLine("Priority of the Task(Low/Medium/High)"); PriorityEnum Priority = Enum.Parse <PriorityEnum>(Console.ReadLine()); Console.WriteLine("Due Date(1-31)"); int date = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Due Month(1-12)"); int month = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Due Date(YYYY)"); int year = Convert.ToInt32(Console.ReadLine()); DateTime dueDate = new DateTime(year, month, date); taskManager.AddTask(taskName, Priority, assignedTo, newUser.Id, DateTime.Now, dueDate); break; case 2: List <ZTask> allTasks = taskManager.ListAllTasks(); Console.WriteLine("List of all Tasks"); foreach (var ztask in allTasks) { Console.WriteLine($"Task Id: { ztask.Id}"); Console.WriteLine($"Task Name:{ ztask.TaskName}"); Console.WriteLine($"Priority:{ ztask.Priority}"); Console.WriteLine($"Assigned To:{ ztask.AssignedTo}"); Console.WriteLine($"Assigned By:{ ztask.AssignedBy}"); Console.WriteLine($"Assigned Date:{ ztask.AssignedDate}"); Console.WriteLine($"Due Date:{ ztask.DueDate}\n"); } break; case 3: Console.WriteLine("Enter the task Id for updating"); long taskId = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("1.Update Task\n2.Update Priority\n3.Update Assigned To\n4.Update Due date"); int updateNo = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the new data"); string newData = Console.ReadLine(); ZTask updateTask = taskManager.GetZTask(taskId); switch (updateNo) { case 1: updateTask.TaskName = newData; break; case 2: updateTask.Priority = Enum.Parse <PriorityEnum>(newData); break; case 3: updateTask.AssignedTo = Convert.ToUInt32(newData); break; case 4: updateTask.DueDate = Convert.ToDateTime(newData); break; } taskManager.UpdateTask(updateTask); break; case 4: Console.WriteLine("Enter the task ID:"); long deleteTaskId = Convert.ToInt64(Console.ReadLine()); taskManager.DeleteTask(deleteTaskId); break; case 5: Console.WriteLine("Enter the task ID:"); long commentTaskId = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("Enter the Comment String"); string commentString = Console.ReadLine(); commentManager.AddComment(commentTaskId, commentString); break; case 6: Console.WriteLine("Enter the task ID:"); long replyTaskId = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("Enter the Comment ID:"); long replyCommentId = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("Enter the Reply String"); string replyString = Console.ReadLine(); commentManager.AddReply(replyCommentId, replyTaskId, replyString); break; case 7: Console.WriteLine("Enter the Specific task Number"); long specTaskId = Convert.ToInt64(Console.ReadLine()); ZTask task = taskManager.GetZTask(specTaskId); Console.WriteLine($"Task Id: { task.Id}"); Console.WriteLine($"Task Name:{ task.TaskName}"); Console.WriteLine($"Priority:{ task.Priority}"); Console.WriteLine($"Assigned To:{ task.AssignedTo}"); Console.WriteLine($"Assigned By:{ task.AssignedBy}"); Console.WriteLine($"Assigned Date:{ task.AssignedDate}"); Console.WriteLine($"Due Date:{ task.DueDate}"); Console.WriteLine($"No of Likes: {task.Reaction.Count}"); if (task.Comment != null) { foreach (var comment in task.Comment) { Console.WriteLine($"Comment Id: {comment.Id}"); Console.WriteLine($"Comment : { comment.CommentString}"); Console.WriteLine($"Comment Parent Id : {comment.ParentId}"); Console.WriteLine($"Commented Time {comment.commentedDateTime}"); Console.WriteLine($"No of likes {comment.Reaction.Count}\n"); } } break; case 8: Console.WriteLine("Enter the task ID:"); long likeTaskId = Convert.ToInt64(Console.ReadLine()); reactionManager.AddReactionToTask(newUser.Id, likeTaskId); break; case 9: Console.WriteLine("Enter the task ID:"); long likeCommentTaskId = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("Enter the Comment ID:"); long likeCommentId = Convert.ToInt64(Console.ReadLine()); reactionManager.AddReactionToComment(newUser.Id, likeCommentId, likeCommentTaskId); break; } } while (option != 0); }
public void OnSuccess(ZTask task) { callback.OnSuccess(task); }