Exemplo n.º 1
0
        private void SetValueToApprovalConfigurationObject(SPListItem item)
        {
            _approvalConfiguration.TaskConfigurationName = item[TaskConfigurationFieldIds.CogfigName].ToString();
            _approvalConfiguration.ContentTypeId = item[TaskConfigurationFieldIds.TaskContentTypeId].ToString();

            __ActivationProperties.TaskList.EnsureContentTypeInListWithoutPrivileges(_approvalConfiguration.ContentTypeId);
            //_infoPathForm = true;
            _infoPathForm = useInfoPathOrAspx(_approvalConfiguration.ContentTypeId);
            _approvalConfiguration.TaskRuleConfiguration = item.GetCustomSettings<TaskRuleSettings>(IOfficeFeatures.Infrastructure);
            _approvalConfiguration.TaskEventConfiguration = item.GetCustomSettings<TaskEventSettings>(IOfficeFeatures.Infrastructure);
            _approvalConfiguration.ExpandGroup = (bool)item[TaskConfigurationFieldIds.ExpandGroup];

            if (item[TaskConfigurationFieldIds.UseMetaDataAssignment] != null)
                _approvalConfiguration.UseMetadataAssignment = (bool)item[TaskConfigurationFieldIds.UseMetaDataAssignment];
            else
                _approvalConfiguration.UseMetadataAssignment = false;

            if (item[TaskConfigurationFieldIds.ByPassTask] != null)
                _approvalConfiguration.ByPassTask = (bool)item[TaskConfigurationFieldIds.ByPassTask];
            else
                _approvalConfiguration.ByPassTask = false;

            if (item[TaskConfigurationFieldIds.IgnoreIfNoParticipant] != null)
                _approvalConfiguration.IgnoreIfNoParticipant = (bool)item[TaskConfigurationFieldIds.IgnoreIfNoParticipant];
            else
                _approvalConfiguration.IgnoreIfNoParticipant = false;

            _approvalConfiguration.AssignmentType = (ExecutionType)Enum.Parse(typeof(ExecutionType), item[TaskConfigurationFieldIds.AssignmentType].ToString(), true);

            if (item[TaskConfigurationFieldIds.EmailTemplateUrl] != null)
                _approvalConfiguration.URLEmailTemplate = (string)item[TaskConfigurationFieldIds.EmailTemplateUrl];
            else
                _approvalConfiguration.URLEmailTemplate = "";

            if (item[TaskConfigurationFieldIds.AssignmentEmailTemplate] != null)
                _approvalConfiguration.AssignmentEmailTemplate = item[TaskConfigurationFieldIds.AssignmentEmailTemplate].ToString();

            if (item[TaskConfigurationFieldIds.ReminderEmailTemplate] != null)
                _approvalConfiguration.ReminderEmailTemplate = (string)item[TaskConfigurationFieldIds.ReminderEmailTemplate];

            if (item[TaskConfigurationFieldIds.EscalationEmailTemplate] != null)
                _approvalConfiguration.EscalationEmailTemplate = item[TaskConfigurationFieldIds.EscalationEmailTemplate].ToString();

            if (item[TaskConfigurationFieldIds.DueDateDuration] != null)
                _approvalConfiguration.DueDateDuration = GetDuration((double)item[TaskConfigurationFieldIds.DueDateDuration],
                    item[TaskConfigurationFieldIds.DueDateMeasure].ToString());

            if (item[TaskConfigurationFieldIds.ReminderDateDuration] != null)
                _approvalConfiguration.ReminderDuration = GetDuration((double)item[TaskConfigurationFieldIds.ReminderDateDuration],
                    item[TaskConfigurationFieldIds.ReminderDateMeasure].ToString());

            if (item[TaskConfigurationFieldIds.EscalationDateDuration] != null)
                _approvalConfiguration.EscalationDuration = GetDuration((double)item[TaskConfigurationFieldIds.EscalationDateDuration],
                    item[TaskConfigurationFieldIds.EscalationDateMeasure].ToString());

            if (item[TaskConfigurationFieldIds.EscalationParty] != null)
                _approvalConfiguration.EscalationPartyEmail = GetEslacationPartyEmail(item[TaskConfigurationFieldIds.EscalationParty].ToString());

            _approvalConfiguration.UseNumberRequired = (bool)item[TaskConfigurationFieldIds.UseNumberRequired];
            if (_approvalConfiguration.UseNumberRequired)
                _approvalConfiguration.NumberRequired = (int)item[TaskConfigurationFieldIds.NumberRequired];

            if (item[TaskConfigurationFieldIds.TaskContributors] != null)
                _approvalConfiguration.TaskContributors = GetListUsers(item[TaskConfigurationFieldIds.TaskContributors].ToString(), false);

            if (item[TaskConfigurationFieldIds.TaskObservers] != null)
                _approvalConfiguration.TaskObservers = GetListUsers(item[TaskConfigurationFieldIds.TaskObservers].ToString(), false);

            if (ApprovalWorkflowParameter != null && !string.IsNullOrEmpty(ApprovalWorkflowParameter.TaskInstructions))
            {
                _approvalConfiguration.TaskInstruction = ApprovalWorkflowParameter.TaskInstructions;
            }
            else
            {
                if (item[TaskConfigurationFieldIds.TaskInstructions] != null)
                    _approvalConfiguration.TaskInstruction = item[TaskConfigurationFieldIds.TaskInstructions].ToString();
                else
                    _approvalConfiguration.TaskInstruction = "";
            }

            if (item[TaskConfigurationFieldIds.TaskTitlePrefix] != null)
                _approvalConfiguration.TaskTitlePrefix = item[TaskConfigurationFieldIds.TaskTitlePrefix].ToString();
            else
                _approvalConfiguration.TaskTitlePrefix = "";

            _approvalConfiguration.AllowReassign = (bool)item[TaskConfigurationFieldIds.AllowReassign];
            _approvalConfiguration.AllowDueDateChangeOnReassignment = (bool)item[TaskConfigurationFieldIds.AllowDueDateChangeRessignment];
            _approvalConfiguration.AlloRequestInfomation = (bool)item[TaskConfigurationFieldIds.AllowRequestInfomation];
            _approvalConfiguration.AllowDueDateChangeOnRequestInformation = (bool)item[TaskConfigurationFieldIds.AllowDueDateChangeRequestInfomation];
            _approvalConfiguration.AllowPlaceOnHold = (bool)item[TaskConfigurationFieldIds.AllowPlaceHoldOn];
            _approvalConfiguration.AllowSendEEC = (bool)item[TaskConfigurationFieldIds.AllowSendEEC];

            _strApprovers = item[TaskConfigurationFieldIds.Approvers] != null ? item[TaskConfigurationFieldIds.Approvers].ToString() : string.Empty;
            _approverFieldId = item[TaskConfigurationFieldIds.ApproversFieldId] != null ? item[TaskConfigurationFieldIds.ApproversFieldId].ToString() : string.Empty;
        }
Exemplo n.º 2
0
 public static T GetCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName)
 {
     return(listItem.GetCustomSettings <T>(featureName, true));
 }