Ejemplo n.º 1
0
 /// <summary>
 /// Updates the related temporary ids.
 /// </summary>
 /// <param name="map">The map.</param>
 void IWithRelationsArgument.UpdateRelatedTempIds(IDictionary <Guid, long> map)
 {
     if (ProjectId.HasValue && map.TryGetValue(ProjectId.Value.TempId, out var persistentProjectId))
     {
         ProjectId = new ComplexId(persistentProjectId);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReorderEntry" /> class.
        /// </summary>
        /// <param name="id">The identifier of moved entity.</param>
        /// <param name="childOrder">The new order.</param>
        /// <exception cref="T:System.ArgumentException">Entity ID is required for reorder operation</exception>
        public ReorderEntry(ComplexId id, int childOrder)
        {
            if (id.IsEmpty)
            {
                throw new ArgumentException("Entity ID is required for reorder operation", nameof(id));
            }

            Id         = id;
            ChildOrder = childOrder;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveArgument" /> class.
        /// </summary>
        /// <param name="id">The identifier of moved entity.</param>
        /// <param name="parentId">The parent entity identifier.</param>
        /// <exception cref="T:System.ArgumentException">Entity ID is required for the operation</exception>
        public MoveArgument(ComplexId id, ComplexId?parentId)
            : base(id)
        {
            if (id.IsEmpty)
            {
                throw new ArgumentException("Entity ID is required for the move operation", nameof(id));
            }

            ParentId = parentId;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the related temporary ids.
        /// </summary>
        /// <param name="map">The map.</param>
        public void UpdateRelatedTempIds(IDictionary <Guid, int> map)
        {
            int persistentProjectId;

            if (ProjectId.HasValue && map.TryGetValue(ProjectId.Value.TempId, out persistentProjectId))
            {
                ProjectId = new ComplexId(persistentProjectId);
            }

            int persistentItemId;

            if (ItemId.HasValue && map.TryGetValue(ItemId.Value.TempId, out persistentItemId))
            {
                ItemId = new ComplexId(persistentItemId);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveItemArgument"/> class.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="projectId">The project identifier.</param>
        /// <exception cref="ArgumentException">Unable to move an item with an empty project ID.</exception>
        public MoveItemArgument(IEnumerable <Item> items, ComplexId projectId)
        {
            ProjectItems = new Dictionary <ComplexId, ICollection <ComplexId> >();
            foreach (var item in items)
            {
                if (!item.ProjectId.HasValue)
                {
                    throw new ArgumentException("Unable to move item with an empty project ID.", nameof(items));
                }

                ICollection <ComplexId> itemIds;
                if (!ProjectItems.TryGetValue(item.ProjectId.Value, out itemIds))
                {
                    itemIds = new LinkedList <ComplexId>();
                    ProjectItems.Add(item.ProjectId.Value, itemIds);
                }

                itemIds.Add(item.Id);
            }

            ToProject = projectId;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Item" /> class.
 /// </summary>
 /// <param name="content">The content.</param>
 /// <param name="projectId">The project identifier.</param>
 public Item(string content, ComplexId projectId)
 {
     Content   = content;
     ProjectId = projectId;
     Labels    = new Collection <long>();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShareProjectArgument"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="email">The email.</param>
 internal ShareProjectArgument(ComplexId id, string email)
 {
     Id    = id;
     Email = email;
 }
Ejemplo n.º 8
0
 internal BaseEntity(ComplexId id)
 {
     Id = id;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Section" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="projectId">The project identifier.</param>
 public Section(string name, ComplexId projectId)
     : this(name, projectId, 0)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates the move to project argument.
 /// </summary>
 /// <param name="itemId">The item identifier.</param>
 /// <param name="projectId">Id of the destination project. The task becomes the last root task of the project.</param>
 /// <returns>Instance of <see cref="ItemMoveArgument" /></returns>
 public static ItemMoveArgument CreateMoveToProject(ComplexId itemId, ComplexId projectId)
 {
     return(new ItemMoveArgument {
         Id = itemId, ProjectId = projectId
     });
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompleteItemArgument" /> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="dateCompleted">
 /// The date completed. If not set, the server will set the value to the current timestamp.
 /// </param>
 /// <param name="forceHistory">
 /// The force history. When enabled the item is moved to history irregardless of whether it’s a
 /// sub-task or not (by default only root tasks are moved to history).
 /// </param>
 public CompleteItemArgument(ComplexId id, DateTime?dateCompleted = null, bool?forceHistory = null)
 {
     Id            = id;
     DateCompleted = dateCompleted;
     ForceHistory  = forceHistory;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RecurringItemState"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 public RecurringItemState(ComplexId id)
 {
     Id = id;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SectionOrderEntry" /> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="order">The order.</param>
 public SectionOrderEntry(ComplexId id, int order)
 {
     Id    = id;
     Order = order;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CompleteRecurringItemArgument" /> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="dueDate">The due date.</param>
 public CompleteRecurringItemArgument(ComplexId id, DueDate dueDate = null)
 {
     DueDate = dueDate;
     Id      = id;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reminder" /> class.
 /// </summary>
 /// <param name="itemId">An ID of a task.</param>
 public Reminder(ComplexId itemId)
 {
     ItemId = itemId;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Creates the move to project argument.
 /// </summary>
 /// <param name="itemId">The item identifier.</param>
 /// <param name="parentItemId">Id of the destination parent task. The task becomes the last child task of the parent task.</param>
 /// <returns>
 /// Instance of <see cref="ItemMoveArgument" />
 /// </returns>
 public static ItemMoveArgument CreateMoveToParent(ComplexId itemId, ComplexId parentItemId)
 {
     return(new ItemMoveArgument {
         Id = itemId, ParentId = parentItemId
     });
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Section" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="projectId">The project identifier.</param>
 /// <param name="sectionOrder">The section order.</param>
 public Section(string name, ComplexId projectId, int sectionOrder)
 {
     Name         = name;
     ProjectId    = projectId;
     SectionOrder = sectionOrder;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Creates the move to project argument.
 /// </summary>
 /// <param name="itemId">The item identifier.</param>
 /// <param name="sectionId">Id of the destination section. The task becomes the last root task of the section.</param>
 /// <returns>Instance of <see cref="ItemMoveArgument" /></returns>
 public static ItemMoveArgument CreateMoveToSection(ComplexId itemId, ComplexId sectionId)
 {
     return(new ItemMoveArgument {
         Id = itemId, SectionId = sectionId
     });
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShareProjectArgument"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="email">The email.</param>
 internal ShareProjectArgument(ComplexId id, string email)
     : base(id)
 {
     Email = email;
 }