private void MapReminder2To1(ITodo source, TaskItemWrapper target)
        {
            if (source.Alarms.Count == 0)
            {
                target.Inner.ReminderSet = false;
                return;
            }

            if (source.Alarms.Count > 1)
            {
                s_logger.WarnFormat("Task '{0}' contains multiple alarms. Ignoring all except first.", source.UID);
            }

            var alarm = source.Alarms[0];

            target.Inner.ReminderSet = true;

            if (alarm.Trigger.IsRelative && alarm.Trigger.Related == TriggerRelation.Start && alarm.Trigger.Duration.HasValue && source.Start != null)
            {
                target.Inner.ReminderTime = TimeZoneInfo.ConvertTimeFromUtc(source.Start.UTC, _localTimeZoneInfo).Add(alarm.Trigger.Duration.Value);
            }
            else if (alarm.Trigger.IsRelative && alarm.Trigger.Related == TriggerRelation.End && alarm.Trigger.Duration.HasValue && source.Due != null)
            {
                target.Inner.ReminderTime = TimeZoneInfo.ConvertTimeFromUtc(source.Due.UTC, _localTimeZoneInfo).Add(alarm.Trigger.Duration.Value);
            }
            else
            {
                s_logger.WarnFormat("Task '{0}' alarm is not supported. Ignoring.", source.UID);
                target.Inner.ReminderSet = false;
            }
        }
Example #2
0
 private void UpdateToggledForAddedItem(ITodo todoItem)
 {
     if (todoItem != null && todoItem.Parent != null) // if child added, untoggle parent
     {
         todoItem.Parent.IsCompleted = false;
     }
 }
Example #3
0
        public void Todo7_1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\Todo7.ics")[0];
            ITodo      todo = iCal.Todos[0];

            ArrayList items = new ArrayList();

            items.Add(new iCalDateTime(2006, 7, 28, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 8, 4, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 9, 1, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 10, 6, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 11, 3, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2006, 12, 1, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 1, 5, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 2, 2, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 3, 2, 9, 0, 0, tzid));
            items.Add(new iCalDateTime(2007, 4, 6, 9, 0, 0, tzid));

            IList <Occurrence> occurrences = todo.GetOccurrences(
                new iCalDateTime(2006, 7, 1, 9, 0, 0),
                new iCalDateTime(2007, 7, 1, 9, 0, 0));

            // FIXME: Count is not properly restricting recurrences to 10.
            // What's going wrong here?
            Assert.AreEqual(
                items.Count,
                occurrences.Count,
                "TODO should have " + items.Count + " occurrences; it has " + occurrences.Count);

            for (int i = 0; i < items.Count; i++)
            {
                Assert.AreEqual(items[i], occurrences[i].Period.StartTime, "TODO should occur at " + items[i] + ", but does not.");
            }
        }
Example #4
0
        public ITodo GetSelectedItem()
        {
            ITodo selectedTodo = null;

            // scan through all parent and children todos looking for the one that is selected
            foreach (var parent in Parents)
            {
                if (parent.IsSelected)
                {
                    selectedTodo = parent;
                    break;
                }

                foreach (var child in parent.Children)
                {
                    if (child.IsSelected)
                    {
                        selectedTodo = child;
                        break;
                    }
                }
            }

            return(selectedTodo);
        }
Example #5
0
        public void TestTodoActive(string calendar, ArrayList items, params int[] numPeriods)
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\" + calendar)[0];

            ProgramTest.TestCal(iCal);
            ITodo todo = iCal.Todos[0];

            for (int i = 0; i < items.Count; i += 2)
            {
                iCalDateTime dt = (iCalDateTime)items[i];
                dt.TZID = tzid;

                bool tf = (bool)items[i + 1];
                if (tf)
                {
                    Assert.IsTrue(todo.IsActive(dt), "Todo should be active at " + dt);
                }
                else
                {
                    Assert.IsFalse(todo.IsActive(dt), "Todo should not be active at " + dt);
                }
            }

            if (numPeriods != null &&
                numPeriods.Length > 0)
            {
                IEvaluator evaluator = todo.GetService(typeof(IEvaluator)) as IEvaluator;
                Assert.IsNotNull(evaluator);
                Assert.AreEqual(
                    numPeriods[0],
                    evaluator.Periods.Count,
                    "Todo should have " + numPeriods[0] + " occurrences after evaluation; it had " + evaluator.Periods.Count);
            }
        }
Example #6
0
        public void Map1To2(TaskItemWrapper source, ITodo target, iCalTimeZone localIcalTimeZone, IEntityMappingLogger logger)
        {
            target.Summary = source.Inner.Subject;

            if (_configuration.MapBody)
            {
                target.Description = source.Inner.Body;
            }

            if (source.Inner.StartDate != _dateNull)
            {
                target.Start = new iCalDateTime(source.Inner.StartDate.Year, source.Inner.StartDate.Month, source.Inner.StartDate.Day, true);
                target.Start.SetTimeZone(localIcalTimeZone);
            }

            if (source.Inner.Complete && source.Inner.DateCompleted != _dateNull)
            {
                target.Completed = new iCalDateTime(source.Inner.DateCompleted.ToUniversalTime())
                {
                    IsUniversalTime = true, HasTime = true
                };
            }

            target.PercentComplete = source.Inner.PercentComplete;

            if (_configuration.MapRecurringTasks)
            {
                MapRecurrance1To2(source.Inner, target, localIcalTimeZone);
            }

            if (source.Inner.DueDate != _dateNull)
            {
                target.Due = new iCalDateTime(source.Inner.DueDate.Year, source.Inner.DueDate.Month, source.Inner.DueDate.Day, 23, 59, 59);
                target.Due.SetTimeZone(localIcalTimeZone);
                // Workaround for a bug in DDay.iCal, according to RFC5545 DUE must not occur together with DURATION
                target.Properties.Remove(new CalendarProperty("DURATION"));
            }

            target.Properties.Set("STATUS", MapStatus1To2(source.Inner.Status));

            if (_configuration.MapPriority)
            {
                target.Priority = CommonEntityMapper.MapPriority1To2(source.Inner.Importance);
            }

            target.Class = CommonEntityMapper.MapPrivacy1To2(source.Inner.Sensitivity, false);

            MapReminder1To2(source, target);

            MapCategories1To2(source, target);

            if (_configuration.MapCustomProperties || _configuration.UserDefinedCustomPropertyMappings.Length > 0)
            {
                using (var userPropertiesWrapper = GenericComObjectWrapper.Create(source.Inner.UserProperties))
                {
                    CommonEntityMapper.MapCustomProperties1To2(userPropertiesWrapper, target.Properties, _configuration.MapCustomProperties, _configuration.UserDefinedCustomPropertyMappings, logger, s_logger);
                }
            }
        }
Example #7
0
 public UpdateTodoViewModel(ITodo todo)
 {
     Id = todo.Id;
     Name = todo.Name;
     Description = todo.Description;
     Completed = todo.Completed;
     DueDate = todo.DueDate;
 }
 private static void MapCategories1To2(TaskItemWrapper source, ITodo target)
 {
     if (!string.IsNullOrEmpty(source.Inner.Categories))
     {
         Array.ForEach(
             source.Inner.Categories.Split(new[] { CultureInfo.CurrentCulture.TextInfo.ListSeparator }, StringSplitOptions.RemoveEmptyEntries),
             c => target.Categories.Add(c.Trim())
             );
     }
 }
Example #9
0
        void CompareIcalTodoAndAppointment(ITodo todo, TaskItem task)
        {
            Assert.AreEqual(todo.Start.Date, task.StartDate);
            Assert.AreEqual(todo.Due.Date, task.DueDate);
            Assert.IsTrue(todo.Description.Replace('\n', ' ') == task.Body.Replace("\r\n", " "));
            Assert.AreEqual(todo.PercentComplete, task.PercentComplete);
            var alarm = todo.Alarms.FirstOrDefault();

            Assert.IsTrue((alarm != null) == task.ReminderSet);
            //    if (alarm != null)
            //       Assert.Equals(alarm.Trigger.DateTime.Value.ToLocalTime(), task.ReminderTime);
        }
        private void MapCategories2To1(ITodo source, ITaskItemWrapper target)
        {
            var categories = string.Join(CultureInfo.CurrentCulture.TextInfo.ListSeparator, source.Categories);

            if (_configuration.UseTaskCategoryAsFilter && !_configuration.InvertTaskCategoryFilter &&
                source.Categories.All(a => a != _configuration.TaskCategory))
            {
                target.Inner.Categories = categories + CultureInfo.CurrentCulture.TextInfo.ListSeparator + _configuration.TaskCategory;
            }
            else
            {
                target.Inner.Categories = categories;
            }
        }
        private void MapReminder2To1(ITodo source, TaskItemWrapper target, IEntityMappingLogger logger)
        {
            target.Inner.ReminderSet = false;

            if (_configuration.MapReminder == ReminderMapping.@false)
            {
                return;
            }

            if (source.Alarms.Count == 0)
            {
                return;
            }

            if (source.Alarms.Count > 1)
            {
                s_logger.WarnFormat("Task '{0}' contains multiple alarms. Ignoring all except first.", source.UID);
                logger.LogMappingWarning("Task contains multiple alarms. Ignoring all except first.");
            }
            var alarm = source.Alarms[0];

            if (alarm.Trigger.IsRelative && alarm.Trigger.Related == TriggerRelation.Start && alarm.Trigger.Duration.HasValue && source.Start != null)
            {
                var reminderTime = TimeZoneInfo.ConvertTimeFromUtc(source.Start.UTC, _localTimeZoneInfo).Add(alarm.Trigger.Duration.Value);

                if (_configuration.MapReminder == ReminderMapping.JustUpcoming && reminderTime < DateTime.Now)
                {
                    return;
                }
                target.Inner.ReminderSet  = true;
                target.Inner.ReminderTime = reminderTime;
            }
            else if (alarm.Trigger.IsRelative && alarm.Trigger.Related == TriggerRelation.End && alarm.Trigger.Duration.HasValue && source.Due != null)
            {
                var reminderTime = TimeZoneInfo.ConvertTimeFromUtc(source.Due.UTC, _localTimeZoneInfo).Add(alarm.Trigger.Duration.Value);

                if (_configuration.MapReminder == ReminderMapping.JustUpcoming && reminderTime < DateTime.Now)
                {
                    return;
                }
                target.Inner.ReminderSet  = true;
                target.Inner.ReminderTime = reminderTime;
            }
            else
            {
                s_logger.WarnFormat("Task '{0}' alarm is not supported. Ignoring.", source.UID);
                logger.LogMappingWarning("Task alarm is not supported. Ignoring.");
            }
        }
        private void MapCategories1To2(ITaskItemWrapper source, ITodo target)
        {
            if (!string.IsNullOrEmpty(source.Inner.Categories))
            {
                var useTaskCategoryAsFilter = _configuration.UseTaskCategoryAsFilter;

                var sourceCategories = CommonEntityMapper.SplitCategoryString(source.Inner.Categories)
                                       .Where(c => !useTaskCategoryAsFilter || c != _configuration.TaskCategory);

                foreach (var sourceCategory in sourceCategories)
                {
                    target.Categories.Add(sourceCategory);
                }
            }
        }
Example #13
0
 public void RemoveTodo(ITodo todo)
 {
     if (todo == null)
     {
         return;                 // abort, cannot remove null todo
     }
     if (Parents.Contains(todo)) // remove parent
     {
         Parents.Remove(todo);
     }
     else if (todo.Parent != null && todo.Parent.Children.Contains(todo))  // if todo has parent, remove child
     {
         todo.Parent.Children.Remove(todo);
     }
 }
Example #14
0
        /// <summary>
        /// Display the todo.
        /// </summary>
        /// <param name="todo"></param>
        /// <returns></returns>
        public string Display(ITodo todo)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}\n\n", todo.Name);
            if (todo.Notes != null)
            {
                sb.AppendLine("Notes:");
                sb.AppendFormat("{0}\n", todo.Notes);
            }
            sb.AppendFormat(" Created: {0}\n", todo.DateCreated);
            //sb.AppendFormat("Modified: {0}\n", todo.DateModified);

            return(sb.ToString());
        }
Example #15
0
        public void AddNullParentTodo()
        {
            // Arrange
            ITodoManager todoManager = new TodoManager();

            // Act
            ITodo parentTodo = null;

            todoManager.AddTodo(parentTodo);

            // Verify
            var expectedCount = 0;
            var actualCount   = todoManager.GetTotalParentCount();

            Assert.AreEqual(expectedCount, actualCount);
        }
Example #16
0
        public void SetTodos(ITodo[] todos)
        {
            if (todos == null
                || todos.Any(x => x.Id == null)) {
                throw new ArgumentNullException(
                    "todos",
                    "Cannot add new tasks with no or default ID, please use the AddTodo method first.");
            }

            if (!todos.Any(x => x.UserId.Equals(Id)))
                throw new ArgumentException("Cannot add tasks that belong to another user");

            RemoveAllTodos();
            AddTodos(todos);
            Timestamp = DateTime.Now;
        }
Example #17
0
        public TodoController(ITodo context)
        {
            _context = context;

            if (_context.Getall().Result.Count() < 5)
            {
                for (int i = 0; i < 5; ++i)
                {
                    _context.Create(new TodoItemPublic {
                        Name = "Item number" + i,
                        User = new User {
                            Id        = 4,
                            FirstName = "",
                            LastName  = "",
                            Fullname  = ""
                        }
                    });
                }
            }
        }
Example #18
0
        public TodoWrapper Get(ITodo baseTodo, Guid userId, TimeZoneInfo timeZone)
        {
            var result = new TodoWrapper();

            _timeZone = timeZone;
            _baseTodo = baseTodo;

            result.Id          = _baseTodo.Id;
            result.Uid         = _baseTodo.Uid;
            result.CalendarId  = _baseTodo.CalendarId;
            result.Name        = _baseTodo.Name;
            result.Description = _baseTodo.Description;

            var startD = _utcStartDate != DateTime.MinValue ? _utcStartDate : _baseTodo.UtcStartDate;

            startD = new DateTime(startD.Ticks, DateTimeKind.Utc);

            result.Start = new ApiDateTime(startD, _timeZone.GetOffset());

            var completedD = _utcCompletedDate != DateTime.MinValue ? _utcCompletedDate : _baseTodo.Completed;

            completedD = new DateTime(completedD.Ticks, DateTimeKind.Utc);

            result.Completed = new ApiDateTime(completedD, _timeZone.GetOffset());

            var owner = new UserParams()
            {
                Id = _baseTodo.OwnerId, Name = ""
            };

            if (_baseTodo.OwnerId != Guid.Empty)
            {
                owner.Name = UserManager.GetUsers(_baseTodo.OwnerId).DisplayUserName(DisplayUserSettingsHelper);
            }

            result.Owner = owner;

            result.UserId = userId;

            return(result);
        }
        private void MapReminder1To2(TaskItemWrapper source, ITodo target)
        {
            if (source.Inner.ReminderSet)
            {
                var trigger = new Trigger();

                if (source.Inner.StartDate != _dateNull)
                {
                    trigger.Duration = source.Inner.ReminderTime - source.Inner.StartDate;
                    trigger.Parameters.Add("RELATED", "START");
                    trigger.Parameters.Add("VALUE", "DURATION");

                    target.Alarms.Add(
                        new Alarm()
                    {
                        Trigger     = trigger,
                        Description = "This is a task reminder"
                    }
                        );
                    var actionProperty = new CalendarProperty("ACTION", "DISPLAY");
                    target.Alarms[0].Properties.Add(actionProperty);
                }
                else if (source.Inner.DueDate != _dateNull)
                {
                    trigger.Duration = source.Inner.ReminderTime - source.Inner.DueDate;
                    trigger.Parameters.Add("RELATED", "END");
                    trigger.Parameters.Add("VALUE", "DURATION");

                    target.Alarms.Add(
                        new Alarm()
                    {
                        Trigger     = trigger,
                        Description = "This is a task reminder"
                    }
                        );
                    var actionProperty = new CalendarProperty("ACTION", "DISPLAY");
                    target.Alarms[0].Properties.Add(actionProperty);
                }
            }
        }
        public TaskItemWrapper Map2To1(ITodo source, TaskItemWrapper target)
        {
            target.Inner.Subject = source.Summary;
            target.Inner.Body    = source.Description;

            if (source.Start != null)
            {
                target.Inner.StartDate = source.Start.Date;
            }
            if (source.Due != null)
            {
                if (source.Start == null || source.Start.Value <= source.Due.Value)
                {
                    target.Inner.DueDate = source.Due.Date;
                }
            }
            if (source.Completed != null)
            {
                target.Inner.DateCompleted = source.Completed.Date;
                target.Inner.Complete      = true;
            }
            else
            {
                target.Inner.Complete = false;
            }

            target.Inner.PercentComplete = source.PercentComplete;

            target.Inner.Importance = MapPriority2To1(source.Priority);

            target.Inner.Sensitivity = MapPrivacy2To1(source.Class);

            target.Inner.Status = MapStatus2To1(source.Status);

            MapCategories2To1(source, target);

            MapReminder2To1(source, target);

            return(target);
        }
Example #21
0
        public void Add1ParentAndRemoveNullTodo()
        {
            // Arrange
            ITodoManager todoManager = new TodoManager();

            // Act
            ITodo parentTodo = new Todo()
            {
                Task = "Parent1",
            };

            todoManager.AddTodo(parentTodo);
            ITodo todoToRemove = null;

            todoManager.RemoveTodo(todoToRemove);

            // Verify
            var expectedCount = 1;
            var actualCount   = todoManager.GetTotalParentCount();

            Assert.AreEqual(expectedCount, actualCount);
        }
        public void Map1To2(TaskItemWrapper source, ITodo target)
        {
            target.Summary     = source.Inner.Subject;
            target.Description = source.Inner.Body;

            if (source.Inner.StartDate != _dateNull)
            {
                target.Start = new iCalDateTime(source.Inner.StartDate.Year, source.Inner.StartDate.Month, source.Inner.StartDate.Day, false);
            }

            if (source.Inner.DueDate != _dateNull)
            {
                if (source.Inner.DueDate == source.Inner.StartDate)
                {
                    target.Duration = default(TimeSpan);
                }
                else
                {
                    target.Due = new iCalDateTime(source.Inner.DueDate.Year, source.Inner.DueDate.Month, source.Inner.DueDate.Day, false);
                }
            }

            if (source.Inner.Complete && source.Inner.DateCompleted != _dateNull)
            {
                target.Completed = new iCalDateTime(source.Inner.DateCompleted.Year, source.Inner.DateCompleted.Month, source.Inner.DateCompleted.Day, false);
            }

            target.PercentComplete = source.Inner.PercentComplete;

            target.Properties.Set("STATUS", MapStatus1To2(source.Inner.Status));

            target.Priority = MapPriority1To2(source.Inner.Importance);

            target.Class = MapPrivacy1To2(source.Inner.Sensitivity);

            MapReminder1To2(source, target);

            MapCategories1To2(source, target);
        }
        public void Map1To2(TaskItemWrapper source, ITodo target, iCalTimeZone localIcalTimeZone)
        {
            target.Summary     = source.Inner.Subject;
            target.Description = source.Inner.Body;

            if (source.Inner.StartDate != _dateNull)
            {
                target.Start = new iCalDateTime(source.Inner.StartDate.Year, source.Inner.StartDate.Month, source.Inner.StartDate.Day, true);
                target.Start.SetTimeZone(localIcalTimeZone);
            }

            if (source.Inner.DueDate != _dateNull)
            {
                target.Due = new iCalDateTime(source.Inner.DueDate.Year, source.Inner.DueDate.Month, source.Inner.DueDate.Day, 23, 59, 59);
                target.Due.SetTimeZone(localIcalTimeZone);
                // Workaround for a bug in DDay.iCal, according to RFC5545 DUE must not occur together with DURATION
                target.Properties.Remove(new CalendarProperty("DURATION"));
            }

            if (source.Inner.Complete && source.Inner.DateCompleted != _dateNull)
            {
                target.Completed = new iCalDateTime(source.Inner.DateCompleted.Year, source.Inner.DateCompleted.Month, source.Inner.DateCompleted.Day, true);
                target.Completed.SetTimeZone(localIcalTimeZone);
            }

            target.PercentComplete = source.Inner.PercentComplete;

            MapRecurrance1To2(source.Inner, target, localIcalTimeZone);

            target.Properties.Set("STATUS", MapStatus1To2(source.Inner.Status));

            target.Priority = CommonEntityMapper.MapPriority1To2(source.Inner.Importance);

            target.Class = CommonEntityMapper.MapPrivacy1To2(source.Inner.Sensitivity, false);

            MapReminder1To2(source, target);

            MapCategories1To2(source, target);
        }
        private static TodoItem CastAsTodoItem(ITodo item)
        {
            Type t = item.GetType();

            if (t.Equals(typeof(SingleTodo)) || t.Equals(typeof(ListTodo)))
            {
                return(item.GetTodoItem());
            }
            else
            {
                throw new ApplicationException("Unrecognized item type: " + t);
            }

            //switch (t)
            //{
            //    case typeof(SingleTodo):
            //        return new TodoItem();
            //    case typeof(ListTodo):
            //        return new TodoItem();
            //    default:
            //        throw new ApplicationException("Unrecognized item type: " + item.GetType());
            //}
        }
Example #25
0
        public void TestTodoCompleted(string calendar, ArrayList items)
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Todo\" + calendar)[0];

            ProgramTest.TestCal(iCal);
            ITodo todo = iCal.Todos[0];

            for (int i = 0; i < items.Count; i += 2)
            {
                IDateTime dt = (IDateTime)items[i];
                dt.TZID = tzid;

                bool tf = (bool)items[i + 1];
                if (tf)
                {
                    Assert.IsTrue(todo.IsCompleted(dt), "Todo should be completed at " + dt);
                }
                else
                {
                    Assert.IsFalse(todo.IsCompleted(dt), "Todo should not be completed at " + dt);
                }
            }
        }
        private void MapReminder1To2(TaskItemWrapper source, ITodo target)
        {
            if (source.Inner.ReminderSet)
            {
                var trigger = new Trigger();

                if (source.Inner.StartDate != _dateNull)
                {
                    trigger.Duration = source.Inner.ReminderTime - source.Inner.StartDate;
                    trigger.Parameters.Add("RELATED", "START");
                    trigger.Parameters.Add("VALUE", "DURATION");

                    target.Alarms.Add(
                        new Alarm()
                    {
                        Action  = AlarmAction.Display,
                        Trigger = trigger
                    }
                        );
                }
                else if (source.Inner.DueDate != _dateNull)
                {
                    trigger.Duration = source.Inner.ReminderTime - source.Inner.DueDate;
                    trigger.Parameters.Add("RELATED", "END");
                    trigger.Parameters.Add("VALUE", "DURATION");

                    target.Alarms.Add(
                        new Alarm()
                    {
                        Action  = AlarmAction.Display,
                        Trigger = trigger
                    }
                        );
                }
            }
        }
Example #27
0
        public void AddTodo(ITodo todo, ITodo parent)
        {
            if (todo == null)
            {
                return; // abort, cannot add null todo
            }
            if (parent != null && parent.Parent != null)
            {
                return;         // abort, cannot add grandchild todo
            }
            if (parent != null) // add child
            {
                parent.Children.Add(todo);
                todo.Parent = parent; // apply child -> parent relationship
            }
            else                      // otherwise add parent
            {
                Parents.Add(todo);
            }

            UpdateToggledForAddedItem(todo);

            UpdateHighlightingForItemsPastDeadline();
        }
Example #28
0
        public void SetTodos(ITodo[] todos)
        {
            if (todos == null
                || todos.Any(x => x.Id == null || ((ObjectId)x.Id).Equals(ObjectId.Empty))) {
                throw new ArgumentNullException(
                    "todos",
                    "Cannot add new tasks with no or default ID, please use the AddTodo method first.");
            }

            if (
                !todos.Any(
                    x =>
                        ((ObjectId)x.UserId).Equals((ObjectId)Id)
                            || ((ObjectId)x.UserId).Equals(ObjectId.Empty)))
                throw new ArgumentException("Cannot add tasks that belong to another user");

            _user.SetTodos(todos);
        }
Example #29
0
 public TodoWrapper(ITodo baseTodo, Guid userId, TimeZoneInfo timeZone)
 {
     _timeZone   = timeZone;
     _baseTodo   = baseTodo;
     this.UserId = userId;
 }
Example #30
0
 private TodoWrapper(ITodo baseTodo, Guid userId, TimeZoneInfo timeZone, DateTime utcStartDate)
     : this(baseTodo, userId, timeZone)
 {
     _utcStartDate = utcStartDate;
 }
Example #31
0
 /// <summary>
 /// Construct a new todocontainer with a todo in it.
 /// </summary>
 /// <param name="todo"></param>
 public TodoContainer(ITodo todo)
     : this()
 {
     Todo = todo;
 }
 public ITodo Add(ITodo todo)
 {
     GetCollection().Insert((MongoDbTodo)todo);
     return todo;
 }
 public ITodo Update(ITodo todo)
 {
     GetCollection().Save((MongoDbTodo)todo);
     return todo;
 }
Example #34
0
 public ToDoController(ITodo todos)
 {
     _todos = todos;
 }
Example #35
0
 public void AddTodo(ITodo todo)
 {
     AddTodo(todo, null);
 }
Example #36
0
 public void AddTodos(ITodo[] todos)
 {
     _user.AddTodos(todos);
     Todos.Clear();
     foreach (var todo in _user.GetTodos()) Todos.Add((ObjectId)todo.Id);
 }
Example #37
0
 public TodoEvaluator(ITodo todo) : base(todo)
 {
 }
Example #38
0
 public void AddTodos(ITodo[] todos)
 {
     foreach (var todo in todos) Dependency.TodoRepository.Add(todo);
 }