Ejemplo n.º 1
0
        /// <summary>
        /// Gets the due date.
        /// </summary>
        /// <param name="actionDefinition">The action definition.</param>
        /// <param name="item">The item.</param>
        /// <returns>DateTime.</returns>
        public DateTime GetDueDate(IActionDefinition actionDefinition, IDynamicObject item)
        {
            var actionDef = actionDefinition as IAssignmentActionDefinition;

            if (actionDef == null)
            {
                return DateTime.MinValue;
            }

            if (item == null)
            {
                return DateTime.MinValue;
            }

            if (string.IsNullOrEmpty(actionDef.DueDateFieldName))
            {
                return DateTime.MinValue;
            }

            var date = item.GetValueByPropertyName(actionDef.DueDateFieldName) as DateTime?;
            return date ?? DateTime.MinValue;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the type of the action.
        /// </summary>
        /// <param name="actionDefinition">The action definition.</param>
        /// <returns>ActionTypes.</returns>
        /// <exception cref="System.ArgumentException">Unknown action type.;actionDefinition</exception>
        public ActionTypes GetActionType(IActionDefinition actionDefinition)
        {
            if (actionDefinition is IApprovalActionDefinition)
                return ActionTypes.Approval;

            if (actionDefinition is IAssignmentActionDefinition)
                return ActionTypes.Assignment;

            throw new ArgumentException("Unknown action type.", "actionDefinition");
        }