public HmTask(Hiveminder.Task task, HmBackend hmBackend) { this.task = task; this.backend = hmBackend; //Add Description as note. this.notes = new List<TaskNote>(); if (!string.IsNullOrEmpty (this.task.Description)) notes.Add (new HmNote (this.task)); }
public HmTask(Hiveminder.Task task, HmBackend hmBackend) { this.task = task; this.backend = hmBackend; //Add Description as note. this.notes = new List <INote>(); if (!string.IsNullOrEmpty(this.task.Description)) { notes.Add(new HmNote(this.task)); } }
public bool ContainsTask(Task task) { if (task is HmTask) { HmTask hmtask = task as HmTask; return hmtask.GroupId == this.group.Id; } return false; }
private int CompareByPriorityAndName(Task task) { // The due dates match, so now sort based on priority if (Priority != task.Priority) { switch (Priority) { case TaskPriority.High: return -1; case TaskPriority.Medium: if (task.Priority == TaskPriority.High) { return 1; } else { return -1; } case TaskPriority.Low: if (task.Priority == TaskPriority.None) { return -1; } else { return 1; } case TaskPriority.None: return 1; } } // Due dates and priorities match, now sort by name return Name.CompareTo (task.Name); }
public int CompareToByCompletionDate(Task task) { bool isSameDate = true; if (CompletionDate.Year != task.CompletionDate.Year || CompletionDate.DayOfYear != task.CompletionDate.DayOfYear) isSameDate = false; if (isSameDate == false) { if (CompletionDate == DateTime.MinValue) { // No completion date set for some reason. Since we already // tested to see if the dates were the same above, we know // that the passed-in task has a CompletionDate set, so the // passed-in task should be "higher" in the sort. return 1; } else if (task.CompletionDate == DateTime.MinValue) { // "this" task has a completion date and should evaluate // higher than the passed-in task which doesn't have a // completion date. return -1; } return CompletionDate.CompareTo (task.CompletionDate); } // The completion dates are the same, so no sort based on other // things. return CompareByPriorityAndName (task); }
public int CompareTo(Task task) { bool isSameDate = true; if (DueDate.Year != task.DueDate.Year || DueDate.DayOfYear != task.DueDate.DayOfYear) isSameDate = false; if (isSameDate == false) { if (DueDate == DateTime.MinValue) { // No due date set on this task. Since we already tested to see // if the dates were the same above, we know that the passed-in // task has a due date set and it should be "higher" in a sort. return 1; } else if (task.DueDate == DateTime.MinValue) { // This task has a due date and should be "first" in sort order. return -1; } int result = DueDate.CompareTo (task.DueDate); if (result != 0) { return result; } } // The due dates match, so now sort based on priority and name return CompareByPriorityAndName (task); }
/// <summary> /// Update Task on the server. /// </summary> public Task UpdateTask(Task task) { string responseString; Task updatedTask; XmlSerializer serializer = new XmlSerializer(typeof(Task)); // Can use /=/model/Task/id/<fields> with PUT. responseString = this.Command ("/=/action/BTDT.Action.UpdateTask/", "POST", task.ToUrlEncodedString); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml (responseString); // Updated Task is contained inside 'data' root node XmlNode node = xmlDoc.SelectSingleNode ("//data"); // Task's root node is 'value'. node = RenameNode (node, string.Empty, "value"); updatedTask = (Task) serializer.Deserialize(new StringReader(node.OuterXml)); return updatedTask; }