Пример #1
0
        public ApprovalEngine.ApprovalProcessResults ProcessMessage()
        {
            if (!MultilevelAuth.IsInternalMail(this.message))
            {
                return(ApprovalEngine.ApprovalProcessResults.Invalid);
            }
            DecisionHandler decisionHandler = null;

            ApprovalEngine.ApprovalProcessResults result;
            try
            {
                InitiationMessage initiationMessage;
                NdrOofHandler     ndrOofHandler;
                if (InitiationMessage.TryCreate(this.message, out initiationMessage))
                {
                    result = this.HandleInitiationMessage(initiationMessage);
                }
                else if (DecisionHandler.TryCreate(this.messageItem, this.sender.ToString(), this.mbxTransportMailItem.OrganizationId, out decisionHandler))
                {
                    ApprovalEngine.ApprovalProcessResults approvalProcessResults = decisionHandler.Process();
                    result = approvalProcessResults;
                }
                else if (NdrOofHandler.TryCreate(this.messageItem, out ndrOofHandler))
                {
                    result = ndrOofHandler.Process();
                }
                else
                {
                    result = ApprovalEngine.ApprovalProcessResults.Invalid;
                }
            }
            finally
            {
                if (decisionHandler != null)
                {
                    decisionHandler.Dispose();
                }
            }
            return(result);
        }